Ejemplo n.º 1
0
		/// <summary>
		/// Creates a <see cref="UserSettings"/> object, loading from settings the default location.
		/// </summary>
		/// <returns></returns>
		public static UserSettings Create()
		{
			UserSettings userSettings = null;
			FileStream stream = null;
			
			try
			{
				CheckSettingsForCurrentVersion();

				XmlSerializer xmlSerializer = new XmlSerializer(typeof(UserSettings));
				FileInfo fi = new FileInfo(SettingsFile);			
				if(fi.Exists)
				{
					stream = fi.OpenRead();
					userSettings = (UserSettings)xmlSerializer.Deserialize(stream);										
				}
			}
			catch {}
			finally
			{
				if (stream != null)
					stream.Close();
			}

			if (userSettings == null)
				userSettings = new UserSettings();

			userSettings.SetDefaults();

			return userSettings;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Constructs the object.
		/// </summary>
		/// <param name="processVisualizer">Environment's process visualizer.</param>
		/// <param name="userSettings">User settings.</param>
		/// <param name="license">The application license.</param>
		public PrimaryObjects(
			ProcessVisualizer processVisualizer,
			UserSettings userSettings,
			License license)
		{
			if (processVisualizer == null) throw new ArgumentNullException("processVisualizer");
			else if (userSettings == null) throw new ArgumentNullException("userSettings");
			else if (license == null) throw new ArgumentNullException("license");

			_processVisualizer = processVisualizer;
			_userSettings = userSettings;
			_license = license;
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Displays the options dialogue.
		/// </summary>
		/// <param name="owner">Owner form.</param>
		/// <returns>DialogResult.</returns>
		public DialogResult ShowDialog(IWin32Window owner, UserSettings settings)
		{
			_settings = settings;

			SetupForm();

			return base.ShowDialog(owner);			
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Displays the options dialogue.
		/// </summary>
		/// <returns>DialogResult.</returns>
		public DialogResult ShowDialog(UserSettings settings)
		{
			_settings = settings;

			SetupForm();

			return base.ShowDialog();			
		}