Selaa lähdekoodia

添加 自定义菜单图标

liufei 4 vuotta sitten
vanhempi
sitoutus
ccd00afbb2

+ 1 - 1
Control/Other/IconInfoDialog.xaml

@@ -2,7 +2,7 @@
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:hc="https://handyorg.github.io/handycontrol"
-        CornerRadius="10"
+        CornerRadius="4"
         Width="300"
         Height="300"
         Opacity="0.9">

+ 45 - 0
Control/UserControls/IconFont/IconPannel.xaml

@@ -0,0 +1,45 @@
+<UserControl x:Class="GeekDesk.Control.UserControls.IconFont.IconPannel"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:hc="https://handyorg.github.io/handycontrol"
+             xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
+             mc:Ignorable="d" 
+             >
+    <WrapPanel  HorizontalAlignment="Center" VerticalAlignment="Top">
+        <ListBox x:Name="IconfontList" ItemsSource="{Binding}" BorderThickness="0" Background="AliceBlue">
+            <ListBox.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <WrapPanel Orientation="Horizontal" Background="Transparent"/>
+                </ItemsPanelTemplate>
+            </ListBox.ItemsPanel>
+
+            <ListBox.ItemContainerStyle>
+                <Style>
+                </Style>
+            </ListBox.ItemContainerStyle>
+
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel Tag="{Binding}" Width="80" Height="80">
+                        <Button Background="Transparent" 
+                                BorderThickness="0"
+                                IsEnabled="False"
+                                Opacity="0.8"
+                                hc:IconElement.Geometry="{Binding Text}"
+                                hc:IconElement.Height="35"
+                                hc:IconElement.Width="35"
+                                Height="60"
+                                Width="60"
+                                />
+                        <TextBlock TextAlignment="Center" 
+                                       HorizontalAlignment="Center" 
+                                       VerticalAlignment="Center" 
+                                       Width="100" Text="{Binding Name}" />
+                    </StackPanel>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
+        </ListBox>
+    </WrapPanel>
+</UserControl>

+ 29 - 0
Control/UserControls/IconFont/IconPannel.xaml.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace GeekDesk.Control.UserControls.IconFont
+{
+    /// <summary>
+    /// IconPannel.xaml 的交互逻辑
+    /// </summary>
+    public partial class IconPannel : UserControl
+    {
+        public IconPannel()
+        {
+            InitializeComponent();
+        }
+
+    }
+}

+ 6 - 3
Control/UserControls/PannelCard/LeftCardControl.xaml

@@ -55,13 +55,15 @@
         <cvt:OpcityConvert x:Key="OpcityConvert"/>
     </UserControl.Resources>
         <!--左侧栏-->
-        <hc:Card 
+        <hc:Card x:Name="MyCard"
                  BorderThickness="1" 
                  Effect="{DynamicResource EffectShadow2}" 
                  Margin="5,0,0,5"
                  >
             <hc:Card.Background>
-                <SolidColorBrush Color="#FFFFFFFF" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
+                <SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
+                
+                </SolidColorBrush>
             </hc:Card.Background>
             <hc:Card.BorderBrush>
                 <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
@@ -131,8 +133,9 @@
                                     </Canvas>
                                 </Button>-->
                                 <!--<TextBlock Text="&#xe606;" Style="{StaticResource MyIcon}"/>-->
-                                <TextBlock Text="&#xe614;" FontFamily="/#IconFont" FontSize="40"/>
                                 <TextBlock Text="{Binding MenuName}"
+                                           HorizontalAlignment="Center"
+                                           TextAlignment="Center"
                                            VerticalAlignment="Center"
                                            IsVisibleChanged="MenuWhenVisibilityChanged"
                                            Visibility="{Binding NotMenuEdit}"

+ 5 - 1
Control/UserControls/PannelCard/LeftCardControl.xaml.cs

@@ -1,4 +1,5 @@
 using DraggAnimatedPanelExample;
+using GeekDesk.Control.Windows;
 using GeekDesk.Util;
 using GeekDesk.ViewModel;
 using System;
@@ -13,6 +14,7 @@ using System.Windows.Data;
 using System.Windows.Documents;
 using System.Windows.Input;
 using System.Windows.Media;
+using System.Windows.Media.Effects;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
@@ -31,6 +33,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
         {
             InitializeComponent();
             appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
+
         }
 
         DelegateCommand<int[]> _swap;
@@ -190,7 +193,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
         /// <param name="e"></param>
         private void EditMenuGeometry(object sender, RoutedEventArgs e)
         {
-
+            MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
+            IconfontWindow.Show(SvgToGeometry.GetIconfonts(), menuInfo);
         }
     }
 }

+ 1 - 1
Control/UserControls/PannelCard/RightCardControl.xaml

@@ -52,7 +52,7 @@
              Effect="{DynamicResource EffectShadow2}" 
              Margin="5,0,5,5" Grid.ColumnSpan="2">
         <hc:Card.Background>
-            <SolidColorBrush Color="#FFFFFFFF" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
+            <SolidColorBrush Color="AliceBlue"  hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
         </hc:Card.Background>
         <hc:Card.BorderBrush>
             <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>

+ 1 - 1
Control/Windows/ConfigWindow.xaml

@@ -62,7 +62,7 @@
                         <hc:SideMenuItem.Icon>
                             <Button Background="Transparent" 
                             BorderThickness="0"
