public bool CanHandle(string path) { if (Directory.Exists(path)) { return(false); } switch (Path.GetExtension(path).ToLower()) { // Word case ".doc": case ".docx": case ".docm": // Excel case ".xls": case ".xlsx": case ".xlsm": case ".xlsb": // Visio Viewer will not quit after preview, which cause serious memory issue //case ".vsd": //case ".vsdx": // PowerPoint case ".ppt": case ".pptx": // OpenDocument case ".odt": case ".ods": case ".odp": return(PreviewHandlerHost.GetPreviewHandlerGUID(path) != Guid.Empty); } return(false); }
public void PreviewFile(string file, ContextObject context) { _control = new PreviewHandlerHost(); presenter.Child = _control; _control.Open(file); //SetForegroundWindow(new WindowInteropHelper(context.ViewerWindow).Handle); //SetActiveWindow(presenter.Handle); }
public void Dispose() { Application.Current.Dispatcher.BeginInvoke(new Action(() => { presenter.Child = null; presenter?.Dispose(); _control?.Dispose(); _control = null; })); }
public void PreviewFile(string file, ContextObject context) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { _control = new PreviewHandlerHost(); presenter.Child = _control; _control.Open(file); }), DispatcherPriority.Loaded); //SetForegroundWindow(new WindowInteropHelper(context.ViewerWindow).Handle); //SetActiveWindow(presenter.Handle); }
public bool CanHandle(string path) { if (Directory.Exists(path)) { return(false); } if (Extensions.Any(path.ToLower().EndsWith)) { return(PreviewHandlerHost.GetPreviewHandlerGUID(path) != Guid.Empty); } return(false); }