Forráskód Böngészése

:tada: 添加新手引导提示

BookerLiu 2 éve
szülő
commit
48732a0815
4 módosított fájl, 155 hozzáadás és 73 törlés
  1. 1 0
      GeekDesk.csproj
  2. 23 8
      MainWindow.xaml
  3. 52 65
      MainWindow.xaml.cs
  4. 79 0
      ViewModel/Temp/GuideInfoList.cs

+ 1 - 0
GeekDesk.csproj

@@ -305,6 +305,7 @@
     <Compile Include="Util\CommonCode.cs" />
     <Compile Include="Util\FileIcon.cs" />
     <Compile Include="Util\FileUtil.cs" />
+    <Compile Include="ViewModel\Temp\GuideInfoList.cs" />
     <Compile Include="Util\HideWindowUtil.cs" />
     <Compile Include="Util\IconHelper.cs" />
     <Compile Include="Util\IconUtil.cs" />

+ 23 - 8
MainWindow.xaml

@@ -57,6 +57,7 @@
     <Grid>
         <!--遮罩层border 用于引导提示-->
         <Border Margin="20"
+                Visibility="Collapsed"
                 MouseDown="DragMove"
                 CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=OneWay, Converter={StaticResource IntToCornerRadius}}"
                 BorderThickness="0"
@@ -64,7 +65,7 @@
                 Panel.ZIndex="888"
                 >
             <Border.Background>
-                <SolidColorBrush Color="Gray" Opacity="0.8"/>
+                <SolidColorBrush Color="Gray" Opacity="0.9"/>
             </Border.Background>
             
             <!--<hc:Poptip.Instance>
@@ -80,30 +81,43 @@
             </hc:Poptip.Instance>-->
         </Border>
 
-        <hc:Card x:Name="GuideCard" Width="300" Height="150" Panel.ZIndex="888" 
+        <hc:Card x:Name="GuideCard" Width="300" Height="180" Panel.ZIndex="888" 
                  VerticalAlignment="Top"
-                 HorizontalAlignment="Left">
+                 HorizontalAlignment="Left" Visibility="Collapsed">
+            <hc:Card.Background>
+                <SolidColorBrush Color="White" Opacity="0.85"/>
+            </hc:Card.Background>
             <!--Card 的内容部分-->
             <Border CornerRadius="4,4,0,0" Width="300" Height="100">
                 <TextBlock TextWrapping="Wrap" 
                            x:Name="GuideText"
                            VerticalAlignment="Center"
-                           HorizontalAlignment="Center" 
+                           HorizontalAlignment="Center"
+                           LineHeight="22"
                            FontSize="14"
-                           Text="将文件拖动到这里自动创建快捷方式, 或者鼠标右键单击添加系统项目"/>
+                           Text=""/>
             </Border>
             <!--Card 的尾部部分-->
             <hc:Card.Footer>
                 <Grid>
                     <StackPanel Margin="10" Width="150" Height="50" HorizontalAlignment="Left">
                         <!--Card 的一级内容-->
-                        <TextBlock TextWrapping="Wrap"  
+                        <WrapPanel>
+                            <TextBlock TextWrapping="Wrap"  
                                    x:Name="GuideTitle1"
                                    Style="{DynamicResource TextBlockLargeBold}" 
                                    TextTrimming="CharacterEllipsis" 
-                                   Text="引导1" 
+                                   Text="引导提示" 
                                    FontSize="20"
                                    HorizontalAlignment="Left"/>
+                            <TextBlock TextWrapping="Wrap"
+                                       x:Name="GuideNum"
+                                   Style="{DynamicResource TextBlockLargeBold}" 
+                                   TextTrimming="CharacterEllipsis" 
+                                   Text="1" 
+                                   FontSize="20"
+                                   HorizontalAlignment="Left"/>
+                        </WrapPanel>
                         <!--Card 的二级内容-->
                         <TextBlock TextWrapping="NoWrap" 
                                    x:Name="GuideTitle2"
