Пример #1
0
		/// <summary>Reads in the NDoc configuration file from the
		/// application directory.</summary>
		/// <remarks>The config file stores the most recently used (MRU)
		/// list of project files.  It also stores which documenter was
		/// being used last.</remarks>
		private void ReadConfig()
		{
			Settings settings = new Settings( Settings.UserSettingsFile );

			this.Location = GetOnScreenLocation( (Point)settings.GetSetting( "gui", "location", new Point( Screen.PrimaryScreen.WorkingArea.Top, Screen.PrimaryScreen.WorkingArea.Left ) ) );

			Screen screen = Screen.FromControl( this );
			this.Size = (Size)settings.GetSetting( "gui", "size", new Size( screen.WorkingArea.Width / 3, screen.WorkingArea.Height - 20 ) );
			
			// size the window to the working area if it is larger (can happen when resolution changes)
			if ( this.Height > screen.WorkingArea.Height )
				this.Height = screen.WorkingArea.Height;
			if ( this.Width > screen.WorkingArea.Width )
				this.Width = screen.WorkingArea.Width;

			if ( settings.GetSetting( "gui", "maximized", false ) )
				this.WindowState = FormWindowState.Maximized;			

			this.traceWindow1.Visible = settings.GetSetting( "gui", "viewTrace", true );
			this.traceWindow1.Height = settings.GetSetting( "gui", "traceWindowHeight", this.traceWindow1.Height );
			this.statusBar.Visible = settings.GetSetting( "gui", "statusBar", true );
			this.ShowDescriptions = settings.GetSetting( "gui", "showDescriptions", true );

			IList list = recentProjectFilenames;
			settings.GetSettingList( "gui", "mru", typeof( string ), ref list );		
	
			string documenterName = settings.GetSetting( "gui", "documenter", "MSDN" );

			this.options.LoadLastProjectOnStart = settings.GetSetting( "gui", "loadLastProjectOnStart", true );
			this.options.ShowProgressOnBuild = settings.GetSetting( "gui", "showProgressOnBuild", false );
			this.options.MRUSize = settings.GetSetting( "gui", "mruSize", 8 );

			int index = 0;

			foreach (IDocumenter documenter in project.Documenters)
			{
				if (documenter.Name == documenterName)
				{
					comboBoxDocumenters.SelectedIndex = index;
					break;
				}

				++index;
			}
		}
Пример #2
0
		private void FileSaveAs()
		{
			using ( SaveFileDialog saveFileDlg = new SaveFileDialog() )
			{
				if (projectFilename == UNTITLED_PROJECT_NAME)
				{
					Settings settings = new Settings( Settings.UserSettingsFile );
					saveFileDlg.InitialDirectory = settings.GetSetting( "gui", "lastSaveDirectory", App.RuntimeLocation );
					saveFileDlg.FileName = @".\Untitled.ndoc";
				}
				else
				{
					saveFileDlg.InitialDirectory = Path.GetDirectoryName(projectFilename);
					saveFileDlg.FileName = Path.GetFileName(projectFilename);
				}

				saveFileDlg.Filter = "NDoc Project files (*.ndoc)|*.ndoc|All files (*.*)|*.*" ;

				if( saveFileDlg.ShowDialog() == DialogResult.OK )
				{
					FileSave( saveFileDlg.FileName );

					projectFilename = saveFileDlg.FileName;
					SetWindowTitle();
					UpdateMRUList();
					EnableMenuItems(true);
					propertyGrid.Refresh();
				}
			}
		}