/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.Load"></see> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param> protected override void OnLoad(EventArgs e) { // Calculate the center of our parent IDE and position this window EnvDTE.Window parentIDE = Connect.ApplicationObject.MainWindow; Int32 newX = parentIDE.Left + Convert.ToInt32(parentIDE.Width / 2) - Convert.ToInt32(this.Width / 2); Int32 newY = parentIDE.Top + Convert.ToInt32(parentIDE.Height / 2) - Convert.ToInt32(this.Height / 2); this.Location = new Point(newX, newY); try { _globalSettings.Load(); } catch (Exception ex) { MessageBox.Show("Error occured while loading the global settings:\n" + ex.ToString(), "Global Settings Error", MessageBoxButtons.OK, MessageBoxIcon.Error); _globalSettings = new GlobalIncrementSettings(); // Discard } BuildTree(); propertyGridGlobalSettings.SelectedObject = _globalSettings; textBoxLog.AppendText(Logger.Instance.Contents); base.OnLoad(e); }
public void ApplyGlobalSettings() { GlobalIncrementSettings globalIncrementSettings = new GlobalIncrementSettings(); try { globalIncrementSettings.Load(); } catch (Exception innerException) { throw new ApplicationException("Exception occured while applying global settings to the solution item (" + this.UniqueName + ").", innerException); } this.IncrementSettings.CopyFrom(globalIncrementSettings); }
/// <summary> /// Applies the global settings to this instance. /// </summary> public void ApplyGlobalSettings() { GlobalIncrementSettings globalSett = new GlobalIncrementSettings(); try { globalSett.Load(); } catch (Exception ex) { throw (new ApplicationException("Exception occured while applying global settings to the solution item (" + UniqueName + ").", ex)); } IncrementSettings.CopyFrom(globalSett); }