@@ -174,7 +188,7 @@
                         <DockPanel.Background>
                             <SolidColorBrush Opacity="0.01"/>
                         </DockPanel.Background>
-                        <hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
+                        <hc:UniformSpacingPanel  x:Name="MainBtnPanel" Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
                             <Button Background="Transparent"
                                     BorderThickness="0"
                                     hc:IconElement.Geometry="M917.930667 512c0-57.6 36.181333-106.496 86.869333-125.952a505.429333 505.429333 0 0 0-55.210667-133.461333A134.826667 134.826667 0 0 1 771.413333 74.410667 507.733333 507.733333 0 0 0 637.952 19.2 135.168 135.168 0 0 1 512 106.069333 134.912 134.912 0 0 1 386.048 19.2 505.429333 505.429333 0 0 0 252.586667 74.410667c22.186667 49.749333 13.141333 109.824-27.562667 150.528a135.168 135.168 0 0 1-150.528 27.648 502.016 502.016 0 0 0-55.296 133.461333c50.688 19.626667 86.869333 68.437333 86.869333 125.952 0 57.6-36.181333 106.496-86.869333 125.952 12.117333 47.530667 30.72 92.330667 55.210667 133.461333a134.826667 134.826667 0 0 1 178.090666 178.176 507.733333 507.733333 0 0 0 133.546667 55.210667A135.168 135.168 0 0 1 512 917.930667c57.6 0 106.496 36.181333 125.952 86.869333a505.429333 505.429333 0 0 0 133.461333-55.210667 134.912 134.912 0 0 1 27.562667-150.528 135.168 135.168 0 0 1 150.528-27.648 502.016 502.016 0 0 0 55.296-133.461333A134.912 134.912 0 0 1 917.930667 512zM512 647.338667a135.338667 135.338667 0 1 1 0.085333-270.762667A135.338667 135.338667 0 0 1 512 647.338667z"
@@ -191,6 +205,7 @@
                                     <ContextMenu x:Name="SettingMenus" Width="130">
                                         <MenuItem Header="设置" Click="ConfigMenuClick"/>
                                         <MenuItem Header="待办" Click="BacklogMenuClick"/>
+                                        <MenuItem Header="新手引导" Click="Guide_Click"/>
                                     </ContextMenu>
                                 </Button.ContextMenu>
                             </Button>

+ 52 - 65
MainWindow.xaml.cs

@@ -17,6 +17,7 @@ using ShowSeconds;
 using System;
 using System.Collections.ObjectModel;
 using System.Diagnostics;
+using System.IO;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Text;
@@ -48,8 +49,13 @@ namespace GeekDesk
         public static int toDoHotKeyId = -1;
         public static int colorPickerHotKeyId = -1;
         public static MainWindow mainWindow;
+
+        private static bool dataFileExist = true;
         public MainWindow()
         {
+            //判断数据文件是否存在 如果不存在那么是第一次打开程序
+            dataFileExist = File.Exists(Constants.DATA_FILE_PATH);
+
             //加载数据
             LoadData();
             InitializeComponent();
@@ -359,7 +365,10 @@ namespace GeekDesk
             MessageUtil.ChangeWindowMessageFilter(MessageUtil.WM_COPYDATA, 1);
 
 
-            Guide();
+            if (!dataFileExist)
+            {
+                Guide();
+            }
         }
 
 
@@ -1016,78 +1025,48 @@ namespace GeekDesk
 
 
 
