mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
[fxcop] preview handler common (#6762)
* FxCop adjustments * initing due to change for abstract
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user