コード例 #1
0
ファイル: DSGraphEditPanel.cs プロジェクト: rocee/DSGraphEdit
        private void _renderURLButton_Click(object sender, EventArgs e)
        {
            URLDialog ud = new URLDialog();

            if (ud.ShowDialog() == DialogResult.OK)
            {
                // we don't want to create a new DSGraphEdit panel, just render
                // the URL into the existing graph
                try
                {
                    // show we're busy rendering and building up the ui for the graph
                    Cursor = Cursors.WaitCursor;

                    int hr = RenderMediaFile(ud.URL);
                    if (hr != 0)
                    {
                        MessageBox.Show(DsError.GetErrorText(hr));
                    }
                }
                finally
                {
                    Cursor = Cursors.Default;
                }
            }
            ud.Dispose();
            ud = null;
        }
コード例 #2
0
        public DSFilterNode(IBaseFilter filter, bool manualAdded)
        {
            _filter      = filter;
            _manualAdded = manualAdded;

            AssociatedUINode = typeof(DSFilterNodeUI).AssemblyQualifiedName;

            // if it's a filesource filter, get the filename for it
            IFileSourceFilter fs = filter as IFileSourceFilter;

            if (fs != null)
            {
                IAMOpenProgress op = filter as IAMOpenProgress;
                if (op != null)
                {
                    // it wants a URL (thought you were being sneaky huh?)
                    string      url   = string.Empty;
                    AMMediaType mtype = new AMMediaType();
                    fs.GetCurFile(out url, mtype);
                    if (url == null)
                    {
                        URLDialog ud = new URLDialog();
                        if (ud.ShowDialog() == DialogResult.OK)
                        {
                            fs.Load(ud.URL, null);
                        }
                        ud.Dispose();
                        ud = null;
                    }
                    fs = null;
                }
                else
                {
                    // it wants a filename
                    string      filename = string.Empty;
                    AMMediaType mtype    = new AMMediaType();
                    fs.GetCurFile(out filename, mtype);
                    if (filename == null)
                    {
                        OpenFileDialog ofd = new OpenFileDialog();
                        if (ofd.ShowDialog() == DialogResult.OK)
                        {
                            fs.Load(ofd.FileName, null);
                        }
                        ofd.Dispose();
                        ofd = null;
                    }
                    fs = null;
                }
            }

            // if it's a filewriter, get the filename for it
            IFileSinkFilter fw = filter as IFileSinkFilter;

            if (fw != null)
            {
                string      filename = string.Empty;
                AMMediaType mtype    = new AMMediaType();
                fw.GetCurFile(out filename, mtype);
                if (filename == null)
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        fw.SetFileName(sfd.FileName, null);
                    }
                }
                fw = null;
            }

            // create and add all DaggerPins for this filter
            SyncPins();
        }