-                            hc:IconElement.Geometry="{StaticResource About}" 
+                            hc:IconElement.Geometry="M671.374222 357.944889c10.467556 0 20.792889 0.711111 31.032889 1.820444-27.875556-124.017778-166.741333-216.149333-325.233778-216.149333-177.180444 0-322.332444 115.342222-322.332444 261.774222 0 84.536889 48.298667 153.941333 128.995556 207.786667L151.608889 705.735111l112.696889-53.959111c40.305778 7.623111 72.675556 15.445333 112.896 15.445333 10.126222 0 20.138667-0.483556 30.094222-1.223111-6.314667-20.565333-9.955556-42.126222-9.955556-64.483556C397.340444 467.057778 518.286222 357.944889 671.374222 357.944889zM498.062222 274.488889c24.263111 0 40.334222 15.246222 40.334222 38.428444 0 23.068444-16.071111 38.513778-40.334222 38.513778-24.149333 0-48.412444-15.473778-48.412444-38.513778C449.678222 289.735111 473.912889 274.488889 498.062222 274.488889zM272.469333 351.431111c-24.149333 0-48.554667-15.473778-48.554667-38.513778 0-23.153778 24.376889-38.428444 48.554667-38.428444 24.149333 0 40.248889 15.246222 40.248889 38.428444C312.718222 335.957333 296.647111 351.431111 272.469333 351.431111zM965.575111 597.816889c0-123.022222-128.967111-223.345778-273.806222-223.345778-153.372444 0-274.147556 100.295111-274.147556 223.345778 0 123.278222 120.803556 223.374222 274.147556 223.374222 32.085333 0 64.483556-7.736889 96.711111-15.445333l88.405333 46.222222-24.234667-76.913778C917.390222 728.689778 965.575111 667.221333 965.575111 597.816889zM602.908444 559.303111c-16.042667 0-32.256-15.246222-32.256-30.805333 0-15.331556 16.184889-30.776889 32.256-30.776889 24.376889 0 40.362667 15.445333 40.362667 30.776889C643.242667 544.056889 627.285333 559.303111 602.908444 559.303111zM780.202667 559.303111c-15.928889 0-32.028444-15.246222-32.028444-30.805333 0-15.331556 16.071111-30.776889 32.028444-30.776889 24.149333 0 40.362667 15.445333 40.362667 30.776889C820.536889 544.056889 804.352 559.303111 780.202667 559.303111z" 
                             hc:IconElement.Height="18"
                             hc:IconElement.Width="18"
                             HorizontalAlignment="Right"

+ 41 - 0
Control/Windows/IconfontWindow.xaml

@@ -0,0 +1,41 @@
+<Window x:Class="GeekDesk.Control.Windows.IconfontWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:GeekDesk.Control.Windows"
+        xmlns:hc="https://handyorg.github.io/handycontrol"
+        xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.IconFont"
+        mc:Ignorable="d"
+        Title="IconfontWindow"
+        Height="450" Width="600"
+        WindowStyle="None"
+        AllowsTransparency="True"
+        Background="AliceBlue"
+        MouseDown="DragMove"
+        >
+
+
+    <Border MouseDown="DragMove">
+        <Grid MouseDown="DragMove">
+            <hc:TabControl x:Name="MyTabControl" IsAnimationEnabled="True" SelectionChanged="TabControl_SelectionChanged" ShowContextMenu="True"  IsTabFillEnabled="True" Margin="20,30,20,20" Height="350" VerticalAlignment="Top">
+                <hc:TabItem Tag="System" Header="系统" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" >
+                    <hc:SimplePanel Background="AliceBlue">
+                        <uc:IconPannel x:Name="System" />
+                    </hc:SimplePanel>
+                </hc:TabItem>
+                <hc:TabItem Tag="Custom" IsSelected="True" Header="自定义" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CalendarGeometry}">
+                    <hc:SimplePanel Background="AliceBlue">
+                        <uc:IconPannel x:Name="Custom" />
+                    </hc:SimplePanel>
+                </hc:TabItem>
+            </hc:TabControl>
+
+            
+            <Button Content="取消" Click="Close_Click" Margin="406,397.5,148,22.5"/>
+            <Button Content="确定" Click="Confirm_Click" Background="#5BC0DE" Foreground="White" Margin="500.5,397.5,53.5,22.5" RenderTransformOrigin="0.696,0.45"/>
+        </Grid>
+    </Border>
+    
+    
+</Window>

+ 91 - 0
Control/Windows/IconfontWindow.xaml.cs

@@ -0,0 +1,91 @@
+using GeekDesk.Util;
+using GeekDesk.ViewModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace GeekDesk.Control.Windows
+{
+    /// <summary>
+    /// IconfontWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class IconfontWindow : Window
+    {
+
+        private static List<IconfontInfo> listInfo;
+        private static MenuInfo menuInfo;
+        private IconfontWindow(List<IconfontInfo> listInfo, MenuInfo menuInfo)
+        {
+            InitializeComponent();
+            this.DataContext = listInfo;
+            IconfontWindow.listInfo = listInfo;
+            IconfontWindow.menuInfo = menuInfo;
+        }
+
+        /// <summary>
+        /// 移动窗口
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
+        {
+            if (e.LeftButton == MouseButtonState.Pressed)
+            {
+                DragMove();
+            }
+        }
+
+        private void Close_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+
+        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            this.DataContext = listInfo;
+        }
+
+        private void Confirm_Click(object sender, RoutedEventArgs e)
+        {
+            string tag = (MyTabControl.SelectedContent as TabItem).Tag.ToString();
+
+            switch (tag)
+            {
+                case "Custom":
+                    if (Custom.IconfontList.SelectedIndex != -1)
+                    {
+                        menuInfo.MenuGeometry = (((StackPanel)Custom.IconfontList.SelectedItem).Tag as IconfontInfo).Text;
+                    }
+                    break;
+                default:
+                    if (System.IconfontList.SelectedIndex != -1)
+                    {
+                        menuInfo.MenuGeometry = (((StackPanel)System.IconfontList.SelectedItem).Tag as IconfontInfo).Text;
+                    }
+                    break;
+            }
+            this.Close();
+        }
+
+
+        private static System.Windows.Window window = null;
+        public static void Show(List<IconfontInfo> listInfo, MenuInfo menuInfo)
+        {
+            if (window == null || !window.Activate())
+            {
+                window = new IconfontWindow(listInfo, menuInfo);
+            }
+            window.Show();
+        }
+    }
+}

