Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/08/16 15:29:05 (8 years ago)
Author:
mkommend
Message:

#2567: Merged r13567 and r13586 into stable.

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs

    r12009 r13884  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Drawing;
    2425using System.IO;
    2526using System.Linq;
     
    2930using HeuristicLab.PluginInfrastructure.Advanced;
    3031using HeuristicLab.PluginInfrastructure.Manager;
     32using HeuristicLab.PluginInfrastructure.Properties;
    3133
    3234namespace HeuristicLab.PluginInfrastructure.Starter {
     
    6769      splashScreen.Show(this, "Loading HeuristicLab...");
    6870
     71      if (CheckSavedStarterFormSettings()) {
     72        Location = Settings.Default.StarterFormLocation;
     73        Size = Settings.Default.StarterFormSize;
     74        WindowState = Settings.Default.StarterFormWindowState;
     75      }
     76
    6977      pluginManager.DiscoverAndCheckPlugins();
    7078      UpdateApplicationsList();
     
    96104      splashScreen.Close();
    97105      abortRequested = true;
     106
     107      if (WindowState != FormWindowState.Minimized)
     108        Settings.Default.StarterFormWindowState = WindowState;
     109      if (WindowState != FormWindowState.Normal) {
     110        Settings.Default.StarterFormLocation = RestoreBounds.Location;
     111        Settings.Default.StarterFormSize = RestoreBounds.Size;
     112      } else if (WindowState == FormWindowState.Normal) {
     113        Settings.Default.StarterFormLocation = Location;
     114        Settings.Default.StarterFormSize = Size;
     115      }
     116
     117      Settings.Default.Save();
    98118    }
    99119
     
    177197
    178198    #region Helpers
     199    private bool CheckSavedStarterFormSettings() {
     200      var formArea = new Rectangle(Settings.Default.StarterFormLocation, Settings.Default.StarterFormSize);
     201      var screenArea = Screen.FromRectangle(formArea).WorkingArea;
     202      var overlappingArea = Rectangle.Intersect(formArea, screenArea);
     203      bool offLimits = overlappingArea.IsEmpty || overlappingArea.Width * overlappingArea.Height < formArea.Width * formArea.Height * 0.25;
     204      return !formArea.IsEmpty && !offLimits;
     205    }
     206
    179207    private void UpdateApplicationsList() {
    180208      if (InvokeRequired) Invoke((Action)UpdateApplicationsList);
Note: See TracChangeset for help on using the changeset viewer.