/// <summary> /// Creates a new instance of the OptionsForm class /// </summary> /// <param name="o">An options object to display</param> public OptionsForm( NDocOptions o ) { // // Required for Windows Form Designer support // InitializeComponent(); _options = o; propertyGrid.SelectedObject = _options; }
private void MainForm_Load(object sender, System.EventArgs e) { Thread.CurrentThread.Name = "GUI"; project = new Project(); project.Modified += new ProjectModifiedEventHandler(OnProjectModified); foreach (IDocumenter documenter in project.Documenters) { // build a development status string (alpha, beta, etc) string devStatus = string.Empty; if (documenter.DevelopmentStatus != DocumenterDevelopmentStatus.Stable) { devStatus = documenter.DevelopmentStatus.ToString(); // want it uncapitalized devStatus = " (" + Char.ToLower(devStatus[0]) + devStatus.Substring(1) + ")"; } comboBoxDocumenters.Items.Add(documenter.Name + devStatus); } options = new NDocOptions(); ReadConfig(); processDirectory = Directory.GetCurrentDirectory(); // If a project document wasn't passed in on the command line // then try loading up the most recently used project file. if (startingProjectFilename == null) { if ( this.options.LoadLastProjectOnStart ) { while (recentProjectFilenames.Count > 0) { if ( File.Exists(recentProjectFilenames[0]) ) { FileOpen(recentProjectFilenames[0]); break; } else { //the project file was not found, remove it from the MRU recentProjectFilenames.RemoveAt(0); } } if ( recentProjectFilenames.Count == 0 ) { Clear(); } } else { Clear(); } } else { //load project passed on the command line if (File.Exists(startingProjectFilename)) { FileOpen(startingProjectFilename); } else { MessageBox.Show( this, "The NDoc project file '" + startingProjectFilename + "' does not exist.", "Error loading NDoc project file", MessageBoxButtons.OK, MessageBoxIcon.Stop ); Clear(); } } EnableAssemblyItems(); MakeMRUMenu(); menuFileCloseItem.Visible = false; SetWindowTitle(); this.traceWindow1.TraceText = string.Format( "[NDoc version {0}]\n", Assembly.GetExecutingAssembly().GetName().Version ); }
private void menuViewOptions_Click(object sender, System.EventArgs e) { using( OptionsForm optionsForm = new OptionsForm( (NDocOptions)this.options.Clone() ) ) { if ( optionsForm.ShowDialog() == DialogResult.OK ) { this.options = optionsForm.Options; // save the user settings using( Settings settings = new Settings( Settings.UserSettingsFile ) ) { settings.SetSetting( "gui", "loadLastProjectOnStart", this.options.LoadLastProjectOnStart ); settings.SetSetting( "gui", "showProgressOnBuild", this.options.ShowProgressOnBuild ); settings.SetSetting( "gui", "mruSize", this.options.MRUSize ); } // save machine settings using( Settings settings = new Settings( Settings.MachineSettingsFile ) ) { settings.SetSetting( "compilers", "htmlHelpWorkshopLocation", this.options.HtmlHelpWorkshopLocation ); } } } }
/// <summary> /// See <see cref="UserControl.OnLoad"/> /// </summary> /// <param name="e">event arguments</param> protected override void OnLoad(EventArgs e) { project = new Project(); project.Modified += new ProjectModifiedEventHandler(OnProjectModified); project.ActiveConfigChanged += new EventHandler(project_ActiveConfigChanged); project.AssemblySlashDocs.Cleared += new EventHandler(AssemblySlashDocs_Cleared); project.AssemblySlashDocs.ItemAdded += new AssemblySlashDocEventHandler(AssemblySlashDocs_ItemRemovedAdded); project.AssemblySlashDocs.ItemRemoved += new AssemblySlashDocEventHandler(AssemblySlashDocs_ItemRemovedAdded); assemblyListControl.AssemblySlashDocs = project.AssemblySlashDocs; foreach ( IDocumenterInfo documenter in InstalledDocumenters.Documenters ) comboBoxDocumenters.Items.Add( documenter ); options = new NDocOptions(); ReadConfig(); Clear(); // If a project document wasn't passed in on the command line // then try loading up the most recently used project file. if ( startingProjectFilename == null ) { if ( this.options.LoadLastProjectOnStart ) { while ( recentProjectFilenames.Count > 0 ) { if ( File.Exists( recentProjectFilenames[0] ) ) { FileOpen( recentProjectFilenames[0] ); break; } else { //the project file was not found, remove it from the MRU recentProjectFilenames.RemoveAt(0); } } } } else { //load project passed on the command line if ( File.Exists( startingProjectFilename ) ) { FileOpen( startingProjectFilename ); } else { MessageBox.Show( this, "The NDoc project file '" + startingProjectFilename + "' does not exist.", "Error loading NDoc project file", MessageBoxButtons.OK, MessageBoxIcon.Stop ); } } EnableAssemblyItems(); MakeMRUMenu(); SetWindowTitle(); this.traceWindow1.TraceText = string.Format( "[NDoc version {0}]\n", Assembly.GetExecutingAssembly().GetName().Version ); m_buildWorker = new BuildWorker( this ); base.OnLoad (e); }