コード例 #1
0
ファイル: frmMain.cs プロジェクト: Donaldpherman/SIL
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog of = new OpenFileDialog();

            of.Filter = "SIL files (*.SIL)|*.SIL|All files (*.*)|*.*";
            if (of.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    SIL_Program prog   = SIL_IO.Load(of.FileName);
                    frmEditor   editor = new frmEditor(); //create new editor window
                    editor.MdiParent   = this;            //set it as a child to Main Form
                    editor.ProgramName = prog.Name;
                    editor.ProgramText = prog.Text;
                    editor.Show();                                                         //display it
                    editor.FormClosing += new FormClosingEventHandler(editor_FormClosing); //Add event handler to catch events when form is closed
                    editor.Activated   += new EventHandler(editor_Activated);
                    editors_.Add(editor);                                                  //add it to active editors list
                    activeEditor_ = editor;                                                //set it as active
                    this.Text     = String.Format("SIL - {0}", activeEditor_.programName_);
                    EditorWindowsUpdate();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to read SIL file!", "SIL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: Donaldpherman/SIL
        /// <summary>
        /// Event when create button is clicked on New Program Wizard
        /// </summary>
        /// <param name="programName">
        /// The name of new program, in future the new program settings,
        /// which will be a class
        /// </param>
        void frmWizard_OnCreate(string programName)
        {
            frmEditor editor = new frmEditor();                                    //create new editor window

            editor.MdiParent   = this;                                             //set it as a child to Main Form
            editor.ProgramName = programName;
            editor.Show();                                                         //display it
            editor.FormClosing += new FormClosingEventHandler(editor_FormClosing); //Add event handler to catch events when form is closed
            editor.Activated   += new EventHandler(editor_Activated);
            editors_.Add(editor);                                                  //add it to active editors list
            activeEditor_ = editor;                                                //set it as active
            this.Text     = String.Format("SIL - {0}", activeEditor_.programName_);
            EditorWindowsUpdate();
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: Donaldpherman/SIL
 void editor_Activated(object sender, EventArgs e)
 {
     activeEditor_ = (frmEditor)sender;
     this.Text     = String.Format("SIL - {0}", activeEditor_.programName_);
 }