Beispiel #1
0
        /// <summary>
        /// Ctor
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            //Init Scintilla Component
            m_scintillaCtrl = new Scintilla();

            m_scintillaCtrl.Parent           = panelTextEditor;
            m_scintillaCtrl.Dock             = DockStyle.Fill;
            m_scintillaCtrl.Margins[0].Width = 16;
            m_scintillaCtrl.TabWidth         = 2;

            // Configuring the default style with properties
            // we have common to every lexer style saves time.
            m_scintillaCtrl.StyleResetDefault();
            m_scintillaCtrl.Styles[Style.Default].Font      = "Consolas";
            m_scintillaCtrl.Styles[Style.Default].Size      = 10;
            m_scintillaCtrl.Styles[Style.Default].BackColor = Color.FromArgb(219, 227, 227);
            m_scintillaCtrl.StyleClearAll();

            // Configure the lexer styles
            m_scintillaCtrl.Styles[Style.Cpp.Default].ForeColor        = Color.Silver;
            m_scintillaCtrl.Styles[Style.Cpp.Comment].ForeColor        = Color.FromArgb(0, 128, 0);     // Green
            m_scintillaCtrl.Styles[Style.Cpp.CommentLine].ForeColor    = Color.FromArgb(0, 128, 0);     // Green
            m_scintillaCtrl.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128); // Gray
            m_scintillaCtrl.Styles[Style.Cpp.Number].ForeColor         = Color.Olive;
            m_scintillaCtrl.Styles[Style.Cpp.Word].ForeColor           = Color.Blue;
            m_scintillaCtrl.Styles[Style.Cpp.Word2].ForeColor          = Color.Blue;
            m_scintillaCtrl.Styles[Style.Cpp.String].ForeColor         = Color.FromArgb(163, 21, 21); // Red
            m_scintillaCtrl.Styles[Style.Cpp.Character].ForeColor      = Color.FromArgb(163, 21, 21); // Red
            m_scintillaCtrl.Styles[Style.Cpp.Verbatim].ForeColor       = Color.FromArgb(163, 21, 21); // Red
            m_scintillaCtrl.Styles[Style.Cpp.StringEol].BackColor      = Color.Pink;
            m_scintillaCtrl.Styles[Style.Cpp.Operator].ForeColor       = Color.Purple;
            m_scintillaCtrl.Styles[Style.Cpp.Preprocessor].ForeColor   = Color.Maroon;

            m_scintillaCtrl.Lexer = Lexer.Cpp;


            //Create keywords for HLSL
            StringBuilder sb  = new StringBuilder();
            var           map = new EnumMap <ShaderToken>();

            map.Load("HLSLKeywords.map");
            foreach (var kw in map)
            {
                var str = kw.Key + " ";

                if (str[0] == ':')
                {
                    str = str.Substring(1);
                }

                sb.Append(str);
            }
            m_scintillaCtrl.SetKeywords(0, sb.ToString());

            //MRU
            mruMenu = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", 16);
            mruMenu.LoadFromRegistry();
        }
        private void btnUseSubmenu_Click(object sender, EventArgs e)
        {
			if (m_mruIsInline)
			{
				String[] filenames = mruMenu.GetFiles();
				mruMenu.RemoveAll();

				mruMenu = new MruStripMenu(menuRecentFile, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", false);
				mruMenu.SetFiles(filenames);

				btnUseSubmenu.Text = "&Use Inline";
				m_mruIsInline = false;
			}
			else
			{
				String[] filenames = mruMenu.GetFiles();
				mruMenu.RemoveAll();

				mruMenu = new MruStripMenuInline(menuFile, menuRecentFile, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", 16);
				mruMenu.SetFiles(filenames);

				btnUseSubmenu.Text = "&Use Submenu";
				m_mruIsInline = true;
			}
		}
Beispiel #3
0
        public seemsForm()
        {
            InitializeComponent();

            ToolStripManager.RenderMode = ToolStripManagerRenderMode.Professional;

            this.Load            += seems_Load;
            this.Resize          += seems_Resize;
            this.LocationChanged += seems_LocationChanged;

            seemsRegistryKey = Registry.CurrentUser.OpenSubKey(seemsRegistryLocation);
            if (seemsRegistryKey != null)
            {
                seemsRegistryKey.Close();
            }

            recentFilesMenu = new MruStripMenu(recentFilesFileMenuItem, new MruStripMenu.ClickedHandler(recentFilesFileMenuItem_Click), seemsRegistryLocation + "\\Recent File List", true);

            browseToFileDialog = new OpenDataSourceDialog();
            browseToFileDialog.InitialDirectory = "C:\\";

            combineIonMobilitySpectraToolStripMenuItem.Checked = Properties.Settings.Default.CombineIonMobilitySpectra;
            ignoreZeroIntensityPointsToolStripMenuItem.Checked = Properties.Settings.Default.IgnoreZeroIntensityPoints;
            acceptZeroLengthSpectraToolStripMenuItem.Checked   = Properties.Settings.Default.AcceptZeroLengthSpectra;
            timeInMinutesToolStripMenuItem.Checked             = Properties.Settings.Default.TimeInMinutes;

            DockPanelManager.RenderMode = DockPanelRenderMode.VisualStyles;

            manager = new Manager(dockPanel);

            Manager.GraphFormGotFocus      += new GraphFormGotFocusHandler(Manager_GraphFormGotFocus);
            Manager.LoadDataSourceProgress += new LoadDataSourceProgressEventHandler(Manager_LoadDataSourceProgress);
        }
Beispiel #4
0
        public MainEditor()
        {
            //Initialize the WinForm
            InitializeComponent();
            KeyPreview = true;

            _mruMenu = new MruStripMenu(mruList, OnMruClickedHandler, _mruRegKey + "\\MRU", 6);
            _loadedWorldspaceProject = null;

            // Register a handler for WorldspaceProjectLoaded that sets the Window's title.
            WorldspaceProjectLoaded += OnWorldSpaceProjectLoaded;

            glControl.KeyDown   += HandleEventKeyDown;
            glControl.KeyUp     += HandleEventKeyUp;
            glControl.MouseDown += HandleEventMouseDown;
            glControl.MouseMove += HandleEventMouseMove;
            glControl.MouseUp   += HandleEventMouseUp;
            glControl.Resize    += Display.Internal_EventResize;

            glControl.Load += (sender, args) =>
            {
                // Hook Application Idle to force rendering while no events are happening.
                Application.Idle += HandleApplicationIdle;

                Console.WriteLine("glContro loaded!");
                // Initialize our core once the glControl has been created as initalization
                // requires a glContext.
                _editorCore = new EditorCore();
            };

            // Hook the glControl's Paint function (which is called every frame thanks to above)
            glControl.Paint += (sender, args) => RenderFrame();
        }
Beispiel #5
0
        public MainForm(IDataLoader dataLoader)
        {
            if (dataLoader == null)
            {
                throw new ArgumentNullException("Invalid data loader.");
            }

            this._dataLoader = dataLoader;

            this.InitializeComponent();

            this._tabView  = new TabView(this.tab);
            this._pathView = new PathView(this.pathContainer);
            this._itemList = new ItemList(this.list);
            this._itemView = new ItemView(this.listView);

            this._tabView.IndexChanged  += this.OnCategoryChanged;
            this._itemList.ItemSelected += this.OnItemSelected;
            this._itemView.ItemSelected += this.OnProperySelected;

            this._mruMenu = new MruStripMenu(this.menuRecentFile, this.OnMruFile, MRU_REG_KEY + "\\RecentFiles", false);
            this._mruMenu.LoadFromRegistry();
            this.CheckRecentFiles();

            if (this._mruMenu.GetFiles().Length > 0)
            {
                this.OnMruFile(0, this._mruMenu.GetFileAt(0));
            }
        }
Beispiel #6
0
        public seemsForm()
        {
            InitializeComponent();

            ToolStripManager.RenderMode = ToolStripManagerRenderMode.Professional;

            this.Load            += seems_Load;
            this.Resize          += seems_Resize;
            this.LocationChanged += seems_LocationChanged;

            seemsRegistryKey = Registry.CurrentUser.OpenSubKey(seemsRegistryLocation);
            if (seemsRegistryKey != null)
            {
                seemsRegistryKey.Close();
            }

            recentFilesMenu = new MruStripMenu(recentFilesFileMenuItem, new MruStripMenu.ClickedHandler(recentFilesFileMenuItem_Click), seemsRegistryLocation + "\\Recent File List", true);

            browseToFileDialog = new OpenDataSourceDialog();
            browseToFileDialog.InitialDirectory = "C:\\";

            DockPanelManager.RenderMode = DockPanelRenderMode.VisualStyles;

            manager = new Manager(dockPanel);

            Manager.GraphFormGotFocus      += new GraphFormGotFocusHandler(Manager_GraphFormGotFocus);
            Manager.LoadDataSourceProgress += new LoadDataSourceProgressEventHandler(Manager_LoadDataSourceProgress);
        }
Beispiel #7
0
        public Form1()
        {
            InitializeComponent();

            mnuMRU            = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, OnMRU);
            mnuMRU.MaxEntries = 7;

            LoadSettings(); // NOTE: must go after mnuMRU init

            treePanel1.OnNodeClick       += TreePanel1_OnNodeClick;
            treePanel1.OnNodeHover       += TreePanel1_OnNodeHover;
            treePanel1.OnNodeDoubleClick += TreePanel1_OnNodeDoubleClick;
        }
Beispiel #8
0
        private void ToggleRecentFiles()
        {
            if (_saveMruListToRegistry)
            {
                _msm.SaveToRegistry();
            }
            else
            {
                _msm.SaveToFileSystem();
            }

            _msm.RemoveAll();
            _msm = null;


            if (_saveMruListToRegistry)
            {
                if (_useSubMenuForMruList)
                {
                    _useSubMenuForMruList = false;
                    //use inline
                    _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", _maxMruListEntries);
                }
                else
                {
                    _useSubMenuForMruList = true;
                    _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", false, _maxMruListEntries);
                }
                _msm.MaxShortenPathLength = _maxShortenPathLength;
                _msm.LoadFromRegistry();
            }
            else
            {
                //load from and save to the file system
                if (_useSubMenuForMruList)
                {
                    _useSubMenuForMruList = false;
                    //use inline
                    _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                }
                else
                {
                    _useSubMenuForMruList = true;
                    _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                }
                _msm.MaxShortenPathLength = _maxShortenPathLength;
                _msm.FileSystemMruPath    = _mRUListSaveFileSubFolder;
                _msm.LoadFromFileSystem();
            }
        }
		public MruToolStripMenuDemo()
        {
            InitializeComponent();

			RegistryKey regKey = Registry.CurrentUser.OpenSubKey(mruRegKey);
			if (regKey != null)
            {
                menuClearRegistryOnExit.Checked = (int)regKey.GetValue("delSubkey", 1) != 0;
                regKey.Close();
            }
			
			mruMenu = new MruStripMenuInline(menuFile, menuRecentFile, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", 16);

			IncFilename();
		}
Beispiel #10
0
        public MainEditor()
        {
            //Initialize the WinForm
            InitializeComponent();

            _mruMenu = new MruStripMenu(mruList, OnMruClickedHandler, _mruRegKey + "\\MRU", 6);

            SelectedEntityFileChanged += delegate(WindWakerEntityData data)
            {
                Console.WriteLine("Changing Ent file...");
            };

            //Register a handler for WorldspaceProjectLoaded that sets the Window's title.
            WorldspaceProjectLoaded += OnWorldSpaceProjectLoaded;
        }
Beispiel #11
0
        private void initMRU()
        {
            this.threadFilterHistory  = new StringHistory(20, this.tsTxtFilterThread, Settings.Default.ThreadFilterHistory);
            this.loggerFilterHistory  = new StringHistory(20, this.tsTxtFilterLogger, Settings.Default.LoggerFilterHistory);
            this.messageFilterHistory = new StringHistory(20, this.tsTxtFilterMessage, Settings.Default.MessageFilterHistory);

            //this.mruMenu = new MruStripMenu(this.recentFilesToolStripMenuItem,
            //                                    new MruStripMenu.ClickedHandler(OnMruFile),
            //                                    Resources.mruRegKey + "\\MRU", false);

            this.mruMenu = new MruStripMenuInline(this.tsBtnOpen, this.recentFilesToolStripMenuItem1,
                                                  new MruStripMenu.ClickedHandler(OnMruFile),
                                                  Resources.mruRegKey + "\\MRU", false);
            this.mruMenu.LoadFromRegistry();
        }
Beispiel #12
0
        public Form1()
        {
            InitializeComponent();
//            _data = new FileSet(); //List<FileData>();

            AllowDrop = false;  // TODO restore drag-and-drop support?
            //DragDrop += Form1_DragDrop;
            //DragEnter += Form1_DragEnter;

            var folder = Path.GetDirectoryName(Application.ExecutablePath) ?? @"C:\";

            _logPath = Path.Combine(folder, "imgComp.log");

            mnuMRU            = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, OnMRU);
            mnuMRU.MaxEntries = 6;
        }
Beispiel #13
0
        public Form1()
        {
            InitializeComponent();

            personSel.DisplayMember = "Text";
            personSel.ValueMember   = "Value";
            try { personSel.DataSource = _cmbItems; } catch { }

            mnuMRU            = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, OnMRU);
            mnuMRU.MaxEntries = 7;

            LoadSettings(); // NOTE: must go after mnuMRU init

            DoubleBuffered   = true;
            treePanel.Paint += treePanel_Paint;
        }
