void DSGrapheditForm_Disposed(object sender, EventArgs e) { // force the DSGraphEditPanel to release it's COM objects _grapheditPanel.Dispose(); _grapheditPanel = null; GC.Collect(); }
/// <summary> /// Static method to connect to a IFilterGraph on the ROT and create a DSGraphEditPanel for it /// </summary> /// <returns></returns> public static DSGraphEditPanel ConnectToRemoteGraph() { DSGraphEditPanel ret = null; ROTEntriesDialog rd = new ROTEntriesDialog(); if (rd.ShowDialog() == DialogResult.OK) { try { // Connect to the FilterGraph selected in ROTEntriesDialog and create // a new GraphEditPanel for it IFilterGraph fg = rd.FilterGraph; ret = new DSGraphEditPanel(fg); ret._isRemoteGraph = true; ret._rotEntryString = rd.SelectedROTEntry; } finally { // always dispose of ROTEntriesDialog when you're done with it rd.Dispose(); rd = null; } } return(ret); }
/// <summary> /// Contruct a DSGrapheditForm from an existing FilterGraph /// </summary> public DSGrapheditForm(IFilterGraph filtergraph) { InitializeComponent(); DSGraphEditPanel _grapheditPanel = new DSGraphEditPanel(filtergraph); _grapheditPanel.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(_grapheditPanel); this.Disposed += new EventHandler(DSGrapheditForm_Disposed); _filtersPanel.AssociatedGraphPanel = _grapheditPanel; }