Exemple #1
0
 /// <summary>
 /// Creates a new instance of the WinFormsUpdateChecker class.
 /// </summary>
 /// <param name="url">The location of the file containing update information.</param>
 /// <param name="owner">The parent window of the update window to show.</param>
 /// <param name="identifier">An identifier specifying the download option to use.</param>
 public WinFormsUpdateChecker(string url, Form owner = null, string identifier = null) : base(url, identifier)
 {
     this.Owner = owner;
     settings   = new CustomSettings(AppInfo.IsPortable.GetValueOrDefault(), typeof(UpdateCheckerBase).FullName);
     settings.AddSetting("CheckedUpdate", typeof(string), "0.0", true, System.Configuration.SettingsSerializeAs.String);
     settings.AddSetting("SkipVersion", typeof(bool), false, true, System.Configuration.SettingsSerializeAs.String);
 }
 /// <summary>
 /// Initializes a new instance of MiniAppManagerBase.
 /// </summary>
 /// <param name="context">The parent window.</param>
 public WindowManager(T context)
 {
     this.Context        = context;
     managedSettings     = new HashSet <string>();
     applicationSettings = new List <ApplicationSettingsBase>();
     CustomSettings      = new CustomSettings(AppInfo.IsPortable.GetValueOrDefault());
 }
Exemple #3
0
 /// <inheritdoc />
 public override void ManageDefault()
 {
     this.manageDefault = true;
     CustomSettings.AddSetting(Context.GetType().GetProperty(nameof(Context.Left)), DEFAULT, false);
     CustomSettings.AddSetting(Context.GetType().GetProperty(nameof(Context.Top)), DEFAULT, false);
     CustomSettings.AddSetting(Context.GetType().GetProperty(nameof(Context.WindowState)), WindowState.Normal, false);
     CustomSettings.AddSetting(Context.GetType().GetProperty(nameof(Context.Width)), DEFAULT, false);
     CustomSettings.AddSetting(Context.GetType().GetProperty(nameof(Context.Height)), DEFAULT, false);
 }
Exemple #4
0
 /// <inheritdoc />
 protected override void ContextSave()
 {
     base.ContextSave();
     if (manageDefault)
     {
         CustomSettings["Left"] = savedLeft;
         CustomSettings["Top"]  = savedTop;
         if (sizeable)
         {
             CustomSettings["Width"]       = savedWidth;
             CustomSettings["Height"]      = savedHeight;
             CustomSettings["WindowState"] = savedWindowState;
         }
         CustomSettings.Save();
     }
 }
Exemple #5
0
 /// <inheritdoc />
 protected override void ContextLoad()
 {
     base.ContextLoad();
     if (manageDefault)
     {
         Context.LocationChanged += Parent_LocationChanged;
         sizeable = Context.ResizeMode == ResizeMode.CanResize || AlwaysTrackResize;
         if (sizeable)
         {
             Context.SizeChanged += Parent_SizeChanged;
         }
         if ((double)CustomSettings["Left"] != DEFAULT)
         {
             Context.Left = (double)CustomSettings["Left"];
         }
         if ((double)CustomSettings["Top"] != DEFAULT)
         {
             Context.Top = (double)CustomSettings["Top"];
         }
         if (sizeable)
         {
             try
             {
                 savedWidth = Context.Width; savedHeight = Context.Height;
                 if ((double)CustomSettings["Width"] != DEFAULT)
                 {
                     Context.Width = (double)CustomSettings["Width"];
                 }
                 if ((double)CustomSettings["Height"] != DEFAULT)
                 {
                     Context.Height = (double)CustomSettings["Height"];
                 }
                 Context.WindowState = (WindowState)CustomSettings["WindowState"];
             }
             catch
             {
                 CustomSettings.Reset();
                 Context.WindowState = (WindowState)CustomSettings["WindowState"];
             }
         }
         var newLoc = MoveIntoScreenBounds(Context);
         Context.Left = newLoc.X;
         Context.Top  = newLoc.Y;
     }
 }
Exemple #6
0
 /// <inheritdoc />
 protected override void ContextLoad()
 {
     base.ContextLoad();
     if (manageDefault)
     {
         Context.LocationChanged += Parent_LocationChanged;
         sizeable = Context.FormBorderStyle == FormBorderStyle.Sizable || AlwaysTrackResize;
         if (sizeable)
         {
             Context.SizeChanged += Parent_SizeChanged;
         }
         if ((int)CustomSettings["Left"] != DEFAULT)
         {
             Context.Left = (int)CustomSettings["Left"];
         }
         if ((int)CustomSettings["Top"] != DEFAULT)
         {
             Context.Top = (int)CustomSettings["Top"];
         }
         if (sizeable)
         {
             try
             {
                 savedWidth = Context.Width; savedHeight = Context.Height;
                 if ((int)CustomSettings["Width"] != DEFAULT)
                 {
                     Context.Width = (int)CustomSettings["Width"];
                 }
                 if ((int)CustomSettings["Height"] != DEFAULT)
                 {
                     Context.Height = (int)CustomSettings["Height"];
                 }
                 Context.WindowState = (FormWindowState)CustomSettings["WindowState"];
             }
             catch
             {
                 CustomSettings.Reset();
                 Context.WindowState = (FormWindowState)CustomSettings["WindowState"];
             }
         }
         Context.Location = MoveIntoScreenBounds(Context);
     }
 }