/// <summary> /// Hosts the ExplorerBrowser WinForms wrapper in this control /// </summary> public ExplorerBrowser() { InitializeComponent(); // the ExplorerBrowser WinForms control ExplorerBrowserControl = new Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser(); // back the dependency collection properties with instances //SelectedItems = selectedItems = new ObservableCollection<ShellObject>(); //Items = items = new ObservableCollection<ShellObject>(); // NavigationLog = navigationLog = new ObservableCollection<ShellObject>(); // hook up events for collection synchronization //ExplorerBrowserControl.ItemsChanged += new EventHandler(ItemsChanged); //ExplorerBrowserControl.SelectionChanged += new EventHandler(SelectionChanged); //ExplorerBrowserControl.ViewEnumerationComplete += new EventHandler(ExplorerBrowserControl_ViewEnumerationComplete); //ExplorerBrowserControl.ViewSelectedItemChanged += new EventHandler(ExplorerBrowserControl_ViewSelectedItemChanged); //ExplorerBrowserControl.NavigationLog.NavigationLogChanged += new EventHandler<NavigationLogEventArgs>(NavigationLogChanged); // host the control WindowsFormsHost host = new WindowsFormsHost(); try { host.Child = ExplorerBrowserControl; this.root.Children.Clear(); this.root.Children.Add(host); } catch { host.Dispose(); throw; } Loaded += new RoutedEventHandler(ExplorerBrowser_Loaded); }
public void Dispose() { if (Directory.Exists(TempDir)) { foreach (string file in Directory.GetFiles(TempDir)) { File.Delete(file); } } foreach (TabItem tabItem in ManifestTab.Items) { WindowsFormsHost wfh = tabItem.Content as WindowsFormsHost; if (wfh != null) { wfh.Child.Dispose(); wfh.Dispose(); } } ManifestTab.Items.Clear(); MainPanel.Children.Clear(); ManifestTab = null; m_CaseObj = null; }
/// <summary> /// Hosts the ExplorerBrowser WinForms wrapper in this control /// </summary> public ExplorerBrowser() { InitializeComponent(); // the ExplorerBrowser WinForms control ExplorerBrowserControl = new GodLesZ.Library.Win7.Controls.WindowsForms.ExplorerBrowser(); // back the dependency collection properties with instances SelectedItems = selectedItems = new ObservableCollection <ShellObject>(); Items = items = new ObservableCollection <ShellObject>(); NavigationLog = navigationLog = new ObservableCollection <ShellObject>(); // hook up events for collection synchronization ExplorerBrowserControl.ItemsChanged += new EventHandler(ItemsChanged); ExplorerBrowserControl.SelectionChanged += new EventHandler(SelectionChanged); ExplorerBrowserControl.ViewEnumerationComplete += new EventHandler(ExplorerBrowserControl_ViewEnumerationComplete); ExplorerBrowserControl.ViewSelectedItemChanged += new EventHandler(ExplorerBrowserControl_ViewSelectedItemChanged); ExplorerBrowserControl.NavigationLog.NavigationLogChanged += new EventHandler <NavigationLogEventArgs>(NavigationLogChanged); // host the control WindowsFormsHost host = new WindowsFormsHost(); try { host.Child = ExplorerBrowserControl; this.root.Children.Clear(); this.root.Children.Add(host); } catch { host.Dispose(); throw; } Loaded += new RoutedEventHandler(ExplorerBrowser_Loaded); }
private void CleanupHostControl(IView view) { WindowsFormsHost hostControl = hostControls.First(hc => hc.Child == view); hostControl.Child = null; // Prevent views from getting disposed here by clearing the child hostControl.Dispose(); hostControls.Remove(hostControl); }
public void Dispose() { //Browser?.Stop(); //Content = null; _disposed = true; wfh.Dispose(); //Browser.Parent.Dispose(); //Browser.Dispose(); Console.WriteLine("disposed"); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { WindowsFormsHost?.Dispose(); ForegroundWindow?.Close(); } ViewContent = null; ForegroundWindow = null; disposedValue = true; } }
public void Dispose() { if (!_isDisposed) { if (_host != null) { _host.Dispose(); } if (_schemaWebBrowser != null) { _schemaWebBrowser.Dispose(); } GC.SuppressFinalize(this); _isDisposed = true; } }
/// <summary> /// Closes this instance. /// </summary> public void Dispose() { _videoView?.Dispose(); if (_mediaPlayer != null) { _mediaPlayer.EndReached -= VlcOnEndReached; _mediaPlayer.EncounteredError -= OnEncounteredError; _mediaPlayer.Dispose(); } _libVlc?.Dispose(); if (_formHost == null) { return; } _formHost.Child = null; _formHost.Dispose(); }
/// <summary> /// Unhook mediaplayer and dispose foreground window /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (MediaPlayer != null) { MediaPlayer.Hwnd = IntPtr.Zero; } WindowsFormsHost?.Dispose(); ForegroundWindow?.Close(); } ViewContent = null; ForegroundWindow = null; disposedValue = true; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { host.Dispose(); }