暂时可简单使用

This commit is contained in:
liufei
2021-05-12 10:00:12 +08:00
parent 876e78bbfc
commit ef7cb465a1
17 changed files with 672 additions and 202 deletions

View File

@@ -11,6 +11,7 @@
<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>

View File

@@ -41,29 +41,14 @@
<Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
<HintPath>packages\HandyControl.3.1.0\lib\net452\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>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Drawing.Common.5.0.2\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>packages\System.Drawing.Common.6.0.0-preview.3.21201.4\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@@ -96,6 +81,7 @@
<Compile Include="Util\ConsoleManager.cs" />
<Compile Include="Util\DragAdorner.cs" />
<Compile Include="Util\FileIcon.cs" />
<Compile Include="Util\HotKey.cs" />
<Compile Include="Util\ListViewDragDropManager.cs" />
<Compile Include="Util\MenuWidthConvert.cs" />
<Compile Include="Util\MouseUtilities.cs" />
@@ -117,6 +103,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Resource\Dictionary\GemetryDictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@@ -141,9 +131,18 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Resource\DefaultIconfont\iconfont.json" />
<Resource Include="Resource\DefaultIconfont\iconfont.ttf" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Resource\DefaultIconfont\iconfont.svg" />
<Resource Include="Resource\Image\Ico.png" />
<Resource Include="Resource\Image\Ico.ico" />
<Resource Include="Resource\Image\WindowLogo.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -9,33 +9,10 @@
xmlns:util="clr-namespace:GeekDesk.Util"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" x:Name="window"
xmlns:hc="https://handyorg.github.io/handycontrol"
Title="MainWindow" Height="500" Width="600">
Title="MainWindow" Height="500" Width="600"
>
<Window.Resources>
<Style TargetType="{x:Type TextBlock}" x:Key="memuStory">
<Style.Triggers>
<!--鼠标移入-->
<EventTrigger RoutedEvent="MouseMove">
<BeginStoryboard>
<Storyboard>
<!--鼠标移入放大-->
<DoubleAnimation To="20" Duration="0:0:0.001" Storyboard.TargetProperty="FontSize"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<!--鼠标移出-->
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<!--鼠标移出恢复正常大小-->
<DoubleAnimation To="15" Duration="0:0:0.001" Storyboard.TargetProperty="FontSize"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<!--左侧栏样式动画-->
<Style x:Key="menuStyle" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemBaseStyle}">
<Setter Property="FontSize" Value="15"/>
@@ -48,57 +25,50 @@
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsMouseOver" Value="False"/>
<Condition Property="IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="20" Duration="0:0:0.001" Storyboard.TargetProperty="FontSize"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="15" Duration="0:0:0.5" Storyboard.TargetProperty="FontSize"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard Timeline.DesiredFrameRate="30">
<DoubleAnimation To="20" Duration="0:0:0.001" Storyboard.TargetProperty="FontSize"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#C3C3C3"/>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="#B9B9B9"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
<BeginStoryboard x:Key="imageStoryboard">
<Storyboard>
<DoubleAnimation To="80" Duration="0:0:0.1" Storyboard.TargetProperty="Width"/>
<DoubleAnimation To="80" Duration="0:0:0.1" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
<!--右侧栏样式动画-->
<Style x:Key="imageStyle" TargetType="Image">
<Setter Property="Width" Value="60"/>
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="{Binding ImageWidth}"/>
<Setter Property="Height" Value="{Binding ImageHeight}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
<!--<DataTrigger Binding="{Binding ElementName=sv, Path=ComputedVerticalScrollBarVisibility}" Value="Visible">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="80" Duration="0:0:0.1" Storyboard.TargetProperty="Width"/>
<DoubleAnimation To="80" Duration="0:0:0.1" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>-->
<!--<MultiTrigger>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="{Binding RelativeSource={RelativeSource Mode=PreviousData}, Path=IsMouseOver}" Value="True"/>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="80" Duration="0:0:0.1" Storyboard.TargetProperty="Width"/>
<DoubleAnimation To="80" Duration="0:0:0.1" Storyboard.TargetProperty="Height"/>
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Width"/>
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
@@ -110,8 +80,8 @@
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>-->
</MultiTrigger>
</Style.Triggers>
</Style>
<util:MenuWidthConvert x:Key="MenuWidthConvert"/>
@@ -124,25 +94,49 @@
<Grid>
<!--背景图片-->
<Grid.Background>
<ImageBrush ImageSource="D:\壁纸\18078.jpg"></ImageBrush>
<ImageBrush ImageSource="D:\壁纸\18039.jpg" Opacity="0.618"></ImageBrush>
</Grid.Background>
<!--<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.5"/>
</Grid.Background>-->
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="leftColumn" MinWidth="80" Width="150" MaxWidth="200"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<DockPanel Grid.Row="0" Grid.Column="0">
<Label>Text</Label>
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
<Image Source="/Resource/Image/WindowLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
</DockPanel>
<StackPanel Grid.Row="0" Grid.Column="1" MouseMove="DragMove" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Background="Transparent"
BorderThickness="0"
hc:IconElement.Geometry="{StaticResource ODDataGeometry}"
hc:IconElement.Height="18"
hc:IconElement.Width="18"
HorizontalAlignment="Right"
/>
<Button Background="Transparent"
BorderThickness="0"
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
hc:IconElement.Height="18"
hc:IconElement.Width="18"
HorizontalAlignment="Right"
Click="CloseButtonClick"
/>
</StackPanel>
<!--左侧栏-->
<hc:Card Opacity="1" x:Name="leftCard" Grid.Row="1" Grid.Column="0"
<hc:Card x:Name="leftCard" Grid.Row="1" Grid.Column="0"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,5,0,5"
Opacity="0.5"
Margin="5,0,0,5"
>
<hc:Card.ContextMenu>
<ContextMenu Width="200">
@@ -150,7 +144,9 @@
</ContextMenu>
</hc:Card.ContextMenu>
<ListBox x:Name="menus" ItemsSource="{Binding MenuList}">
<ListBox x:Name="menus"
ItemsSource="{Binding MenuList}"
SelectionChanged="MenuClick">
<ListBox.Resources>
<ContextMenu x:Key="menuDialog" Width="200">
<MenuItem Header="新建菜单" Click="CreateMenu"/>
@@ -185,24 +181,43 @@
Tag="{Binding}"
IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding Path=MenuEdit, Converter={StaticResource VisibilityConvert}}"/>
<StackPanel Orientation="Horizontal">
<Button Background="Transparent"
BorderThickness="0"
hc:IconElement.Geometry="M805.677 218h100.323v540.3c0 0.072-0.972-0.3-1.696-0.3h-779.304v-561h401.869l3.867-1.982s230.651-131.583 285.375-162.778l-18.832 185.76h8.398zM246.395 562.149c0 45.515 37.029 82.543 82.543 82.543s82.543-37.029 82.543-82.543-37.029-82.543-82.543-82.543-82.543 37.028-82.543 82.543zM607.846 333.696c-25.872-10.699-59.908-16.494-95.837-16.494s-69.965 5.746-95.837 16.445c-41.257 17.061-47.416 40.353-47.416 52.353h33.591c0-5 8.343-13.687 26.661-21.263 21.579-8.924 51.832-13.945 83.001-13.945s61.421 4.971 83.001 13.896c18.317 7.576 26.661 16.312 26.661 21.312h33.591c-0.001-12-6.16-35.243-47.416-52.304zM695.078 479.606c-45.515 0-82.543 37.029-82.543 82.543s37.029 82.543 82.543 82.543c45.515 0 82.543-37.029 82.543-82.543s-37.028-82.543-82.543-82.543zM904.304 792h-784.765c-30.073 0-54.539-24.863-54.539-55.425v-517.298c0-30.561 24.466-55.277 54.539-55.277h398.429c34.254-20 284.848-162.442 292.86-167.011 5.582-3.184 10.775-4.768 15.874-4.767 7.977 0.001 14.871 3.852 19.076 10.598 2.903 4.656 4.221 10.346 4.221 17.432v143.748h54.304c30.356 0 54.697 24.716 54.697 55.277v517.298c0 30.562-24.341 55.425-54.696 55.425zM927 217.598c0-20.155-20.551-20.598-20.551-20.598h-89.449v-169.19l-0.685 4.759c-54.724 31.195-285.477 162.449-285.477 162.449l-3.969 1.982h-408.963c-11.132 0-19.906 9.466-19.906 20.598v521.497c0 11.131 8.774 19.905 19.905 19.905h7.095v-1h779.304c0.724 0 1.696 0.371 1.696 0.3v0.949c11 0 21-9.023 21-20.154v-521.497zM377.891 562.149c0 26.993-21.96 48.953-48.953 48.953-26.993 0-48.953-21.96-48.953-48.953 0-26.992 21.96-48.953 48.953-48.953 26.993 0 48.953 21.961 48.953 48.953zM411.482 562.149c0 45.515-37.029 82.543-82.543 82.543s-82.543-37.029-82.543-82.543 37.029-82.543 82.543-82.543 82.543 37.028 82.543 82.543zM279.986 562.149c0 26.993 21.96 48.953 48.953 48.953 26.992 0 48.953-21.96 48.953-48.953 0-26.992-21.96-48.953-48.953-48.953-26.993 0-48.953 21.961-48.953 48.953zM744.031 562.149c0 26.993-21.96 48.953-48.953 48.953s-48.953-21.96-48.953-48.953c0-26.992 21.96-48.953 48.953-48.953s48.953 21.961 48.953 48.953zM695.078 644.693c-45.515 0-82.543-37.029-82.543-82.543s37.029-82.543 82.543-82.543c45.515 0 82.543 37.029 82.543 82.543s-37.028 82.543-82.543 82.543zM646.126 562.149c0 26.993 21.96 48.953 48.953 48.953s48.953-21.96 48.953-48.953c0-26.992-21.96-48.953-48.953-48.953s-48.953 21.961-48.953 48.953zM595.009 364.737c-21.579-8.924-51.832-13.945-83.001-13.945s-61.421 4.971-83.001 13.896c-18.318 7.576-26.661 16.312-26.661 21.312h-33.591c0-12 6.16-35.243 47.415-52.304 25.873-10.699 59.908-16.494 95.837-16.494s69.965 5.746 95.837 16.445c41.258 17.061 47.417 40.353 47.417 52.353h-33.591c0.001-5-8.343-13.687-26.661-21.263zM125 759h-7.095c-11.131 0-19.905-8.774-19.905-19.905v-521.497c0-11.132 8.774-20.598 19.905-20.598h7.095v562zM906 759.249v-541.249h-108.721l19.036-185.65 0.685-4.54v169.19h89.449s20.551 0.443 20.551 20.598v521.497c0 11.131-10 20.154-21 20.154z"
hc:IconElement.Height="18"
hc:IconElement.Width="18"
/>
<TextBlock Text="{Binding MenuName}"
PreviewMouseLeftButtonDown="menuClick"
VerticalAlignment="Center"
IsVisibleChanged="MenuWhenVisibilityChanged"
Visibility="{Binding Path=NotMenuEdit, Converter={StaticResource VisibilityConvert}}"/>
Visibility="{Binding Path=NotMenuEdit, Converter={StaticResource VisibilityConvert}}"
/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</hc:Card>
<!--分割线-->
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
<!--右侧栏-->
<hc:Card AllowDrop="True" Drop="Wrap_Drop" Opacity="1" x:Name="rightCard" Grid.Row="1" Grid.Column="1" BorderThickness="1" Effect="{DynamicResource EffectShadow2}" Margin="5,5,5,5">
<hc:Card AllowDrop="True"
Drop="Wrap_Drop"
Opacity="0.5"
x:Name="rightCard"
Grid.Row="1"
Grid.Column="1"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,5,5">
<WrapPanel Orientation="Horizontal">
<ListBox x:Name="icons" ItemsSource="{Binding}"
BorderThickness="0"
SelectionChanged="data_SelectionChanged"
SelectionChanged="IconSelectionChanged"
>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
@@ -213,34 +228,30 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding}"
MouseLeftButtonDown="dataClick"
<StackPanel
MouseLeftButtonDown="IconClick"
HorizontalAlignment="Center"
Margin="5,5,5,5"
Height="115"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft"
MouseMove="StackPanel_MouseMove"
>
<Image x:Name="testImage" Style="{StaticResource imageStyle}"></Image>
<TextBlock Width="80" TextWrapping="Wrap" TextAlignment="Center" Height="35" LineHeight="15" FontSize="12" Text="{Binding Name}"/>
<!--<StackPanel.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
</DataTrigger>
</StackPanel.Triggers>-->
<Image Style="{StaticResource imageStyle}"></Image>
<TextBlock MaxWidth="80"
MaxHeight="40"
TextWrapping="Wrap"
TextTrimming="WordEllipsis"
TextAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Name}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</WrapPanel>
</hc:Card>
<hc:NotifyIcon Icon="/Resource/Image/Ico.png" Text="GeekDesk" Click="NotifyIcon_Click"/>
</Grid>
</Window>