+ 24 - 5
GeekDesk.csproj

@@ -38,7 +38,7 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   <PropertyGroup>
-    <StartupObject>GeekDesk.SvgToGeometry</StartupObject>
+    <StartupObject>GeekDesk.App</StartupObject>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Apex.WinForms, Version=1.6.0.0, Culture=neutral, PublicKeyToken=98d06957926c086d, processorArchitecture=MSIL">
@@ -59,8 +59,8 @@
     <Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
     </Reference>
-    <Reference Include="HandyControl, Version=3.2.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
-      <HintPath>packages\HandyControl.3.2.0\lib\net472\HandyControl.dll</HintPath>
+    <Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
+      <HintPath>packages\HandyControl.3.1.0\lib\net472\HandyControl.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -116,6 +116,9 @@
     <Compile Include="Control\UserControls\Backlog\BacklogControl.xaml.cs">
       <DependentUpon>BacklogControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs">
+      <DependentUpon>IconPannel.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Control\Windows\BacklogInfoWindow.xaml.cs">
       <DependentUpon>BacklogInfoWindow.xaml</DependentUpon>
     </Compile>
@@ -146,6 +149,9 @@
     <Compile Include="Control\UserControls\Config\MotionControl.xaml.cs">
       <DependentUpon>MotionControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Control\Windows\IconfontWindow.xaml.cs">
+      <DependentUpon>IconfontWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Converts\DoubleToGridLength.cs" />
     <Compile Include="Converts\IntToCornerRadius.cs" />
     <Compile Include="Converts\OpcityConvert.cs" />
@@ -154,8 +160,8 @@
     <Compile Include="EditTextBlock\EditableTextBlock.cs" />
     <Compile Include="EditTextBlock\EditableTextBlockAdorner.cs" />
     <Compile Include="Converts\HideTypeConvert.cs" />
-    <Compile Include="SvgToGeometry.cs" />
     <Compile Include="Task\BacklogTask.cs" />
+    <Compile Include="Util\AeroGlassHelper.cs" />
     <Compile Include="Util\CommonCode.cs" />
     <Compile Include="Util\ConsoleManager.cs" />
     <Compile Include="Util\DragAdorner.cs" />
@@ -166,12 +172,13 @@
     <Compile Include="Converts\MenuWidthConvert.cs" />
     <Compile Include="Util\MouseUtil.cs" />
     <Compile Include="Util\MouseUtilities.cs" />
-    <Compile Include="Util\ScreenUtil.cs" />
     <Compile Include="Util\ShellContextMenu.cs" />
+    <Compile Include="Util\SvgToGeometry.cs" />
     <Compile Include="Util\SystemIcon.cs" />
     <Compile Include="ViewModel\AppConfig.cs" />
     <Compile Include="ViewModel\AppData.cs" />
     <Compile Include="ViewModel\BacklogInfo.cs" />
+    <Compile Include="ViewModel\IconfontInfo.cs" />
     <Compile Include="ViewModel\IconInfo.cs" />
     <Compile Include="ViewModel\MenuInfo.cs" />
     <Page Include="Control\Other\BacklogNotificatin.xaml">
@@ -182,6 +189,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Control\UserControls\IconFont\IconPannel.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Control\Windows\BacklogInfoWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -222,6 +233,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Control\Windows\IconfontWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -261,6 +276,7 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <Resource Include="Resource\Iconfont\iconfont.json" />
     <Resource Include="Fonts\iconfont.ttf">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Resource>
@@ -286,5 +302,8 @@
   <ItemGroup>
     <Resource Include="Resource\Image\CompleteLogo.png" />
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Resource\Iconfont\iconfont.js" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 15 - 3
MainWindow.xaml

@@ -11,18 +11,19 @@
         xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
         x:Name="window"
         xmlns:hc="https://handyorg.github.io/handycontrol"
-        Title="MainWindow" Height="500" Width="600"
+        Title="MainWindow" 
+        d:DesignHeight="500" d:DesignWidth="700"
         WindowStyle="None"
         AllowsTransparency="True"
         Background="Transparent"
         OpacityMask ="White"
         Deactivated="window_Deactivated"
+        SizeChanged="window_SizeChanged"
         >
     <WindowChrome.WindowChrome>
         <WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
     </WindowChrome.WindowChrome>
     <Window.Resources>
-
        
         <cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
         <cvt:OpcityConvert x:Key="OpcityConvert"/>
@@ -37,7 +38,18 @@
         <Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"  BorderThickness="0">
             <!--背景图片-->
             <Border.Background>
-                <ImageBrush ImageSource="{Binding AppConfig.BitmapImage}" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"></ImageBrush>
+                <VisualBrush>
+                    <VisualBrush.Visual>
+                        <Grid ClipToBounds="True">
+                            <Image Source="{Binding AppConfig.BitmapImage}" Margin="-30" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
+                                <Image.Effect>
+                                    <BlurEffect Radius="100"/>
+                                </Image.Effect>
+                            </Image>
+                        </Grid>
+                    </VisualBrush.Visual>
+                </VisualBrush>
+                <!--<ImageBrush ImageSource="{Binding AppConfig.BitmapImage}" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"></ImageBrush>-->
             </Border.Background>
             <Grid>
                 <Grid.RowDefinitions>

+ 13 - 3
MainWindow.xaml.cs

@@ -79,7 +79,10 @@ namespace GeekDesk
             {
                 HandyControl.Controls.Growl.WarningGlobal("启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!");
             }
-            
+            //AeroGlassHelper.ExtendGlass(this);
+            //AeroGlassHelper.ExtendGlass(BBB, (int)this.Margin.Left, (int)this.Margin.Right, (int)this.Margin.Top, (int)this.Margin.Bottom);
+
+
         }
 
         private void DisplayWindowHotKeyPress(object sender, KeyPressedEventArgs e)
