Ejemplo n.º 1
0
        /// <summary>
        /// Function that can be called from the main window every time the windows state of the main window changed.
        /// </summary>
        /// <param name="mainWindow">The main window.</param>
        public static void UpdateWorkbenchStateFromMainWindow(Window mainWindow)
        {
            if (mainWindow.WindowState == System.Windows.WindowState.Minimized)
            {
                return;
            }

            var orgObserve = (bool)mainWindow.GetValue(ObserveProperty);

            mainWindow.SetValue(ObserveProperty, false);

            WorkbenchState wb;

            if (mainWindow.RestoreBounds.IsEmpty)
            {
                wb = new WorkbenchState {
                    IsMaximized = mainWindow.WindowState == System.Windows.WindowState.Maximized, Bounds = new Altaxo.Geometry.RectangleD2D(mainWindow.Left, mainWindow.Top, mainWindow.ActualWidth, mainWindow.ActualHeight)
                }
            }
            ;
            else
            {
                wb = new WorkbenchState()
                {
                    IsMaximized = mainWindow.WindowState == System.Windows.WindowState.Maximized, Bounds = GuiHelper.ToAltaxo(mainWindow.RestoreBounds)
                }
            };

            mainWindow.SetValue(ObservedWorkbenchStateProperty, wb);
            mainWindow.SetValue(ObserveProperty, orgObserve);
        }
    }
Ejemplo n.º 2
0
 public void RestoreWorkbenchStateFromPropertyService()
 {
     WorkbenchState = Current.PropertyService.GetValue(PropertyKeyWorkbenchState, Altaxo.Main.Services.RuntimePropertyKind.UserAndApplicationAndBuiltin, () => null);
 }
Ejemplo n.º 3
0
 public static void SetObservedWorkbenchState(Window frameworkElement, WorkbenchState observedValue)
 {
     frameworkElement.SetValue(ObservedWorkbenchStateProperty, observedValue);
 }