Beispiel #14
0
        public Form1()
        {
            InitializeComponent();
            this.Text = "CoDWaW Map Zipper v" + Application.ProductVersion.Substring(0, 5);
            Version nonBeta = new Version(1, 0, 0, 0);

            if (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version < nonBeta)
            {
                this.Text += " BETA";
            }

            mruMenu = new MruStripMenuInline(fileToolStripMenuItem, menuRecentFile, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", 16);

            openFileD = new openFileDelegate(this.openFile);

            tasks               = new List <Task>();
            currentlyBusy       = false;
            cancelOperationFlag = false;
            operationCanceled   = false;
        }
        private void Init()
        {
            MpeInstaller.Init();
            InitializeComponent();
            Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

            Package = new PackageClass();
            treeView1.ExpandAll();
            _panels.Add("Node0", new WelcomSection());
            _panels.Add("Node2", new GeneralSection());
            _panels.Add("Node3", new FilesGroupsSection());
            _panels.Add("Node4", new InstallSections());
            _panels.Add("Node5", new RequirementsSection());
            _panels.Add("Node6", new BuildSection());
            _panels.Add("Node7", new ToolsUpdateXml());

            openFileDialog.Filter = mpeFileDialogFilter;
            saveFileDialog.Filter = mpeFileDialogFilter;

            mruMenu = new MruStripMenu(mnu_recent, OnMruFile, mruRegKey + "\\MRU", true, 10);
        }
Beispiel #16
0
        /// <summary>
        /// Main form constructor
        /// </summary>
        public frmMain()
        {
            InitializeComponent();

            // All the work is performed by the constructor. We just save the object
            // until end of the form life to ensure that the save happens at the right
            // time
            _formState = new FormState(this, "frmMain");

            try
            {
                RegistryKey regKey = Registry.CurrentUser.OpenSubKey(mruRegKey);
                if (regKey != null)
                {
                    regKey.Close();
                }

                mruMenu = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(LoadMRUFile), mruRegKey + "\\MRU");
            }
            catch (Exception Ex)
            {
                mnuFileRecent.Enabled = false;
                mnuFileRecent.Text    = "Error: Recent Files not Available";
                ClassLogger.LogException(LogLevel.Warn, String.Format("{0} threw exception {1}.", Debug.FunctionName, Ex.Message), null);
            }
            ProteinCollection.Instance.NFOUpdated += new NFOUpdatedEventHandler(Instance_NFOUpdated);

            if (Environment.OSVersion.Version.Major >= 6)
            {
                // Vista-ize the UI
                treeHosts.Font = new Font("Segoe UI", 9F, FontStyle.Regular);
            }
            else
            {
                // XP-ize the UI
                treeHosts.Font = new Font("Verdana", 8F, FontStyle.Regular);
            }
        }
