Browse Source

优化代码

Demo_Liu 4 years ago
parent
commit
9a6d4795e0
4 changed files with 50 additions and 5 deletions
  1. 0 1
      App.xaml
  2. 3 3
      MainWindow.xaml
  3. 46 0
      ViewModel/AppConfig.cs
  4. 1 1
      ViewModel/IconInfo.cs

+ 0 - 1
App.xaml

@@ -11,7 +11,6 @@
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
                 <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
-                <ResourceDictionary Source="d:\workspace\workspace-vs\geekdesk\resource\dictionary\gemetrydictionary.xaml"/>
             </ResourceDictionary.MergedDictionaries>
         </ResourceDictionary>
   </Application.Resources>

+ 3 - 3
MainWindow.xaml

@@ -101,7 +101,7 @@
         <Border CornerRadius="5"  BorderThickness="0">
             <!--背景图片-->
             <Border.Background>
-                <ImageBrush ImageSource="D:\壁纸\tmig.jpg" Opacity="1"></ImageBrush>
+                <ImageBrush ImageSource="D:\壁纸\wallhaven-nrd85w.jpg" Opacity="1"></ImageBrush>
             </Border.Background>
             <Grid>
                 <!--<Grid.Background>
@@ -168,7 +168,7 @@
                  Margin="5,0,0,5"
                  >
                     <hc:Card.Background>
-                        <SolidColorBrush Color="#FFFFFFFF" Opacity="0.5"/>
+                        <SolidColorBrush Color="#FFFFFFFF" Opacity="0.1"/>
                     </hc:Card.Background>
                     <hc:Card.BorderBrush>
                         <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
@@ -254,7 +254,7 @@
                  Effect="{DynamicResource EffectShadow2}" 
                  Margin="5,0,5,5" Grid.ColumnSpan="2">
                     <hc:Card.Background>
-                        <SolidColorBrush Color="#FFFFFFFF" Opacity="0.5"/>
+                        <SolidColorBrush Color="#FFFFFFFF" Opacity="0.1"/>
                     </hc:Card.Background>
                     <hc:Card.BorderBrush>
                         <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>

+ 46 - 0
ViewModel/AppConfig.cs

@@ -4,6 +4,7 @@ using GeekDesk.Util;
 using System;
 using System.ComponentModel;
 using System.Windows;
+using System.Windows.Media.Imaging;
 
 /// <summary>
 /// 程序设置
@@ -24,10 +25,55 @@ namespace GeekDesk.ViewModel
         private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
         private AppHideType appHideType = AppHideType.START_EXE;  //面板关闭方式 (默认启动程序后)
         private bool startedShowPanel = true;  //启动时是否显示主面板  默认显示
+        [field: NonSerialized]
+        private BitmapImage bitmapImage; //位图
+        private byte[] imageByteArr; //背景图片 byte数组
+        private byte[] defaultImage; //默认背景图片
+
 
 
         #region GetSet
 
+        public byte[] ImageByteArr
+        {
+            get
+            {
+                return imageByteArr;
+            }
+            set
+            {
+                imageByteArr = value;
+                OnPropertyChanged("ImageByteArr");
+            }
+        }
+
+        public byte[] DefaultImage
+        {
+            get
+            {
+                return defaultImage;
+            }
+            set
+            {
+                defaultImage = value;
+                OnPropertyChanged("DefaultImage");
+            }
+        }
+
+        public BitmapImage BitmapImage
+        {
+            get
+            {
+                return bitmapImage;
+            }
+            set
+            {
+                bitmapImage = value;
+                OnPropertyChanged("BitmapImage");
+            }
+        }
+
+
         public bool StartedShowPanel
         {
             get

+ 1 - 1
ViewModel/IconInfo.cs

@@ -18,7 +18,7 @@ namespace GeekDesk.ViewModel
         private int count = 0; //打开次数
         [field: NonSerialized]
         private BitmapImage bitmapImage; //位图
-        private byte[] imageByteArr; //图片 base64
+        private byte[] imageByteArr; //图片 byte数组
         private string content; //显示信息
         private int imageWidth = (int)DefaultConstant.IMAGE_WIDTH; //图片宽度
         private int imageHeight = (int)DefaultConstant.IMAGE_HEIGHT; //图片高度