상속: GraphBuilderBase, IPlayer
예제 #1
0
파일: MainForm.cs 프로젝트: dgis/CodeTV
        private void openVideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = this.GetType().Module.FullyQualifiedName;
            //openFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
            openFileDialog.Filter = Properties.Resources.FileDialogAllFiles;
            openFileDialog.FilterIndex = 1;
            openFileDialog.RestoreDirectory = true;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;

                try
                {
                    ClearGraph();

                    GraphBuilderPlayer newGraph = new GraphBuilderPlayer(this.videoControl);
                    newGraph.GraphStarted += new EventHandler(newGraph_GraphStarted);
                    newGraph.GraphEnded += new EventHandler(newGraph_GraphEnded);
                    newGraph.PossibleChanged += new EventHandler<GraphBuilderBase.PossibleEventArgs>(newGraph_PossibleChanged);
                    newGraph.Settings = Settings;
                    newGraph.FileName = openFileDialog.FileName;
                    this.currentGraphBuilder = newGraph;
                    this.currentGraphBuilder.BuildGraph();
                    this.currentGraphBuilder.RunGraph();

                    OnGraphInit();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }