Beispiel #1
0
        private void OpenSymbol(object sender, EventArgs e)
        {
            FileSelector fileSelector = new FileSelector(FileSelectorFilters.Symbols);

            fileSelector.FileName = textBox_Symbol.Text;
            if (fileSelector.ExecuteOpenDialog())
            {
                textBox_Symbol.Text = fileSelector.FileName;
            }
            CheckSelection();
        }
Beispiel #2
0
        public DockContent ExecuteOpenFileDialog()
        {
            try
            {
                FileSelector fileSelector = new FileSelector(FileSelectorFilters.AnyFile | FileSelectorFilters.Circuits | FileSelectorFilters.Symbols);
                if (fileSelector.ExecuteOpenDialog())
                {
                    ISaveableDocument editor = null;
                    switch (fileSelector.UsedFilter)
                    {
                    case FileSelectorFilters.Circuits:
                        editor = CreateNewEditorForm();
                        break;

                    case FileSelectorFilters.Symbols:
                        editor = CreateNewSymbolForm();
                        break;
                    }
                    if (editor.LoadDocument(fileSelector.FileName))
                    {
                        HandleRecentFiles(fileSelector.FileName, fileSelector.UsedFilter);

                        return(editor as DockContent);
                    }
                    else
                    {
                        (editor as Form).Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                //TODO: Exception Handling
                MessageBox.Show(ex.Message + "\n-----\n" + ex.StackTrace, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            return(null);
        }