Переглянути джерело

轻会员-代码优化;首页工具栏滚动条优化

lvle 1 рік тому
батько
коміт
d691a0698d

+ 1 - 0
PDF Office/App.xaml.cs

@@ -266,6 +266,7 @@ namespace PDF_Master
         {
                MsgId = Win32Helper.RegisterWindowMessage("msgNotify_PDFMaster");
             WakeId = Win32Helper.RegisterWindowMessage("msgWake_PDFMaster");
+            WakeId = Win32Helper.RegisterWindowMessage("webopenexpired_PDFMaster");
             Process[] pros = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
             //禁止多开程序
             if (pros.Length > 1)

+ 14 - 28
PDF Office/Views/MainWindow.xaml.cs

@@ -110,7 +110,7 @@ namespace PDF_Master.Views
                 handled = true;
                 return (IntPtr)(1);
             }
-            if (msg == App.WakeId)
+            if (msg == App.WakeId|| msg == App.WebopenexpiredId)
             {
               
                 //将现有窗口激活 并前置
@@ -122,34 +122,18 @@ namespace PDF_Master.Views
                     }
                     Activate();
                     ServiceHelper.GetUser();
-                    handled = true;
-                }
-                catch
-                {
-
-                }
-
-                return (IntPtr)(1);
-            }
-            if(msg==App.WebopenexpiredId)
-            { //将现有窗口激活 并前置
-                try
-                {
-                    if (WindowState == WindowState.Minimized)
-                    {
-                        WindowState = WindowState.Normal;
-                    }
-                    Activate();
-                    ServiceHelper.GetUser();
-                    if (App.IsLogin == true)
+                    if(msg==App.WebopenexpiredId)
                     {
-                        App.mainWindowViewModel.OpenUser();
-                        App.WebOpencase = "";
-                    }
-                    else
-                    {
-                        App.mainWindowViewModel.OpenLogin();
-                        App.WebOpencase = "";
+                        if (App.IsLogin == true)
+                        {
+                            App.mainWindowViewModel.OpenUser();
+                            App.WebOpencase = "";
+                        }
+                        else
+                        {
+                            App.mainWindowViewModel.OpenLogin();
+                            App.WebOpencase = "";
+                        }
                     }
                     handled = true;
                 }
@@ -157,6 +141,8 @@ namespace PDF_Master.Views
                 {
 
                 }
+
+                return (IntPtr)(1);
             }
             return IntPtr.Zero;
         }

Різницю між файлами не показано, бо вона завелика
+ 2 - 10
PDF Office/Views/ViewContent.xaml


+ 20 - 3
PDF Office/Views/ViewContent.xaml.cs

@@ -48,11 +48,28 @@ namespace PDF_Master.Views
         {
             InitializeComponent();
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
-            viewModel = (ViewContentViewModel)this.DataContext;
-
+            viewModel = (ViewContentViewModel)this.DataContext;
+            MessageBox.Show("Leftpanel.ActualWidth:" + CalculateStackPanelWidth(Leftpanel) + "\n"+ "Rightpanel.ActualWidth" + CalculateStackPanelWidth(Rightpanel));
+            ScrViewTab.Margin = new Thickness(CalculateStackPanelWidth(Leftpanel)+16, 0,  CalculateStackPanelWidth(Rightpanel)+16,0);
             viewModel.PropertyChanged += ViewModel_PropertyChanged;
         }
-
+        /// <summary>
+        /// 计算StackPane的宽度
+        /// </summary>
+        /// <param name="stackPanel"></param>
+        /// <returns></returns>
+        public double CalculateStackPanelWidth(StackPanel stackPanel)
+        {
+            double totalWidth = 0;
+
+            foreach (UIElement child in stackPanel.Children)
+            {
+                child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+                totalWidth += child.DesiredSize.Width;
+            }
+
+            return totalWidth;
+        }
         private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
             if (e.PropertyName == "OpenBOTA")