View File

@@ -27,43 +27,32 @@ namespace GeekDesk
{
InitializeComponent();
loadData();
List<string> menuList = new List<string>();
Dictionary<string, List<IconInfo>> iconMap = new Dictionary<string, List<IconInfo>>();
//this.DataContext = mainModel;
//menu.Items = mainModel;
//System.Diagnostics.Process.Start(@"D:\SoftWare\WeGame\wegame.exe");
this.Loaded += Window_Loaded;
this.SizeChanged += MainWindow_Resize;
this.Topmost = true;
}
private void loadData()
{
this.DataContext = appData;
//menus.ItemsSource = appData.MenuList;
appData.MenuList.Add(new MenuInfo() { MenuName = "test1", MenuId = "1", MenuEdit = (int)Visibility.Collapsed });
if (appData.MenuList.Count == 0)
{
appData.MenuList.Add(new MenuInfo() { MenuName = "NewGouop", MenuId = System.Guid.NewGuid().ToString(), MenuEdit = (int)Visibility.Collapsed});
}
//窗体大小
this.Width = appData.AppConfig.WindowWidth;
this.Height = appData.AppConfig.WindowHeight;
ObservableCollection<IconInfo> iconList;
if (appData.IconMap.ContainsKey("1"))
{
iconList = appData.IconMap["1"];
}
else
{
iconList = new ObservableCollection<IconInfo>();
appData.IconMap.Add("1", iconList);
}
icons.ItemsSource = iconList;
//选中 菜单
menus.SelectedIndex = appData.AppConfig.SelectedMenuIndex;
//图标数据
icons.ItemsSource = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
}
#region
DelegateCommand<int[]> _swap;
public DelegateCommand<int[]> SwapCommand
{
@@ -94,7 +83,6 @@ namespace GeekDesk
}
DelegateCommand<int[]> _swap2;
public DelegateCommand<int[]> SwapCommand2
{
get
@@ -126,7 +114,7 @@ namespace GeekDesk
return _swap2;
}
}
#endregion
private void Wrap_Drop(object sender, DragEventArgs e)
@@ -144,18 +132,7 @@ namespace GeekDesk
iconInfo.Path = path;
iconInfo.BitmapImage = bi;
iconInfo.Name = Path.GetFileNameWithoutExtension(path);
ObservableCollection<IconInfo> iconList;
if (appData.IconMap.ContainsKey("1"))
{
iconList = appData.IconMap["1"];
}
else
{
iconList = new ObservableCollection<IconInfo>();
appData.IconMap.Add("1", iconList);
}
iconList.Add(iconInfo);
icons.ItemsSource = iconList;
appData.MenuList[menus.SelectedIndex].IconList.Add(iconInfo);
CommonCode.SaveAppData(appData);
}
@@ -166,15 +143,15 @@ namespace GeekDesk
}
}
icons.Items.Refresh();
}
//菜单点击事件
private void menuClick(object sender, MouseButtonEventArgs e)
private void MenuClick(object sender, SelectionChangedEventArgs e)
{
//设置对应菜单的图标列表
icons.ItemsSource = appData.MenuList[menus.SelectedIndex].IconList;
appData.AppConfig.SelectedMenuIndex = menus.SelectedIndex;
CommonCode.SaveAppData(appData);
}
@@ -184,7 +161,7 @@ namespace GeekDesk
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dataClick(object sender, MouseButtonEventArgs e)
private void IconClick(object sender, MouseButtonEventArgs e)
{
IconInfo icon = (IconInfo)((StackPanel)sender).Tag;
System.Diagnostics.Process.Start(icon.Path);
@@ -197,30 +174,26 @@ namespace GeekDesk
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void data_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void IconSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (icons.SelectedIndex != -1) icons.SelectedIndex = -1;
}
#region Window_Loaded
void Window_Loaded(object sender, RoutedEventArgs e)
{
//this.menus.Items.Add(new ViewModel.Menu() { menu = "test1" });
//this.menus.Items.Add(new ViewModel.Menu() { menu = "test2" });
//this.menus.Items.Add(new ViewModel.Menu() { menu = "test3" });
//加载完毕注册热键
Hotkey.Regist(this, HotkeyModifiers.MOD_CONTROL, Key.Y, ()=>
{
if (this.Visibility == Visibility.Collapsed)
{
this.Visibility = Visibility.Visible;
} else
{
this.Visibility = Visibility.Collapsed;
}
});
}
#endregion // Window_Loaded
//#region Window_Closing
//void Window_Closing(object sender, CancelEventArgs e)
//{
// Rect rect = this.RestoreBounds;
// AppConfig config = this.DataContext as AppConfig;
// config.WindowWidth = rect.Width;
// config.WindowHeight = rect.Height;
// CommonCode.SaveAppConfig(config);
//}
//#endregion // Window_Closing
void MainWindow_Resize(object sender, System.EventArgs e)
{
@@ -234,13 +207,6 @@ namespace GeekDesk
}
private void leftCard_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
}
/// <summary>
/// 删除菜单
/// </summary>
@@ -253,11 +219,12 @@ namespace GeekDesk
CommonCode.SaveAppData(appData);
}
private void StackPanel_MouseMove(object sender, MouseEventArgs e)
private void DragMove(object sender, MouseEventArgs e)
{
UIElementCollection childs = ((StackPanel)sender).Children;
IEnumerator iEnumerator = childs.GetEnumerator();
//((Image)iEnumerator.Current).Style;
if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
/// <summary>
@@ -346,11 +313,38 @@ namespace GeekDesk
/// <param name="e"></param>
private void CreateMenu(object sender, RoutedEventArgs e)
{
appData.MenuList.Add(new MenuInfo() { MenuEdit = (int)Visibility.Collapsed, MenuId = "zz", MenuName = "NewGouop" });
appData.MenuList.Add(new MenuInfo() { MenuEdit = (int)Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewGouop" });
menus.SelectedIndex = appData.MenuList.Count - 1;
//appData.MenuList[appData.MenuList.Count - 1].MenuEdit = (int)Visibility.Visible;
CommonCode.SaveAppData(appData);
}
/// <summary>
/// 关闭按钮单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CloseButtonClick(object sender, RoutedEventArgs e)
{
this.Visibility = Visibility.Collapsed;
}
/// <summary>
/// 图片图标单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
{
if (this.Visibility == Visibility.Collapsed)
{
this.Visibility = Visibility.Visible;
} else
{
this.Visibility = Visibility.Collapsed;
}
}
}

View File

@@ -0,0 +1,219 @@
{
"id": "2491374",
"name": "GeekIcon",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "13160269",
"name": "会话",
"font_class": "huihua",
"unicode": "e614",
"unicode_decimal": 58900
},
{
"icon_id": "14236852",
"name": "文件夹",
"font_class": "wenjianjia1",
"unicode": "e62e",
"unicode_decimal": 58926
},
{
"icon_id": "15416685",
"name": "文件夹",
"font_class": "wenjianjia2",
"unicode": "e606",
"unicode_decimal": 58886
},
{
"icon_id": "15711148",
"name": "系统",
"font_class": "xitong3",
"unicode": "e621",
"unicode_decimal": 58913
},
{
"icon_id": "18058019",
"name": "游戏",
"font_class": "game",
"unicode": "e681",
"unicode_decimal": 59009
},
{
"icon_id": "19977025",
"name": "系统",
"font_class": "xitong4",
"unicode": "e63e",
"unicode_decimal": 58942
},
{
"icon_id": "20017778",
"name": "人-翻墙",
"font_class": "ren-fanqiang",
"unicode": "e88c",
"unicode_decimal": 59532
},
{
"icon_id": "1250",
"name": "其它",
"font_class": "qita",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "397886",
"name": "开发,代码",
"font_class": "kaifa",
"unicode": "e618",
"unicode_decimal": 58904
},
{
"icon_id": "511314",
"name": "打开会话",
"font_class": "dakaihuihua",
"unicode": "e64a",
"unicode_decimal": 58954
},
{
"icon_id": "791886",
"name": "会话",
"font_class": "huihua-copy",
"unicode": "e647",
"unicode_decimal": 58951
},
{
"icon_id": "1033987",
"name": "游戏",
"font_class": "iconfontyouxihudong",
"unicode": "e636",
"unicode_decimal": 58934
},
{
"icon_id": "1119109",
"name": "系统",
"font_class": "xitong",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "1137788",
"name": "系统",
"font_class": "xitong1",
"unicode": "e67c",
"unicode_decimal": 59004
},
{
"icon_id": "1159887",
"name": "下载",
"font_class": "xiazai",
"unicode": "e617",
"unicode_decimal": 58903
},
{
"icon_id": "1629872",
"name": "文件夹",
"font_class": "icon-test",
"unicode": "e60e",
"unicode_decimal": 58894
},
{
"icon_id": "2006733",
"name": "会话",
"font_class": "xinxi",
"unicode": "e640",
"unicode_decimal": 58944
},
{
"icon_id": "2418266",
"name": "下载",
"font_class": "xiazai1",
"unicode": "e674",
"unicode_decimal": 58996
},
{
"icon_id": "2742683",
"name": "游戏",
"font_class": "youxi",
"unicode": "e680",
"unicode_decimal": 59008
},
{
"icon_id": "3879214",
"name": "网络",
"font_class": "wangluo",
"unicode": "e611",
"unicode_decimal": 58897
},
{
"icon_id": "3903356",
"name": "开发",
"font_class": "kaifa-",
"unicode": "e609",
"unicode_decimal": 58889
},
{
"icon_id": "7055665",
"name": "网络",
"font_class": "wangluo1",
"unicode": "e735",
"unicode_decimal": 59189
},
{
"icon_id": "8802631",
"name": "系统",
"font_class": "xitong2",
"unicode": "e648",
"unicode_decimal": 58952
},
{
"icon_id": "9712640",
"name": "下载",
"font_class": "xiazai2",
"unicode": "e6af",
"unicode_decimal": 59055
},
{
"icon_id": "9783461",
"name": "开发设计",
"font_class": "kaifasheji",
"unicode": "e613",
"unicode_decimal": 58899
},
{
"icon_id": "9924353",
"name": "其它",
"font_class": "qita1",
"unicode": "e60b",
"unicode_decimal": 58891
},
{
"icon_id": "9974441",
"name": "网络",
"font_class": "wangluo2",
"unicode": "e70b",
"unicode_decimal": 59147
},
{
"icon_id": "10294636",
"name": "开发",
"font_class": "developer",
"unicode": "e651",
"unicode_decimal": 58961
},
{
"icon_id": "11121465",
"name": "开发套件",
"font_class": "kaifataojian",
"unicode": "e63a",
"unicode_decimal": 58938
},
{
"icon_id": "11759969",
"name": "文件夹",
"font_class": "wenjianjia",
"unicode": "e7c2",
"unicode_decimal": 59330
}
]
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GeekDesk.Resource.Xaml">
<Geometry x:Key="ODDataGeometry">
M890.368 334.336c9.216 13.312 18.432 26.624 27.648 40.448 0.512 0 0.512 0.512 1.024 0.512l32.256-52.224c16.896-25.088 35.328-45.056 45.568-78.336 19.456-64.512-26.624-112.128-87.04-110.592-4.096 0.512-8.704 1.536-12.8 2.048-14.848 4.096-29.696 13.312-37.888 24.064-7.168 8.704-13.824 17.92-18.432 29.184-11.264 28.16-2.56 61.44 9.728 80.896 12.8 21.504 26.624 43.008 39.936 64zM881.152 209.92c5.632-17.92 17.408-21.504 34.304-28.16 53.248-1.024 54.272 74.752 5.12 81.92-25.088 3.584-47.616-28.16-39.424-53.76zM938.496 631.808c-46.592-30.72-93.696-60.928-140.288-91.648-15.872-10.752-32.256-22.016-48.128-32.768l-95.232-52.224c-16.896-9.728-36.864-18.432-50.176-31.744-0.512 0-0.512-0.512-1.024-0.512 63.488-13.312 129.536-13.824 196.096-25.088 34.304-4.096 68.096-7.68 102.4-11.776v-0.512c-5.12-7.168-19.968-27.136-27.648-30.72-8.704 0.512-17.408 1.536-25.6 2.048-30.72 2.048-61.952 3.584-92.672 5.632-24.064 3.584-48.64 0.512-74.24 4.608-71.68 6.656-143.872 13.312-215.552 19.456 32.256 25.088 65.024 50.176 97.28 74.752 34.816 23.04 72.192 41.472 105.984 65.536 43.008 33.28 86.016 66.56 128.512 100.352 0.512 0.512 0.512 1.024 1.024 1.536-103.424 6.656-206.848 13.312-309.76 19.456-20.992 1.024-41.984 2.048-62.464 2.56-25.6 4.096-49.152 5.12-72.704 9.728-11.264 1.536-22.528 3.584-34.304 5.12l-101.376 170.496c-0.512 0.512-0.512 1.024-1.024 1.536 114.688-25.088 233.472-44.032 349.696-70.144l188.928-33.792c89.088-15.36 178.688-30.72 267.776-46.08v-0.512c-28.672-17.92-56.832-36.864-85.504-55.296zM270.848 678.912c33.792-47.104 65.536-84.48 85.504-147.968 44.544-141.312-45.568-257.024-183.296-254.464-10.752 4.096-26.624 3.072-37.376 6.144-32.256 9.728-62.976 29.184-81.92 52.736-16.384 20.48-31.232 40.96-41.984 67.584C-12.8 465.92 5.12 532.48 32.768 577.536c31.744 51.712 64 102.4 98.304 151.552 18.432 27.136 36.352 54.272 54.784 80.896 0.512 0.512 1.024 0.512 1.536 1.024 11.264-18.432 22.528-36.864 34.304-55.296 16.384-26.112 31.744-52.224 49.152-76.8z m-166.912-89.6V387.584h68.096c19.968 0 35.84 1.536 48.128 4.096 12.288 3.072 23.552 7.68 33.28 14.336 14.336 9.728 25.6 21.504 33.792 36.352s12.288 30.208 12.288 46.592c0 15.872-3.072 30.208-9.216 44.032-6.144 13.312-15.36 25.088-26.624 35.328-8.704 7.168-18.432 12.288-29.696 15.872s-24.064 5.632-36.864 5.632l-93.184-0.512z
M223.232 433.664c-10.24-12.8-24.576-19.456-43.008-19.456h-19.456v147.456h19.456c18.432 0 33.28-6.656 43.008-19.456s15.36-31.232 15.36-54.784c0-22.528-5.12-40.96-15.36-53.76z
</Geometry>
</ResourceDictionary>

BIN
Resource/Image/Ico.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

BIN
Resource/Image/Ico.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

89
Util/HotKey.cs Normal file
View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
namespace GeekDesk.Util
{
class Hotkey
{
#region api
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);
[DllImport("user32.dll")]
static extern bool UnregisterHotKey(IntPtr hWnd, int id);
#endregion
/// <summary>
/// 注册快捷键
/// </summary>
/// <param name="window">持有快捷键窗口</param>
/// <param name="fsModifiers">组合键</param>
/// <param name="key">快捷键</param>
/// <param name="callBack">回调函数</param>
public static bool Regist(Window window, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
{
var hwnd = new WindowInteropHelper(window).Handle;
var _hwndSource = HwndSource.FromHwnd(hwnd);
_hwndSource.AddHook(WndProc);
int id = keyid++;
var vk = KeyInterop.VirtualKeyFromKey(key);
keymap[id] = callBack;
return RegisterHotKey(hwnd, id, fsModifiers, (uint)vk);
}
/// <summary>
/// 快捷键消息处理
/// </summary>
static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_HOTKEY)
{
int id = wParam.ToInt32();
if (keymap.TryGetValue(id, out var callback))
{
callback();
}
}
return IntPtr.Zero;
}
/// <summary>
/// 注销快捷键
/// </summary>
/// <param name="hWnd">持有快捷键窗口的句柄</param>
/// <param name="callBack">回调函数</param>
public static void UnRegist(IntPtr hWnd, HotKeyCallBackHanlder callBack)
{
foreach (KeyValuePair<int, HotKeyCallBackHanlder> var in keymap)
{
if (var.Value == callBack)
UnregisterHotKey(hWnd, var.Key);
}
}
const int WM_HOTKEY = 0x312;
static int keyid = 10;
static Dictionary<int, HotKeyCallBackHanlder> keymap = new Dictionary<int, HotKeyCallBackHanlder>();
public delegate void HotKeyCallBackHanlder();
}
enum HotkeyModifiers
{
MOD_ALT = 0x1,
MOD_CONTROL = 0x2,
MOD_SHIFT = 0x4,
MOD_WIN = 0x8
}
}

View File

@@ -14,10 +14,24 @@ namespace GeekDesk.ViewModel
private double windowWidth = (double)DefaultConstant.WINDOW_WIDTH; //窗口宽度
private double windowHeight = (double)DefaultConstant.WINDOW_HEIGHT; //窗口高度
private double menuCardWidth = (double)DefaultConstant.MENU_CARD_WIDHT;//菜单栏宽度
private int selectedMenuIndex = 0; //上次选中菜单索引
#region GetSet
public int SelectedMenuIndex
{
get
{
return selectedMenuIndex;
}
set
{
selectedMenuIndex = value;
OnPropertyChanged("SelectedMenuIndex");
}
}
public int MenuSortType
{
get

View File

@@ -9,7 +9,6 @@ namespace GeekDesk.ViewModel
class AppData : INotifyPropertyChanged
{
private ObservableCollection<MenuInfo> menuList = new ObservableCollection<MenuInfo>();
private Dictionary<string, ObservableCollection<IconInfo>> iconMap = new Dictionary<string, ObservableCollection<IconInfo>>();
private AppConfig appConfig = new AppConfig();
public ObservableCollection<MenuInfo> MenuList
@@ -25,18 +24,6 @@ namespace GeekDesk.ViewModel
}
}
public Dictionary<string, ObservableCollection<IconInfo>> IconMap
{
get
{
return iconMap;
}
set
{
iconMap = value;
OnPropertyChanged("IconMap");
}
}
public AppConfig AppConfig
{

View File

@@ -116,6 +116,21 @@ namespace GeekDesk.ViewModel
}
}
public int ImageHeight
{
get
{
return imageHeight;
}
set
{
imageHeight = value;
OnPropertyChanged("ImageHeight");
}
}
[field: NonSerializedAttribute()]

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
@@ -12,17 +13,13 @@ namespace GeekDesk.ViewModel
[Serializable]
class MenuInfo : INotifyPropertyChanged
{
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private string menuName;
private string menuId;
private int menuEdit = (int)Visibility.Collapsed;
private int notMenuEdit = (int)Visibility.Visible;
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
public string MenuName
{
@@ -82,5 +79,25 @@ namespace GeekDesk.ViewModel
OnPropertyChanged("NotMenuEdit");
}
}
public ObservableCollection<IconInfo> IconList
{
get
{
return iconList;
}
set
{
iconList = value;
OnPropertyChanged("IconList");
}
}
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -2,8 +2,5 @@
<packages>
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
<package id="HandyControl" version="3.1.0" targetFramework="net452" requireReinstallation="true" />
<package id="MvvmLight" version="5.4.1.1" targetFramework="net452" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="System.Drawing.Common" version="5.0.2" targetFramework="net472" />
<package id="System.Drawing.Common" version="6.0.0-preview.3.21201.4" targetFramework="net472" />
</packages>