Beispiel #17
0
        public MainForm()
        {
            try
            {
                InitializeComponent();

                TryAttachContextMenuToAccordViewWithGraph(cvPCA_ProportionsVisualization);
                TryAttachContextMenuToAccordViewWithGraph(cvPCA_DistributionVisualization);
                TryAttachContextMenuToAccordViewWithGraph(spvKPCA);
                TryAttachContextMenuToAccordViewWithGraph(cvKPCA_ProportionsVisualization);
                TryAttachContextMenuToAccordViewWithGraph(cvKPCA_DistributionVisualization);

                resourceManager = new ResourceManager(typeof(MainForm));

                recentsMenu = new MruStripMenu(recentsToolStripMenuItem, OpenRecentProject,
                                               Path.Combine(Settings.Default.RecentProjectsRegistryKey, Settings.Default.RecentProjectsDirName),
                                               Settings.Default.RecentProjectsMemorised);
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
        }
Beispiel #18
0
        public Form1()
        {
            InitializeComponent();

            personSel.DisplayMember = "Text";
            personSel.ValueMember   = "Value";
            personSel.DataSource    = _cmbItems;

            mnuMRU            = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, OnMRU);
            mnuMRU.MaxEntries = 7;

            LoadSettings(); // NOTE: must go after mnuMRU init

            LoadGed += Form1_LoadGed;

            timeline1.TrackBorderSize = 1;
            timeline1.TrackLabelWidth = 100; // TODO should adjust automagically
            timeline1.TrackSpacing    = 5;   // TODO primary/secondary spacing
            timeline1.TrackHeight     = 20;
            timeline1.DecadeLabelHigh = 16;

            timeline1.SelectionChanged += SelectionChanged;
        }