@@ -99,7 +102,6 @@ namespace GeekDesk
         }
 
 
-
         void MainWindow_Resize(object sender, System.EventArgs e)
         {
             if (this.DataContext != null)
@@ -347,7 +349,15 @@ namespace GeekDesk
             }
         }
 
-        
+        private void window_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            if (this.DataContext != null)
+            {
+                AppData appData = this.DataContext as AppData;
+                appData.AppConfig.WindowWidth = this.Width;
+                appData.AppConfig.WindowHeight = this.Height;
+            }
+        }
     }
 
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Resource/Iconfont/iconfont.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5 - 0
Resource/Iconfont/iconfont.js.bak


+ 604 - 0
Resource/Iconfont/iconfont.json

@@ -0,0 +1,604 @@
+{
+  "id": "2642707",
+  "name": "GeekDesk",
+  "font_family": "iconfont",
+  "css_prefix_text": "icon-",
+  "description": "图标",
+  "glyphs": [
+    {
+      "icon_id": "60399",
+      "name": "微信",
+      "font_class": "weixin",
+      "unicode": "e643",
+      "unicode_decimal": 58947
+    },
+    {
+      "icon_id": "442756",
+      "name": "活动",
+      "font_class": "huodong",
+      "unicode": "e63e",
+      "unicode_decimal": 58942
+    },
+    {
+      "icon_id": "1036569",
+      "name": "搜索",
+      "font_class": "sousuo",
+      "unicode": "e644",
+      "unicode_decimal": 58948
+    },
+    {
+      "icon_id": "1193697",
+      "name": "钉钉",
+      "font_class": "dingding",
+      "unicode": "e622",
+      "unicode_decimal": 58914
+    },
+    {
+      "icon_id": "3214599",
+      "name": "百度",
+      "font_class": "baidu",
+      "unicode": "e626",
+      "unicode_decimal": 58918
+    },
+    {
+      "icon_id": "3273215",
+      "name": "梯子",
+      "font_class": "tizi",
+      "unicode": "e707",
+      "unicode_decimal": 59143
+    },
+    {
+      "icon_id": "3299053",
+      "name": "衣服",
+      "font_class": "yifu",
+      "unicode": "e64e",
+      "unicode_decimal": 58958
+    },
+    {
+      "icon_id": "3299058",
+      "name": "衣服 copy",
+      "font_class": "yifucopy",
+      "unicode": "e64f",
+      "unicode_decimal": 58959
+    },
+    {
+      "icon_id": "3563332",
+      "name": "其它",
+      "font_class": "qita2",
+      "unicode": "e601",
+      "unicode_decimal": 58881
+    },
+    {
+      "icon_id": "3629444",
+      "name": "鞋子",
+      "font_class": "xiezi",
+      "unicode": "e660",
+      "unicode_decimal": 58976
+    },
+    {
+      "icon_id": "4468481",
+      "name": "其它",
+      "font_class": "qita3",
+      "unicode": "e634",
+      "unicode_decimal": 58932
+    },
+    {
+      "icon_id": "4859057",
+      "name": "梯子",
+      "font_class": "tizi1",
+      "unicode": "e617",
+      "unicode_decimal": 58903
+    },
+    {
+      "icon_id": "7603899",
+      "name": "鞋子",
+      "font_class": "xiezi1",
+      "unicode": "e63f",
+      "unicode_decimal": 58943
+    },
+    {
+      "icon_id": "8099091",
+      "name": "衣服",
+      "font_class": "yifu1",
+      "unicode": "e608",
+      "unicode_decimal": 58888
+    },
+    {
+      "icon_id": "9295722",
+      "name": "QQ",
+      "font_class": "QQ",
+      "unicode": "e68c",
+      "unicode_decimal": 59020
+    },
+    {
+      "icon_id": "10094246",
+      "name": "其它",
+      "font_class": "qita4",
+      "unicode": "e779",
+      "unicode_decimal": 59257
+    },
+    {
+      "icon_id": "13541930",
+      "name": "检验",
+      "font_class": "menu_checkout_icon",
+      "unicode": "e670",
+      "unicode_decimal": 58992
+    },
+    {
+      "icon_id": "16351299",
+      "name": "活动",
+      "font_class": "huodong1",
+      "unicode": "e616",
+      "unicode_decimal": 58902
+    },
+    {
+      "icon_id": "18532512",
+      "name": "百度 -01",
+      "font_class": "baidu-01",
+      "unicode": "e702",
+      "unicode_decimal": 59138
+    },
+    {
+      "icon_id": "19923915",
+      "name": "检验",
+      "font_class": "jianyan",
+      "unicode": "e78d",
+      "unicode_decimal": 59277
+    },
+    {
+      "icon_id": "20224885",
+      "name": "搜索",
+      "font_class": "sousuo1",
+      "unicode": "e610",
+      "unicode_decimal": 58896
+    },
+    {
+      "icon_id": "21898770",
+      "name": "检验",
+      "font_class": "jianyan1",
+      "unicode": "e70c",
+      "unicode_decimal": 59148
+    },
+    {
+      "icon_id": "176160",
+      "name": "下载",
+      "font_class": "xiazai",
+      "unicode": "e6a2",
+      "unicode_decimal": 59042
+    },
+    {
+      "icon_id": "791886",
+      "name": "会话",
+      "font_class": "huihua-copy",
+      "unicode": "e647",
+      "unicode_decimal": 58951
+    },
+    {
+      "icon_id": "880997",
+      "name": "游戏 遥控 玩具",
+      "font_class": "youxiyaokongwanju",
+      "unicode": "e899",
+      "unicode_decimal": 59545
+    },
+    {
+      "icon_id": "1054324",
+      "name": "文件夹",
+      "font_class": "folder",
+      "unicode": "e98f",
+      "unicode_decimal": 59791
+    },
+    {
+      "icon_id": "1108054",
+      "name": "游戏",
+      "font_class": "youxi",
+      "unicode": "e632",
+      "unicode_decimal": 58930
+    },
+    {
+      "icon_id": "1599042",
+      "name": "下载",
+      "font_class": "xiazai1",
+      "unicode": "e678",
+      "unicode_decimal": 59000
+    },
+    {
+      "icon_id": "1816323",
+      "name": "文档",
+      "font_class": "wendang",
+      "unicode": "e614",
+      "unicode_decimal": 58900
+    },
+    {
+      "icon_id": "1879004",
+      "name": "搞笑",
+      "font_class": "gaoxiao",
+      "unicode": "e607",
+      "unicode_decimal": 58887
+    },
+    {
+      "icon_id": "1912401",
+      "name": "浏览器",
+      "font_class": "xinxinicon",
+      "unicode": "e60c",
+      "unicode_decimal": 58892
+    },
+    {
+      "icon_id": "2148348",
+      "name": "笔记",
+      "font_class": "biji",
+      "unicode": "e61f",
+      "unicode_decimal": 58911
+    },
+    {
+      "icon_id": "2773508",
+      "name": "税",
+      "font_class": "shui",
+      "unicode": "e60d",
+      "unicode_decimal": 58893
+    },
+    {
+      "icon_id": "2877314",
+      "name": "网络",
+      "font_class": "wangluo",
+      "unicode": "e618",
+      "unicode_decimal": 58904
+    },
+    {
+      "icon_id": "3643365",
+      "name": "游戏",
+      "font_class": "youxi1",
+      "unicode": "e600",
+      "unicode_decimal": 58880
+    },
+    {
+      "icon_id": "3700479",
+      "name": "下载",
+      "font_class": "xiazai2",
+      "unicode": "e641",
+      "unicode_decimal": 58945
+    },
+    {
+      "icon_id": "3768311",
+      "name": "游戏",
+      "font_class": "youxi2",
+      "unicode": "e60e",
+      "unicode_decimal": 58894
+    },
+    {
+      "icon_id": "5032457",
+      "name": "图片",
+      "font_class": "tupian",
+      "unicode": "e61d",
+      "unicode_decimal": 58909
+    },
+    {
+      "icon_id": "5100415",
+      "name": "工具",
+      "font_class": "gongju",
+      "unicode": "eb01",
+      "unicode_decimal": 60161
+    },
+    {
+      "icon_id": "7175008",
+      "name": "搞笑",
+      "font_class": "gaoxiaoquwei",
+      "unicode": "e65c",
+      "unicode_decimal": 58972
+    },
+    {
+      "icon_id": "7321402",
+      "name": "使用翻墙软件",
+      "font_class": "shiyongfanqiangruanjian",
+      "unicode": "e98d",
+      "unicode_decimal": 59789
+    },
+    {
+      "icon_id": "7603848",
+      "name": "审核 笔记 记事本 写字",
+      "font_class": "shenhebijijishibenxiezi",
+      "unicode": "e63c",
+      "unicode_decimal": 58940
+    },
+    {
+      "icon_id": "7699636",
+      "name": "网络",
+      "font_class": "wangluo1",
+      "unicode": "e62c",
+      "unicode_decimal": 58924
+    },
+    {
+      "icon_id": "7842457",
+      "name": "文件夹",
+      "font_class": "wenjianjia",
+      "unicode": "e615",
+      "unicode_decimal": 58901
+    },
+    {
+      "icon_id": "8462080",
+      "name": "工具",
+      "font_class": "gongju1",
+      "unicode": "e6a9",
+      "unicode_decimal": 59049
+    },
+    {
+      "icon_id": "9202140",
+      "name": "搞笑",
+      "font_class": "gaoxiao1",
+      "unicode": "e621",
+      "unicode_decimal": 58913
+    },
+    {
+      "icon_id": "9319292",
+      "name": "税",
+      "font_class": "shui1",
+      "unicode": "e620",
+      "unicode_decimal": 58912
+    },
+    {
+      "icon_id": "9521743",
+      "name": "系统",
+      "font_class": "xitong",
+      "unicode": "e68b",
+      "unicode_decimal": 59019
+    },
+    {
+      "icon_id": "10211567",
+      "name": "浏览器",
+      "font_class": "liulanqi",
+      "unicode": "e6e2",
+      "unicode_decimal": 59106
+    },
+    {
+      "icon_id": "10250868",
+      "name": "税",
+      "font_class": "shui2",
+      "unicode": "e67d",
+      "unicode_decimal": 59005
+    },
+    {
+      "icon_id": "10271432",
+      "name": "工具",
+      "font_class": "gongju2",
+      "unicode": "e602",
+      "unicode_decimal": 58882
+    },
+    {
+      "icon_id": "10646986",
+      "name": "音乐",
+      "font_class": "yinle",
+      "unicode": "e603",
+      "unicode_decimal": 58883
+    },
+    {
+      "icon_id": "11268672",
+      "name": "其它",
+      "font_class": "qita",
+      "unicode": "e619",
+      "unicode_decimal": 58905
+    },
+    {
+      "icon_id": "11334214",
+      "name": "网络",
+      "font_class": "wangluo2",
+      "unicode": "e62b",
+      "unicode_decimal": 58923
+    },
+    {
+      "icon_id": "11682456",
+      "name": "影音",
+      "font_class": "yingyin",
+      "unicode": "e689",
+      "unicode_decimal": 59017
+    },
+    {
+      "icon_id": "11746216",
+      "name": "其它",
+      "font_class": "qita1",
+      "unicode": "e85f",
+      "unicode_decimal": 59487
+    },
+    {
+      "icon_id": "12321385",
+      "name": "文档",
+      "font_class": "wendang1",
+      "unicode": "e624",
+      "unicode_decimal": 58916
+    },
+    {
+      "icon_id": "13119454",
+      "name": "文档",
+      "font_class": "wendang2",
+      "unicode": "e662",
+      "unicode_decimal": 58978
+    },
+    {
+      "icon_id": "13312750",
+      "name": "数据库",
+      "font_class": "shujuku",
+      "unicode": "e6bc",
+      "unicode_decimal": 59068
+    },
+    {
+      "icon_id": "13732611",
+      "name": "影音",
+      "font_class": "yingyin1",
+      "unicode": "e74e",
+      "unicode_decimal": 59214
+    },
+    {
+      "icon_id": "13749574",
+      "name": "开发",
+      "font_class": "kaifa",
+      "unicode": "e990",
+      "unicode_decimal": 59792
+    },
+    {
+      "icon_id": "13775486",
+      "name": "会话",
+      "font_class": "huihua",
+      "unicode": "e604",
+      "unicode_decimal": 58884
+    },
+    {
+      "icon_id": "14367558",
+      "name": "影音",
+      "font_class": "yingyin2",
+      "unicode": "e6c7",
+      "unicode_decimal": 59079
+    },
+    {
+      "icon_id": "14440333",
+      "name": "浏览器",
+      "font_class": "liulanqi1",
+      "unicode": "e638",
+      "unicode_decimal": 58936
+    },
+    {
+      "icon_id": "14852588",
+      "name": "网络",
+      "font_class": "wangluo3",
+      "unicode": "e640",
+      "unicode_decimal": 58944
+    },
+    {
+      "icon_id": "15322445",
+      "name": "笔记",
+      "font_class": "biji1",
+      "unicode": "e60f",
+      "unicode_decimal": 58895
+    },
+    {
+      "icon_id": "15562668",
+      "name": "会话",
+      "font_class": "huihua1",
+      "unicode": "e633",
+      "unicode_decimal": 58931
+    },
+    {
+      "icon_id": "15826306",
+      "name": "音乐",
+      "font_class": "yinle1",
+      "unicode": "e6af",
+      "unicode_decimal": 59055
+    },
+    {
+      "icon_id": "15883683",
+      "name": "税",
+      "font_class": "shui3",
+      "unicode": "e6e6",
+      "unicode_decimal": 59110
+    },
+    {
+      "icon_id": "16677119",
+      "name": "系统",
+      "font_class": "xitong1",
+      "unicode": "e88c",
+      "unicode_decimal": 59532
+    },
+    {
+      "icon_id": "17267539",
+      "name": "文件夹",
+      "font_class": "wenjianjia1",
+      "unicode": "e629",
+      "unicode_decimal": 58921
+    },
+    {
+      "icon_id": "17373793",
+      "name": "开发",
+      "font_class": "kaifa1",
+      "unicode": "e65a",
+      "unicode_decimal": 58970
+    },
+    {
+      "icon_id": "17667583",
+      "name": "文件_夹",
+      "font_class": "jia",
+      "unicode": "e841",
+      "unicode_decimal": 59457
+    },
+    {
+      "icon_id": "19329201",
+      "name": "音乐",
+      "font_class": "yinle2",
+      "unicode": "e666",
+      "unicode_decimal": 58982
+    },
+    {
+      "icon_id": "19542090",
+      "name": "系统",
+      "font_class": "xitong2",
+      "unicode": "e605",
+      "unicode_decimal": 58885
+    },
+    {
+      "icon_id": "20017778",
+      "name": "人-翻墙",
+      "font_class": "ren-fanqiang",
+      "unicode": "e88d",
+      "unicode_decimal": 59533
+    },
+    {
+      "icon_id": "20030744",
+      "name": "下载",
+      "font_class": "lib-download-fill",
+      "unicode": "e736",
+      "unicode_decimal": 59190
+    },
+    {
+      "icon_id": "20170023",
+      "name": "文档",
+      "font_class": "wendang3",
+      "unicode": "e612",
+      "unicode_decimal": 58898
+    },
+    {
+      "icon_id": "20179496",
+      "name": "系统",
+      "font_class": "xitong3",
+      "unicode": "e676",
+      "unicode_decimal": 58998
+    },
+    {
+      "icon_id": "20295184",
+      "name": "浏览器",
+      "font_class": "liulanqi2",
+      "unicode": "e700",
+      "unicode_decimal": 59136
+    },
+    {
+      "icon_id": "20537189",
+      "name": "图片",
+      "font_class": "tupian1",
+      "unicode": "e681",
+      "unicode_decimal": 59009
+    },
+    {
+      "icon_id": "20634659",
+      "name": "工具",
+      "font_class": "gongju3",
+      "unicode": "e613",
+      "unicode_decimal": 58899
+    },
+    {
+      "icon_id": "20881217",
+      "name": "数据库",
+      "font_class": "shujuku1",
+      "unicode": "e749",
+      "unicode_decimal": 59209
+    },
+    {
+      "icon_id": "21163108",
+      "name": "开发",
+      "font_class": "kaifa2",
+      "unicode": "e75f",
+      "unicode_decimal": 59231
+    },
+    {
+      "icon_id": "22091292",
+      "name": "图 片",
+      "font_class": "tupian2",
+      "unicode": "e606",
+      "unicode_decimal": 58886
+    }
+  ]
+}

+ 0 - 73
SvgToGeometry.cs

@@ -1,73 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml;
-
-namespace GeekDesk
-{
-    class SvgToGeometry
-    {
-        static void Main(string[] args)
-        {
-            XmlDocument xmlDoc = new XmlDocument();
-            xmlDoc.XmlResolver = null;
-            XmlReaderSettings settings = new XmlReaderSettings();
-            settings.IgnoreComments = true;//忽略文档里面的注释
-            settings.DtdProcessing = DtdProcessing.Parse;
-            XmlReader reader = XmlReader.Create("D:\\下载文件\\font_2642707_zjdi9qttb38\\iconfont.svg", settings);
-            xmlDoc.Load(reader);
-
-            XmlNodeList nodeList =  xmlDoc.SelectNodes("/svg/defs/font/glyph");
-
-            string jsonFilePath = "D:\\下载文件\\font_2642707_zjdi9qttb38\\iconfont.json";
-            JObject jo = ReadJson(jsonFilePath);
-            JArray ja = JArray.Parse(jo["glyphs"].ToString());
-
-            string value;
-
-            for (int i=0; i<nodeList.Count; i++)
-            {
-                value = nodeList[i].Attributes["d"].Value;
-                
-            }
-
-            foreach (XmlNode xmlNode in nodeList)
-            {
-                value = xmlNode.Attributes["d"].Value;
-                Console.WriteLine(value);
-
-               
-                
-            }
-        }
-
-        public static JObject ReadJson(string filePath)
-        {
-            using (System.IO.StreamReader file = System.IO.File.OpenText(filePath))
-            {
-                using (JsonTextReader reader = new JsonTextReader(file))
-                {
-                    JObject o = (JObject)JToken.ReadFrom(reader);
-                    return o;
-                }
-            }
-        }
-
-        public static string GetMd5Str(string ConvertString)
-        {
-            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
-            string t2 = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8);
-            t2 = t2.Replace("-", "");
-
-            t2 = t2.ToLower();
-
-            return t2;
-        }
-    }
-}

+ 175 - 0
Util/AeroGlassHelper.cs

@@ -0,0 +1,175 @@
+/*
+* Virtual Router v1.0 - http://virtualrouter.codeplex.com
+* Wifi Hot Spot for Windows 8, 7 and 2008 R2
+* Copyright (c) 2013 Chris Pietschmann (http://pietschsoft.com)
+* Licensed under the Microsoft Public License (Ms-PL)
+* http://virtualrouter.codeplex.com/license
+*/
+using System;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Interop;
+using System.Windows.Media;
+
+namespace GeekDesk.Util
+{
+    public static class AeroGlassHelper
+    {
+        #region "Generic Static Methods"
+
+        public static void ExtendGlass(IntPtr windowHandle)
+        {
+            ExtendGlass(windowHandle, -1, -1, -1, -1);
+        }
+
+        public static void ExtendGlass(IntPtr windowHandle, int left, int right, int top, int bottom)
+        {
+            internalExtendGlass(windowHandle, left, right, top, bottom);
+        }
+
+        private static int internalExtendGlass(IntPtr windowHandle, int left, int right, int top, int bottom)
+        {
+            var retVal = -1; // Returning less than zero will indicate that Aero Glass could not be extended
+
+            // Calculate the Aero Glass Margins
+            Win32.Margins margins = Win32.GetDpiAdjustedMargins(windowHandle, left, right, top, bottom);
+
+            try
+            {
+                // Actually Enable Aero Glass
+                retVal = Win32.DwmExtendFrameIntoClientArea(windowHandle, ref margins);
+            }
+            catch (Exception)
+            {
+                retVal = -1;
+            }
+
+            return retVal;
+        }
+
+        #endregion
+
+        #region "WPF Static Methods"
+
+        public static void ExtendGlass(Window win)
+        {
+            ExtendGlass(win, -1, -1, -1, -1);
+        }
+
+        public static void ExtendGlass(Window win, int left, int right, int top, int bottom)
+        {
+            Brush originalBackgroundBrush = win.Background;
+            try
+            {
+                int retVal = -1;
+                if (Win32.DwmIsCompositionEnabled())
+                {
+                    win.Background = Brushes.Transparent;
+
+                    // Obtain the window handle for WPF application
+                    WindowInteropHelper windowInterop = new WindowInteropHelper(win);
+                    IntPtr windowHandle = windowInterop.Handle;
+
+                    // Set the Window background to be Transparent so the Aero Glass will show through
+                    HwndSource mainWindowSrc = HwndSource.FromHwnd(windowHandle);
+                    mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent;
+
+                    retVal = internalExtendGlass(windowHandle, left, right, top, bottom);
+                }
+                if (retVal < 0)
+                {
+                    throw new NotSupportedException("Operation Failed: Aero Glass Not Supported");
+                }
+            }
+            catch
+            {
+                // If an error occurred then change the Window.Background back to what it was
+                win.Background = originalBackgroundBrush;
+            }
+        }
+
+        #endregion
+
+        //#region "Windows.Forms Static Methods"
+
+        //public static void ExtendGlass(Form form)
+        //{
+        //    ExtendGlass(form, -1, -1, -1, -1);
+        //}
+
+        //public static void ExtendGlass(Form form, int left, int right, int top, int bottom)
+        //{
+        //    System.Drawing.Color oldBackColor = form.BackColor;
+        //    System.Drawing.Color oldTransparencyKey = form.TransparencyKey;
+
+        //    int retVal = -1;
+
+        //    try
+        //    {
+        //        form.TransparencyKey = System.Drawing.Color.Beige;
+        //        form.BackColor = form.TransparencyKey;
+
+        //        retVal = internalExtendGlass(form.Handle, left, right, top, bottom);
+        //    }
+        //    catch (Exception)
+        //    {
+        //        retVal = -1;
+        //    }
+
+        //    if (retVal < 0)
+        //    {
+        //        form.BackColor = oldBackColor;
+        //        form.TransparencyKey = oldTransparencyKey;
+        //    }
+        //}
+
+        //#endregion
+
+        #region "Win32 / pinvoke"
+
+        private static class Win32
+        {
+            [DllImport("DwmApi.dll")]
+            public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref Margins margins);
+
+            [DllImport("dwmapi.dll", PreserveSig = false)]
+            public static extern bool DwmIsCompositionEnabled();
+
+
+            [StructLayout(LayoutKind.Sequential)]
+            public struct Margins
+            {
+                public int Left;    // width of left border that retains its size
+                public int Right;   // width of right border that retains its size
+                public int Top;     // height of top border that retains its size
+                public int Bottom;  // height of bottom border that retains its size
+            }
+
+            public static Win32.Margins GetDpiAdjustedMargins(IntPtr windowHandle, int left, int right, int top, int bottom)
+            {
+                float DesktopDpiX;
+                float DesktopDpiY;
+                // Get System Dpi
+                using (System.Drawing.Graphics desktop = System.Drawing.Graphics.FromHwnd(windowHandle))
+                {
+                    DesktopDpiX = desktop.DpiX;
+                    DesktopDpiY = desktop.DpiY;
+                }
+
+                // Set Margins
+                Win32.Margins margins = new Win32.Margins();
+
+                // Note that the default desktop Dpi is 96dpi. The  margins are
+                // adjusted for the system Dpi.
+                margins.Left = Convert.ToInt32(left * (DesktopDpiX / 96));
+                margins.Right = Convert.ToInt32(right * (DesktopDpiX / 96));
+                margins.Top = Convert.ToInt32(top * (DesktopDpiX / 96));
+                margins.Bottom = Convert.ToInt32(bottom * (DesktopDpiX / 96));
+
+                return margins;
+            }
+        }
+
+        #endregion
+    }
+}

+ 17 - 0
Util/ImageUtil.cs

@@ -47,6 +47,23 @@ namespace GeekDesk.Util
             }
         }
 
+        /// <summary>
+        /// byte[]转换成Image
+        /// </summary>
+        /// <param name="byteArrayIn">二进制图片流</param>
+        /// <returns>Image</returns>
+        public static Image ByteArrayToImage(byte[] byteArrayIn)
+        {
+            if (byteArrayIn == null)
+                return null;
+            using (System.IO.MemoryStream ms = new System.IO.MemoryStream(byteArrayIn))
+            {
+                System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
+                ms.Flush();
+                return returnImage;
+            }
+        }
+
         /// <summary>
         /// 图片base64 转 BitmapImage
         /// </summary>

+ 0 - 15
Util/ScreenUtil.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace GeekDesk.Util
-{
-    class ScreenUtil
-    {
-
-
-
-    }
-}

+ 83 - 0
Util/SvgToGeometry.cs

@@ -0,0 +1,83 @@
+using GeekDesk.ViewModel;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Xml;
+
+namespace GeekDesk.Util
+{
+    class SvgToGeometry
+    {
+
+        public static List<IconfontInfo> GetIconfonts()
+        {
+            string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js";
+            string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json";
+
+            Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream;
+            Stream jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream;
+
+            StreamReader streamReader = new StreamReader(svgStream);
+            string svgJsStr = streamReader.ReadToEnd();
+
+            svgJsStr = svgJsStr.Substring(svgJsStr.IndexOf("<svg>"),
+                svgJsStr.Length - (svgJsStr.Length - (svgJsStr.IndexOf("</svg>") + "</svg>".Length)) - svgJsStr.IndexOf("<svg>"));
+
+            XmlDocument xmlDoc = new XmlDocument();
+            xmlDoc.LoadXml(svgJsStr);
+            XmlNodeList nodeList = xmlDoc.SelectNodes("/svg/symbol");
+
+            JObject jo = ReadJson(jsonStream);
+            JArray ja = JArray.Parse(jo["glyphs"].ToString());
+
+            List<IconfontInfo> listInfo = new List<IconfontInfo>();
+            for (int i = 0; i < nodeList.Count; i++)
+            {
+                XmlNodeList pathNodes = nodeList[i].SelectNodes("path");
+                string text = "";
+                foreach (XmlNode pathNode in pathNodes)
+                {
+                    text += pathNode.Attributes["d"].Value;
+                }
+                string name = JObject.Parse(ja[i].ToString())["name"].ToString();
+                listInfo.Add(new IconfontInfo
+                {
+                    Text = text,
+                    Name = name
+                });
+            }
+            return listInfo;
+        }
+
+
+        public static JObject ReadJson(Stream stream)
+        {
+            using (StreamReader file = new StreamReader(stream))
+            {
+                using (JsonTextReader reader = new JsonTextReader(file))
+                {
+                    JObject o = (JObject)JToken.ReadFrom(reader);
+                    return o;
+                }
+            }
+        }
+
+        public static string GetMd5Str(string ConvertString)
+        {
+            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
+            string t2 = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8);
+            t2 = t2.Replace("-", "");
+
+            t2 = t2.ToLower();
+
+            return t2;
+        }
+    }
+}

