Esempio n. 1
0
        private void OpenRgx()
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Title         = "Select File to Open";
                dlg.AddExtension  = true;
                dlg.DefaultExt    = ".rgx";
                dlg.Filter        = "Regular Expression Files|*.rgx;*.txt|All Files|*.*";
                dlg.FilterIndex   = 0;
                dlg.Multiselect   = true;
                dlg.ValidateNames = true;
                dlg.SupportMultiDottedExtensions = true;
                dlg.CheckFileExists = true;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    // Grab the currently active document.
                    frmRgxDoc curDoc = ((frmRgxDoc)this.dockPanel.ActiveDocument);
                    // If the document is blank and the status "IsSaved" = true, then
                    //   it means the user hasen't altered the doc, so we're going to
                    //   replace it.
                    if (curDoc == null || (string.IsNullOrEmpty(curDoc.RegExText) && curDoc.IsSaved))
                    {
                        curDoc.Close();
                    }

                    // Open each file selected in the dialog.
                    for (int i = 0; i < dlg.FileNames.Length; i++)
                    {
                        frmRgxDoc newDoc = this.CreateNewDoc();
                        newDoc.OpenFile(dlg.FileNames[i]);
                    }
                }
            }
        }
Esempio n. 2
0
        private void mnuStripDocTabs_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.mnuDocTabs.Close(ToolStripDropDownCloseReason.ItemClicked);
            switch (e.ClickedItem.Name)
            {
            case "mnuDocTabClose":
            {
                frmRgxDoc frmDoc = (frmRgxDoc)this.dockPanel.ActiveDocument;
                frmDoc.Close();
            }
            break;

            case "mnuDocTabSave":
                ((frmRgxDoc)this.dockPanel.ActiveDocument).SaveFile();
                break;

            case "mnuDocTabOpenFolder":
                break;
            }
        }