-        class GuideInfo
-        {
-            private string title1;
-            private string title2;
-            private string guideText;
-
-            public string Title1 { get; set; }
-            public string Title2 { get; set; }
-            public string GuideText { get; set; }
-        }
-        enum GuidePopOffect
-        {
-            TOP,
-            INNER_TOP,
-            LEFT,
-            INNER_LEFT,
-            CENTER,
-            RIGHT,
-            INNER_RIGHT,
-            BOTTOM,
-            INNER_BOTTOM
-        }
-
-        private ObservableCollection<GuideInfo> list = new ObservableCollection<GuideInfo>();
-
+        #region 新手引导
         private void Guide()
         {
-
-            GuideInfo guideInfo = new GuideInfo
-            {
-                Title1 = "提示1",
-                Title2 = "快捷方式创建",
-                GuideText = "将文件拖动到这里自动创建快捷方式, 或者鼠标右键单击添加系统项目"
-            };
-            list.Add(guideInfo);
-
-            guideInfo = new GuideInfo
-            {
-                Title1 = "提示2",
-                Title2 = "快捷方式创建",
-                GuideText = "将文件拖动到这里自动创建快捷方式, 或者鼠标右键单击添加系统项目"
-            };
-            list.Add(guideInfo);
-
-            guideInfo = new GuideInfo
+            if (CheckShouldShowApp())
             {
-                Title1 = "提示3",
-                Title2 = "快捷方式创建",
-                GuideText = "将文件拖动到这里自动创建快捷方式, 或者鼠标右键单击添加系统项目"
-            };
-            list.Add(guideInfo);
-
+                ShowApp();
+            }
             GrayBorder.Visibility = Visibility.Visible;
             GuideSwitch(0);
             GuideCard.Visibility = Visibility.Visible;
         }
 
-        private void GuideSwitch(int num)
+        private void GuideSwitch(int index)
         {
-            switch (num)
+            GuideNum.Text = Convert.ToString(index + 1);
+            GuideTitle1.Text = GuideInfoList.mainWindowGuideList[index].Title1;
+            GuideTitle2.Text = GuideInfoList.mainWindowGuideList[index].Title2;
+            GuideText.Text = GuideInfoList.mainWindowGuideList[index].GuideText;
+
+            if (index == 0)
+            {
+                PreviewGuideBtn.Visibility = Visibility.Collapsed;
+                NextGuideBtn.Content = "下一步";
+            } else if (index > 0 && index < GuideInfoList.mainWindowGuideList.Count - 1)
+            {
+                PreviewGuideBtn.Visibility = Visibility.Visible;
+                NextGuideBtn.Content = "下一步";
+            } else
+            {
+                NextGuideBtn.Content = "完成";
+            }
+
+            switch (index)
             {
                 default: //0  //右侧列表区域
-                    PreviewGuideBtn.Visibility = Visibility.Collapsed;
-                    NextGuideBtn.Content = "下一步";
+                    
                     Point point = RightCard.TransformToAncestor(this).Transform(new Point(0, 0));
                     //内部中上
                     GrayBoderClip(point.X, point.Y, RightCard.ActualWidth, RightCard.ActualHeight,
                         new Thickness(point.X + RightCard.ActualWidth / 2 - GuideCard.ActualWidth / 2, point.Y, 0, 0));
                     break;
                 case 1:  //左侧菜单
-                    PreviewGuideBtn.Visibility = Visibility.Visible;
-                    NextGuideBtn.Content = "下一步";
                     Point leftCardPoint = LeftCard.TransformToAncestor(this).Transform(new Point(0, 0));
                     GrayBoderClip(leftCardPoint.X , leftCardPoint.Y , LeftCard.ActualWidth, LeftCard.ActualHeight,
                         // 外部中下侧
@@ -1095,11 +1074,17 @@ namespace GeekDesk
                         leftCardPoint.Y + LeftCard.ActualHeight / 2 - GuideCard.ActualHeight / 2, 0, 0));
                     break;
                 case 2: //头部拖拽栏
-                    NextGuideBtn.Content = "完成";
                     GrayBoderClip(0, 0, this.Width, 50,
                         // 外部中下侧
                         new Thickness(this.Width / 2 - GuideCard.ActualWidth / 2, 50, 0, 0));
                     break;
+                case 3:
+                    Point mainBtnPoint = MainBtnPanel.TransformToAncestor(this).Transform(new Point(0, 0));
+                    GrayBoderClip(mainBtnPoint.X, mainBtnPoint.Y, MainBtnPanel.ActualWidth, MainBtnPanel.ActualHeight,
+                        // 外部左下侧
+                        new Thickness(mainBtnPoint.X - GuideCard.Width,
+                        mainBtnPoint.Y, 0, 0));
+                    break;
             }
         }
 
@@ -1122,11 +1107,8 @@ namespace GeekDesk
 
         private void PreviewGuideBtn_Click(object sender, RoutedEventArgs e)
         {
-            int index = Convert.ToInt32(GuideTitle1.Text.ToString().Substring(2)) - 1;
+            int index = Convert.ToInt32(GuideNum.Text.ToString()) - 1;
             int previewIndex = index - 1;
-            GuideTitle1.Text = list[previewIndex].Title1;
-            GuideTitle2.Text = list[previewIndex].Title2;
-            GuideText.Text = list[previewIndex].GuideText;
             GuideSwitch(previewIndex);
         }
 
@@ -1137,12 +1119,17 @@ namespace GeekDesk
                 GuideCard.Visibility = Visibility.Collapsed;
                 return;
             }
-            int index = Convert.ToInt32(GuideTitle1.Text.ToString().Substring(2)) - 1;
+            int index = Convert.ToInt32(GuideNum.Text.ToString()) - 1;
             int nextIndex = index + 1;
-            GuideTitle1.Text = list[nextIndex].Title1;
-            GuideTitle2.Text = list[nextIndex].Title2;
-            GuideText.Text = list[nextIndex].GuideText;
             GuideSwitch(nextIndex);
         }
+
+
+        #endregion
+
+        private void Guide_Click(object sender, RoutedEventArgs e)
+        {
+            Guide();
+        }
     }
 }

+ 79 - 0
ViewModel/Temp/GuideInfoList.cs

@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GeekDesk.Util
+{
+    public class GuideInfoList
+    {
+
+        public static ObservableCollection<GuideInfo> mainWindowGuideList = new ObservableCollection<GuideInfo>();
+
+        static GuideInfoList()
+        {
+            GuideInfo guideInfo = new GuideInfo
+            {
+                Title1 = "引导提示",
+                Title2 = "图标列表区",
+                GuideText = "右侧高亮区域是图标列表区, 将文件拖动到图标列表区将自动创建快捷方式, 或者鼠标右键单击添加系统项目"
+            };
+            mainWindowGuideList.Add(guideInfo);
+
+            guideInfo = new GuideInfo
+            {
+                Title1 = "引导提示",
+                Title2 = "菜单栏",
+                GuideText = "左侧高亮区域是菜单栏, 右键单击左侧区域可以创建菜单, 右键单击菜单可以对菜单进行操作"
+            };
+            mainWindowGuideList.Add(guideInfo);
+
+            guideInfo = new GuideInfo
+            {
+                Title1 = "引导提示",
+                Title2 = "拖动区域",
+                GuideText = "左键按住上部高亮区域可以拖动程序窗体"
+            };
+            mainWindowGuideList.Add(guideInfo);
+
+            guideInfo = new GuideInfo
+            {
+                Title1 = "引导提示",
+                Title2 = "设置和关闭",
+                GuideText = "高亮区域的两个按钮分别是设置和关闭按钮, 你可以点击设置按钮重新打开引导提示, 设置窗口中可自定义开启或关闭众多功能, 赶紧探索使用吧"
+            };
+
+            mainWindowGuideList.Add(guideInfo);
+        }
+
+
+        public class GuideInfo
+        {
+            private string title1;
+            private string title2;
+            private string guideText;
+
+            public string Title1 { get; set; }
+            public string Title2 { get; set; }
+            public string GuideText { get; set; }
+        }
+
+        public enum GuidePopOffect
+        {
+            TOP,
+            INNER_TOP,
+            LEFT,
+            INNER_LEFT,
+            CENTER,
+            RIGHT,
+            INNER_RIGHT,
+            BOTTOM,
+            INNER_BOTTOM
+        }
+
+       
+
+    }
+}