Beispiel #19
0
        public Form1()
        {
            InitializeComponent();

            mnuMRU            = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, OnMRU);
            mnuMRU.MaxEntries = 7;

            LoadSettings(); // NOTE: must go after mnuMRU init

            LoadGed += Form1_LoadGed;

            Filler               = "-";
            textBox1.Text        = Filler;
            radioButton1.Checked = true;
            TopLabel             = "Person";
            BotLabel             = "Spouse";
            radioButton2.Checked = false;

            cmbWebFont.DataSource     = _webFonts;
            cmbTheme.DataSource       = _themes;
            cmbFontSize.DataSource    = _fontSizes;
            cmbFontSize.SelectedIndex = cmbFontSize.FindStringExact("14");

            cmbPerson.DisplayMember = "Text";
            cmbPerson.ValueMember   = "Value";
            cmbPerson.DataSource    = _cmbPedItems;

            rbFamGroup.CheckedChanged += chartType_Change;
            rbPed4.CheckedChanged     += chartType_Change;
            rbPed5.CheckedChanged     += chartType_Change;

            rbFamGroup.Checked = true;

            _famEdit = new EditFamSheet();
            webBrowser1.ObjectForScripting = this;
        }
Beispiel #20
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string configValue = string.Empty;

            try
            {
                this.Text = AppInfo.AssemblyProduct;

                configValue = AppGlobals.AppConfig.GetConfigValue("SaveErrorMessagesToErrorLog");
                if (configValue.ToUpper() == "TRUE")
                {
                    _saveErrorMessagesToAppLog = true;
                }
                else
                {
                    _saveErrorMessagesToAppLog = false;
                }
                _appLogFileName = AppGlobals.AppConfig.GetConfigValue("AppLogFileName");

                if (_appLogFileName.Trim().Length > 0)
                {
                    AppGlobals.AppMessages.AppLogFilename = _appLogFileName;
                }

                this.chkEraseOutputBeforeEachTest.Checked = true;
                this.chkMultiSelect.Checked     = false;
                this.chkCreatePrompt.Checked    = false;
                this.chkOverwritePrompt.Checked = true;
                this.chkNewFolderButton.Checked = true;
                //this.txtInitialDirectory.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                this.txtInitialDirectory.Text = @"c:\temp";
                this.txtFilter.Text           = "Text Files|*.txt|Xml Files|*.xml|Schema Files|*.xsd|All Files|*.*";
                this.txtFilterIndex.Text      = "1";

                this.txtRootFolderPath.Text = @"C:\";

                _saveMruListToRegistry    = AppConfig.GetBooleanValueFromConfigFile("SaveMruListToRegistry", "True");
                _mRUListSaveFileSubFolder = AppConfig.GetStringValueFromConfigFile("MRUListSaveFileSubFolder", @"PFApps\InitWinFormsAppWithToolbar\Mru\");
                _mRUListSaveRegistryKey   = AppConfig.GetStringValueFromConfigFile("MRUListSaveRegistryKey", @"SOFTWARE\PFApps\InitWinFormsAppWithToolbar");
                _maxMruListEntries        = AppConfig.GetIntValueFromConfigFile("MaxMruListEntries", (int)4);
                _useSubMenuForMruList     = AppConfig.GetBooleanValueFromConfigFile("UseSubMenuForMruList", "true");
                _maxShortenPathLength     = AppConfig.GetIntValueFromConfigFile("MaxShortenPathLength", 96);

                if (_saveMruListToRegistry)
                {
                    if (_useSubMenuForMruList)
                    {
                        _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", false, _maxMruListEntries);
                    }
                    else
                    {
                        //use inline
                        _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", _maxMruListEntries);
                    }
                    _msm.MaxShortenPathLength = _maxShortenPathLength;
                    _msm.LoadFromRegistry();
                }
                else
                {
                    //load from and save to the file system
                    if (_useSubMenuForMruList)
                    {
                        _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                    }
                    else
                    {
                        //use inline
                        _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                    }
                    _msm.MaxShortenPathLength = _maxShortenPathLength;
                    _msm.FileSystemMruPath    = _mRUListSaveFileSubFolder;
                    _msm.LoadFromFileSystem();
                }


                EnableFormControls();
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
        }
Beispiel #21
0
        public seems(string[] args)
        {
            InitializeComponent();

            seemsRegistryKey = Registry.CurrentUser.OpenSubKey(seemsRegistryLocation);
            if (seemsRegistryKey != null)
            {
                seemsRegistryKey.Close();
            }

            recentFilesMenu = new MruStripMenu(recentFilesFileMenuItem, new MruStripMenu.ClickedHandler(recentFilesFileMenuItem_Click), seemsRegistryLocation + "\\Recent File List", true);

            dataSources = new Map <string, DataSource>();

            setFileControls(true);
            setScanControls(false);

            DummyScanNumberComboBoxHost.Control.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            DummyScanNumberComboBoxHost.Control.AutoSize = false;
            DummyScanNumberComboBoxHost.Control.Enabled  = false;
            DummyScanNumberComboBoxHost.Control.Location = new System.Drawing.Point(0, 0);
            DummyScanNumberComboBoxHost.Control.Name     = "scanNumberComboBox";
            DummyScanNumberComboBoxHost.Control.Size     = new Size(100, 22);
            DummyScanNumberComboBoxHost.Control.TabIndex = 8;
            ToolStrip1.Items.Insert(ToolStrip1.Items.IndexOf(toolStripLabel2), DummyScanNumberComboBoxHost);
            DummyScanNumberComboBoxHost.Enabled      = false;
            DummyScanNumberComboBoxHost.Alignment    = ToolStripItemAlignment.Right;
            DummyScanNumberComboBoxHost.Control.Dock = DockStyle.Fill;
            DummyScanNumberComboBoxHost.AutoSize     = false;

            browseToFileDialog        = new OpenFileDialog();
            browseToFileDialog.Filter =
                "Any spectra format (*.mzData;*.mzXML;*.xml;*.raw;*.wiff;*.mgf;*.dta;fid;*.baf;*.yep)|*.mzData;*.mzXML;*.xml;*.raw;*.wiff;*.mgf;*.dta;fid;*.baf;*.yep|" +
                "mzData (*.mzData;*.xml)|*.mzData;*.xml|" +
                "mzXML (*.mzXML;*.xml)|*.mzXML;*.xml|" +
                "RAW (*.RAW)|*.raw|" +
                "WIFF (*.WIFF)|*.wiff|" +
                "Bruker (fid;*.baf;*.yep)|fid;*.baf;*.yep|" +
                "MGF (*.mgf)|*.mgf|" +
                "DTA (*.dta)|*.dta";
            browseToFileDialog.FilterIndex      = 0;
            browseToFileDialog.InitialDirectory = "C:\\";

            ManagedScan.SpectrumSVGTemplateFilepath = Path.Combine(Application.StartupPath, "SpectrumSVG-template.svg");

            if (args.Length > 0)
            {
                this.BringToFront();
                this.Focus();
                this.Activate();
                this.Show();
                Application.DoEvents();

                try
                {
                    openFile(args[0]);

                    if (args.Length > 1)
                    {
                        try
                        {
                            //browserForm.ScanNumberComboBox.SelectedIndex = Convert.ToInt32( args[1] );
                        } catch
                        {
                        }
                    }
                } catch (Exception ex)
                {
                    string message = ex.Message;
                    if (ex.InnerException != null)
                    {
                        message += "\n\nAdditional information: " + ex.InnerException.Message;
                    }
                    MessageBox.Show(message,
                                    "Error recovering from crash",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                    0, false);
                }
            }
        }
Beispiel #22
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            //Recent file history
            m_MruMenu = new MruStripMenuInline(fileToolStripMenuItem, m_RecentFileHistory, OnMruOpenFile, m_MruRegisterKey + "\\MRU", 8);

            m_AdminMode = Environment.CommandLine.ToLower().Contains("-admin");

            m_ModuleManager = new ModuleManager(LogManager.GetLogger("ApplicationLog"), m_AdminMode, m_FileMenuStrip);
            m_ModuleManager.PropertyChanged         += OnModuleManagerPropertyChanged;
            m_ModuleManager.OnModulePropertyChanged += OnModulePropertyChanged;
            m_ModuleManager.LoadPlugins();

            foreach (IModule module in m_ModuleManager.Modules)
            {
                if (module.ModuleControl == null)
                {
                    continue;
                }

                var page = new TabPage(module.DisplayName);
                module.ModuleControl.Dock = DockStyle.Fill;
                page.Controls.Add(module.ModuleControl);
                page.Name = module.DisplayName;
                page.Tag  = module;
                m_ModuleTabControl.TabPages.Add(page);
            }

            OnTabSelected(this, new TabControlEventArgs(null, -1, TabControlAction.Selected));
            m_Task.Text = string.Empty;

            if (File.Exists(Path.ChangeExtension(Application.ExecutablePath, ".ftr")))
            {
                m_AllowedItemSettings = FilterSettings.FromFile(Path.ChangeExtension(Application.ExecutablePath, ".ftr"));
            }

            try
            {
                if (File.Exists(Path.ChangeExtension(Application.ExecutablePath, ".data")))
                {
                    m_Settings = SettingsGraph.FromFile(Path.ChangeExtension(Application.ExecutablePath, ".data"));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Failed to load settings file!");
            }

            var userSettings = new SettingsGraph();

            try
            {
                if (File.Exists(Properties.Settings.Default.SettingsFile))
                {
                    userSettings = SettingsGraph.FromFile(Properties.Settings.Default.SettingsFile);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Failed to load User settings file!");
            }

            string[] args = Environment.GetCommandLineArgs();

            for (int i = 1; i < args.Length; i++)
            {
                string arg = args[i];
                switch (arg)
                {
                default:
                    if (File.Exists(arg) && m_Database == null)
                    {
                        OpenLogFile(arg);
                    }
                    break;
                }
            }

            foreach (IModule module in m_ModuleManager.Modules)
            {
                if (Properties.Settings.Default.LoadSettings)
                {
                    module.LoadSettings(m_Settings, Properties.Resources.RES_PagePrefix, true);
                }

                module.LoadSettings(userSettings, string.Empty, false);

                module.ModuleLoaded();
            }


            m_Admin.Visible = m_AdminMode;

            UpdateTitle();
        }
Beispiel #23
0
        private void Mainform_Load(object sender, EventArgs e)
        {
            Boolean registered = RegisterIlProj();

            Extensions = new Dictionary<String, String>();
            Extensions.Add("exe", "Executable(s)");
            Extensions.Add("dll", "Assemblies or dll(s)");

            openFileDialog1.DefaultExt = MyWildcard;
            openFileDialog1.FileName = MyWildcard;
            openFileDialog1.Filter = String.Format("IlMerge Project|{0}|All Files|*.*", MyWildcard);

            saveFileDialog1.DefaultExt = MyWildcard;
            saveFileDialog1.FileName = MyWildcard;
            saveFileDialog1.Filter = String.Format("IlMerge Project|{0}|All Files|*.*", MyWildcard);

            ListAssembly.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);

            foreach (KeyValuePair<String, String> kvp in Extensions)
            {
                ListAssembly.Groups.Add(kvp.Key, kvp.Value);
            }

            SendMessage(ListAssembly.Handle, (int)LVM.SETTEXTBKCOLOR, IntPtr.Zero, CLR_NONE);
            SendMessage(ListAssembly.Handle, (int)LVM.SETEXTENDEDLISTVIEWSTYLE, (int)LVS.EX_DOUBLEBUFFER, (int)LVS.EX_DOUBLEBUFFER);

            SetWaterMark(true);

            LocateEngines();

            label2.Text = String.Format("IlMergeGui: v{0} {1}", Assembly.GetExecutingAssembly().GetName().Version,
                String.Format((registered ? "({0} extension registered)" : "({0} extension not registered, run elevated once)"), MyExtension));

            RestoreDefaults();

            //Mru Code
            RegistryKey regKey = Registry.CurrentUser.OpenSubKey(mruRegKey);
            if (regKey != null)
            {
                //clearMruRegistryOnExitMenuItem.Checked = (int)regKey.GetValue("delSubkey", 0) != 0;

                int delSub = (int)regKey.GetValue("delSubkey", 0);

                regKey.Close();
            }

            mruMenu = new MruStripMenuInline(fileToolStripMenuItem3, menuRecentFile, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", 16);
            mruMenu.LoadFromRegistry();

            menuStrip1.Update();
            menuStrip1.Refresh();

            foreach (String arg in Environment.GetCommandLineArgs())
            {
                if (!arg.StartsWith("/") && arg.EndsWith(MyExtension, StringComparison.OrdinalIgnoreCase))
                {
                    if (File.Exists(arg))
                    {
                        RestoreSettings(arg);

                        foreach (String arg1 in Environment.GetCommandLineArgs())
                        {
                            if (arg1.Equals("/merge", StringComparison.OrdinalIgnoreCase))
                            {
                                btnMerge.PerformClick();
                            }
                        }

                        break;
                    }
                    else
                    {
                        MessageBox.Show(String.Format("Project File not Found:\r\n\r\n{0}", Path.GetFullPath(arg)), Application.ProductName);
                    }
                }
            }

            foreach (String arg in Environment.GetCommandLineArgs())
            {
                if (arg.Equals("/?", StringComparison.OrdinalIgnoreCase) ||
                    arg.Equals("/h?", StringComparison.OrdinalIgnoreCase) ||
                    arg.Equals("/help", StringComparison.OrdinalIgnoreCase))
                {
                    MessageBox.Show("Commandline syntax is:\r\n\r\n" +
                      String.Format("ILMergeGui <{0}> [/Merge] [/?]\r\n", MyWildcard), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }