private void Window_Loaded(object sender, RoutedEventArgs e) { //Open a File if we've been asked to do so String[] args = Environment.GetCommandLineArgs(); if (args.Length >= 2) { if (File.Exists(args[1])) { Document<TextEditor> doc = this._editor.DocumentManager.New(); try { doc.Open(args[1]); this.AddTextEditor(new TabItem(), doc); this._editor.DocumentManager.Close(0); this.tabDocuments.Items.RemoveAt(0); } catch (Exception ex) { MessageBox.Show("An error occurred while opening the selected file: " + ex.Message, "Unable to Open File"); this._editor.DocumentManager.Close(this._editor.DocumentManager.Count - 1); } } } //Check File Associations if (Properties.Settings.Default.AlwaysCheckFileAssociations) { if (Properties.Settings.Default.FirstRun) { Properties.Settings.Default.AlwaysCheckFileAssociations = false; Properties.Settings.Default.FirstRun = false; Properties.Settings.Default.Save(); } FileAssociations diag = new FileAssociations(); if (!diag.AllAssociated) diag.ShowDialog(); //Don't show if all associations are already set } //Set Window size if (Properties.Settings.Default.WindowHeight > 0 && Properties.Settings.Default.WindowWidth > 0) { this.Height = Properties.Settings.Default.WindowHeight; this.Width = Properties.Settings.Default.WindowWidth; } this._saveWindowSize = true; //Fill The MRU List this.ShowMruList(); }
private void mnuCustomiseFileAssociations_Click(object sender, RoutedEventArgs e) { FileAssociations diag = new FileAssociations(); diag.ShowDialog(); }