[fxcop] preview handler common (#6762)

* FxCop adjustments

* initing due to change for abstract
This commit is contained in:
Clint Rutkas
2020-09-23 10:22:17 -07:00
committed by GitHub
parent 75ace74d37
commit 0148669e98
22 changed files with 241 additions and 138 deletions

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Windows.Forms;
@@ -24,7 +25,7 @@ namespace Common
WebBrowser browser = new WebBrowser();
browser.DocumentText = "Test";
browser.Navigate(filePath);
browser.Navigate(new Uri(filePath));
browser.Dock = DockStyle.Fill;
browser.IsWebBrowserContextMenuEnabled = false;
this.Controls.Add(browser);

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
namespace Common
@@ -12,21 +13,50 @@ namespace Common
[Guid("22a1a8e8-e929-4732-90ce-91eaff38b614")]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class TestCustomHandler : FileBasedPreviewHandler
public class TestCustomHandler : FileBasedPreviewHandler, IDisposable
{
private CustomControlTest previewHandlerControl;
private CustomControlTest _previewHandlerControl;
private bool disposedValue;
/// <inheritdoc />
public override void DoPreview()
{
this.previewHandlerControl.DoPreview(this.FilePath);
_previewHandlerControl.DoPreview(FilePath);
}
/// <inheritdoc />
protected override IPreviewHandlerControl CreatePreviewHandlerControl()
{
this.previewHandlerControl = new CustomControlTest();
return this.previewHandlerControl;
_previewHandlerControl = new CustomControlTest();
return _previewHandlerControl;
}
/// <summary>
/// Disposes objects
/// </summary>
/// <param name="disposing">Is Disposing</param>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
_previewHandlerControl.Dispose();
}
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
// TODO: set large fields to null
disposedValue = true;
}
}
/// <inheritdoc/>
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}