mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-22 03:00:14 +08:00
working on HtmlViewer
This commit is contained in:
52
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs
Normal file
52
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
public class Plugin : IViewer
|
||||
{
|
||||
private WebkitPanel _panel;
|
||||
|
||||
public int Priority => Int32.MaxValue;
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
return false;
|
||||
|
||||
switch (Path.GetExtension(path).ToLower())
|
||||
{
|
||||
case ".html":
|
||||
case ".htm":
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size(600, 800);
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_panel = new WebkitPanel();
|
||||
context.ViewerContent = _panel;
|
||||
|
||||
_panel.Navigate(path);
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
~Plugin()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user