+ 2 - 0
ViewModel/AppConfig.cs

@@ -4,6 +4,7 @@ using GeekDesk.Util;
 using System;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
+using System.Drawing;
 using System.Windows;
 using System.Windows.Input;
 using System.Windows.Media.Imaging;
@@ -177,6 +178,7 @@ namespace GeekDesk.ViewModel
                 if (imageByteArr == null || imageByteArr.Length == 0)
                 {
                     bacImgName = "系统默认";
+                    //Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
                     return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
                 } else
                 {

+ 40 - 0
ViewModel/IconfontInfo.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GeekDesk.ViewModel
+{
+    public class IconfontInfo
+    {
+
+        private string text;
+        private string name;
+
+
+        public string Text
+        {
+            get
+            {
+                return text;
+            }
+            set
+            {
+                text = value;
+            }
+        }
+
+        public string Name
+        {
+            get
+            {
+                return name;
+            }
+            set
+            {
+                name = value;
+            }
+        }
+    }
+}

+ 1 - 1
packages.config

@@ -2,7 +2,7 @@
 <packages>
   <package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
   <package id="GlobalHotKey" version="1.1.0" targetFramework="net472" />
-  <package id="HandyControl" version="3.2.0" targetFramework="net472" />
+  <package id="HandyControl" version="3.1.0" targetFramework="net472" />
   <package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
   <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
   <package id="SharpShell" version="2.7.2" targetFramework="net472" />

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä