예제 #1
0
        void TryRestoreLayout( )
        {
            try
            {
                var uc_main = GetActiveUCMain( );

                if (uc_main != null)
                {
                    if (Properties.Settings.Default.McsRightWidth > 20 &&
                        Properties.Settings.Default.McsTopHeight > 20 &&
                        Properties.Settings.Default.McsBottomHeight > 20)
                    {
                        TabMetrics metrics = new TabMetrics
                        {
                            RightColumnWidth = Properties.Settings.Default.McsRightWidth,
                            TopRowHeight     = Properties.Settings.Default.McsTopHeight,
                            BottomRowHeight  = Properties.Settings.Default.McsBottomHeight
                        };

                        uc_main.ApplyMetrics(metrics);
                    }
                }
            }
            catch (Exception exc)
            {
                _ = exc;
                if (Debugger.IsAttached)
                {
                    Debugger.Break( );
                }

                // ignore
            }
        }
예제 #2
0
        public TabMetrics GetMetrics( )
        {
            var metrics = new TabMetrics
            {
                RightColumnWidth = RightColumn.ActualWidth,
                TopRowHeight     = TopRow.ActualHeight,
                BottomRowHeight  = BottomRow.ActualHeight
            };

            return(metrics);
        }
예제 #3
0
 public void ApplyMetrics(TabMetrics metrics)
 {
     if (metrics.RightColumnWidth > 0)
     {
         RightColumn.Width = new GridLength(metrics.RightColumnWidth);
     }
     if (metrics.TopRowHeight > 0)
     {
         TopRow.Height = new GridLength(metrics.TopRowHeight);
     }
     if (metrics.BottomRowHeight > 0)
     {
         BottomRow.Height = new GridLength(metrics.BottomRowHeight);
     }
 }
예제 #4
0
        void SaveWindowPlacement( )
        {
            try
            {
                Properties.Settings.Default.IsMaximised = WindowState == WindowState.Maximized;
                if (Properties.Settings.Default.IsMaximised)
                {
                    Properties.Settings.Default.RestoreBounds = RestoreBounds;
                }
                else
                {
                    Properties.Settings.Default.RestoreBounds = new Rect(Left, Top, ActualWidth, ActualHeight);
                }

                var uc_main = GetActiveUCMain( );
                if (uc_main != null)
                {
                    TabMetrics metrics = uc_main.GetMetrics( );

                    Properties.Settings.Default.McsRightWidth   = metrics.RightColumnWidth;
                    Properties.Settings.Default.McsTopHeight    = metrics.TopRowHeight;
                    Properties.Settings.Default.McsBottomHeight = metrics.BottomRowHeight;
                }

                Properties.Settings.Default.Save( );
            }
            catch (Exception exc)
            {
                if (Debugger.IsAttached)
                {
                    Debugger.Break( );
                }
                else
                {
                    Debug.Fail(exc.Message, exc.ToString( ));
                }

                // ignore
            }
        }