Exemplo n.º 1
0
 /// <summary>
 /// Raises the <see cref="E:System.Windows.Window.Closing" /> event.
 /// </summary>
 /// <param name="e">A <see cref="T:System.ComponentModel.CancelEventArgs" /> that contains the event data.</param>
 protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
 {
     base.OnClosing(e);
     if (AutoSettings != null && !SizeSettingName.XDwIsNullOrTrimEmpty())
     {
         AutoSettings.AddOrReplace(SizeSettingName, string.Format("{0};{1}", this.Width, this.Height));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Raises the <see cref="E:System.Windows.FrameworkElement.Initialized" /> event. This method is invoked whenever <see cref="P:System.Windows.FrameworkElement.IsInitialized" /> is set to true internally.
 /// </summary>
 /// <param name="e">The <see cref="T:System.Windows.RoutedEventArgs" /> that contains the event data.</param>
 protected override void OnInitialized(EventArgs e)
 {
     base.OnInitialized(e);
     if (AutoSettings != null && !SizeSettingName.XDwIsNullOrTrimEmpty())
     {
         string size = AutoSettings.GetSettingValue(SizeSettingName, null);
         if (size != null)
         {
             string[] elem = size.Split(';');
             if (elem.Length == 2)
             {
                 double width = this.Width;
                 double.TryParse(elem[0], out width);
                 this.Width = width;
                 double height = this.Height;
                 double.TryParse(elem[1], out height);
                 this.Height = height;
             }
         }
     }
 }