Ejemplo n.º 1
0
        /// <summary>
        /// Window loaded event handler.
        /// </summary>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AppExec.SetSourceOfDispatcherForUI(this.WinHeader);

            // Finish visual adjustments
            this.Width  = this.Width.EnforceMaximum(SystemParameters.WorkArea.Width);
            this.Height = this.Height.EnforceMaximum(SystemParameters.WorkArea.Height);

            if (this.Left < 0)
            {
                this.Left = 0;
            }

            if (this.Top < 0)
            {
                this.Top = 0;
            }

            var InitialPaletteSupraContainerHeight = this.WinHeader.PaletteSupraContainer.ActualHeight;
            var Delta = double.NaN;

            this.WinHeader.PaletteSupraContainer.AtCanCollapseChanged =
                ((CanCollapse) =>
            {
                Delta = Delta.NaNDefault(97.0);     // Previous = 75
                var Offset = (Delta * (CanCollapse ? -1 : 1));

                this.WorkingAreaBorder.Margin = new Thickness(this.WorkingAreaBorder.Margin.Left,
                                                              this.WorkingAreaBorder.Margin.Top + Offset,
                                                              this.WorkingAreaBorder.Margin.Right,
                                                              this.WorkingAreaBorder.Margin.Bottom);

                var Engine = ProductDirector.WorkspaceDirector.ActiveDocumentEngine as CompositionEngine;
                if (Engine == null || Engine.CurrentView == null)
                {
                    return;
                }

                // Adjust visualization to not "jump"
                Engine.CurrentView.Pan(double.NaN, Offset, false);
            });

            // Starts the application product
            ProductDirector.Start();
        }