Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d67d32b29 | ||
|
|
53481bf907 | ||
|
|
2673b9862c | ||
|
|
4c0a97b7b1 | ||
|
|
0a89255ad2 | ||
|
|
3c78b058cf | ||
|
|
9a5882ff98 | ||
|
|
69487b9383 | ||
|
|
0107ac8317 | ||
|
|
27e9b56b4d | ||
|
|
3c89d93cf7 | ||
|
|
1dc77da44e | ||
|
|
94f32fdb15 | ||
|
|
15a214aad0 | ||
|
|
67a3b0eddd | ||
|
|
71071a997f | ||
|
|
c2fca3e7aa | ||
|
|
488670a0fc | ||
|
|
14b2d77915 | ||
|
|
1839d310bc |
45
App.config
45
App.config
@@ -1,23 +1,46 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral"/>
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="Version" value="1.0-beta"/>
|
<add key="Version" value="2.1" />
|
||||||
|
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
||||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk"/>
|
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
||||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master"/>
|
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||||
|
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json"/>
|
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||||
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json"/>
|
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
<system.web>
|
||||||
|
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||||
|
<providers>
|
||||||
|
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||||
|
</providers>
|
||||||
|
</membership>
|
||||||
|
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||||
|
<providers>
|
||||||
|
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||||
|
</providers>
|
||||||
|
</roleManager>
|
||||||
|
</system.web>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -3,6 +3,7 @@ using Microsoft.Win32;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
|
|||||||
18
Constant/CommonEnum.cs
Normal file
18
Constant/CommonEnum.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/// <summary>
|
||||||
|
/// 默认参数
|
||||||
|
/// </summary>
|
||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public enum CommonEnum
|
||||||
|
{
|
||||||
|
WINDOW_WIDTH = 666, //默认窗体宽度
|
||||||
|
WINDOW_HEIGHT = 500, //默认窗体高度
|
||||||
|
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
|
||||||
|
IMAGE_WIDTH = 45, //默认图标宽度
|
||||||
|
IMAGE_HEIGHT = 45, //默认图标高度
|
||||||
|
IMAGE_WIDTH_AM = 52, //动画变换宽度
|
||||||
|
IMAGE_HEIGHT_AM = 52, //动画变换高度
|
||||||
|
IMAGE_PANEL_WIDTH = 110, //图标容器宽度
|
||||||
|
IMAGE_PANEL_HEIGHT = 90, //图标容器高度
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
14
Constant/IconType.cs
Normal file
14
Constant/IconType.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public enum IconType
|
||||||
|
{
|
||||||
|
OTHER = 1, //直接打开
|
||||||
|
URL = 2 //调用浏览器打开
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/// <summary>
|
|
||||||
/// 默认参数
|
|
||||||
/// </summary>
|
|
||||||
namespace GeekDesk.Constant
|
|
||||||
{
|
|
||||||
public enum MainWindowEnum
|
|
||||||
{
|
|
||||||
WINDOW_WIDTH = 666, //默认窗体宽度
|
|
||||||
WINDOW_HEIGHT = 500, //默认窗体高度
|
|
||||||
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
|
|
||||||
IMAGE_WIDTH = 60, //默认图标宽度
|
|
||||||
IMAGE_HEIGHT = 60, //默认图标高度
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
CornerRadius="4"
|
CornerRadius="4"
|
||||||
Width="300"
|
Width="300"
|
||||||
Height="300"
|
Height="300"
|
||||||
Opacity="0.9">
|
>
|
||||||
<Border.Resources>
|
<Border.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
<Setter Property="Width" Value="40"/>
|
<Setter Property="Width" Value="40"/>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Border.Resources>
|
</Border.Resources>
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
<SolidColorBrush Color="AliceBlue" Opacity="0.98"/>
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
<hc:SimplePanel Margin="10">
|
<hc:SimplePanel Margin="10">
|
||||||
<Grid Margin="8,20,8,20">
|
<Grid Margin="8,20,8,20">
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
||||||
<Button Content="保存" Command="hc:ControlCommands.Close" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
<Button Content="保存" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace GeekDesk.Control.Other
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class IconInfoDialog
|
public partial class IconInfoDialog
|
||||||
{
|
{
|
||||||
|
public HandyControl.Controls.Dialog dialog;
|
||||||
|
|
||||||
public IconInfoDialog()
|
public IconInfoDialog()
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,7 @@ namespace GeekDesk.Control.Other
|
|||||||
info.Name = IconName.Text;
|
info.Name = IconName.Text;
|
||||||
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
|
dialog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -47,7 +49,7 @@ namespace GeekDesk.Control.Other
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ReStoreImage(object sender, RoutedEventArgs e)
|
private void ReStoreImage(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
IconInfo info = ((Button)sender).Tag as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<Border x:Class="GeekDesk.Control.Other.MenuGeometryDialog"
|
<Border x:Class="GeekDesk.Control.Other.IconInfoUrlDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
CornerRadius="10"
|
CornerRadius="4"
|
||||||
Width="300"
|
Width="300"
|
||||||
Height="300"
|
Height="300"
|
||||||
Opacity="0.9">
|
>
|
||||||
<!--<Border.Resources>
|
<Border.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
<Setter Property="Width" Value="40"/>
|
<Setter Property="Width" Value="40"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
@@ -15,42 +15,31 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Border.Resources>
|
</Border.Resources>
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
<SolidColorBrush Color="AliceBlue" Opacity="0.98"/>
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
<hc:SimplePanel Margin="10">
|
<hc:SimplePanel Margin="10">
|
||||||
<Grid Margin="8,20,8,20">
|
<Grid Margin="8,20,8,20">
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="93*"/>
|
|
||||||
<ColumnDefinition Width="38*"/>
|
|
||||||
<ColumnDefinition Width="126*"/>
|
|
||||||
<ColumnDefinition Width="7*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||||
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,50,0,71" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,50,0,71" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,59,0,-9" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,77,0,-27">
|
||||||
|
<TextBlock Text="Url:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<TextBox x:Name="IconUrl" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,128,0,23" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,133,0,27">
|
||||||
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" Width="60" Height="60"/>
|
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" Width="60" Height="60"/>
|
||||||
<Button Content="修改" Click="EditImage"/>
|
<Button Content="修改" Click="EditImage"/>
|
||||||
<Button Content="重置" Click="ReStoreImage"/>
|
<Button Content="重置" Click="ReStoreImage"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,128,0,23" LineStroke="Black" Grid.ColumnSpan="4"/>
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,150,0,10" Grid.ColumnSpan="4">
|
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
|
||||||
<CheckBox.Background>
|
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</CheckBox.Background>
|
|
||||||
</CheckBox>
|
|
||||||
</hc:UniformSpacingPanel>
|
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
||||||
<Button Content="保存" Command="hc:ControlCommands.Close" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
<Button Content="保存" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
||||||
</hc:SimplePanel>-->
|
</hc:SimplePanel>
|
||||||
</Border>
|
</Border>
|
||||||
99
Control/Other/IconInfoUrlDialog.xaml.cs
Normal file
99
Control/Other/IconInfoUrlDialog.xaml.cs
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TextDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class IconInfoUrlDialog
|
||||||
|
{
|
||||||
|
public HandyControl.Controls.Dialog dialog;
|
||||||
|
|
||||||
|
private bool newIconInfo;
|
||||||
|
public IconInfoUrlDialog()
|
||||||
|
{
|
||||||
|
newIconInfo = true;
|
||||||
|
IconInfo info = new IconInfo
|
||||||
|
{
|
||||||
|
BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.URL_ICON_IMG_BASE64),
|
||||||
|
};
|
||||||
|
info.DefaultImage = info.ImageByteArr;
|
||||||
|
info.IconType = IconType.URL;
|
||||||
|
this.DataContext = info;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IconInfoUrlDialog(IconInfo info)
|
||||||
|
{
|
||||||
|
this.DataContext = info;
|
||||||
|
newIconInfo = false;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存修改属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SaveProperty(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
|
info.BitmapImage = IconImg.Source as BitmapImage;
|
||||||
|
info.Name = IconName.Text;
|
||||||
|
info.Path = IconUrl.Text;
|
||||||
|
if (newIconInfo)
|
||||||
|
{
|
||||||
|
MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList.Add(info);
|
||||||
|
}
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
|
dialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改图标为默认
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ReStoreImage(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改图标
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void EditImage(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Multiselect = false, //只允许选中单个文件
|
||||||
|
Filter = "所有文件(*.*)|*.*"
|
||||||
|
};
|
||||||
|
if (ofd.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
|
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
|
}
|
||||||
|
} catch (Exception)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
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.Other
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// MenuGeometryDialogxaml.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class MenuGeometryDialog
|
|
||||||
{
|
|
||||||
public MenuGeometryDialog()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,8 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20,50,20,20">
|
<Grid MouseDown="DragMove" Background="AliceBlue">
|
||||||
|
<hc:SimplePanel Margin="20,50,20,20" >
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
||||||
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
|
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
|
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
<!--<hc:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
||||||
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||||
@@ -71,8 +72,10 @@
|
|||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
||||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>-->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -31,5 +31,18 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
||||||
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20">
|
<Grid Background="AliceBlue" MouseDown="DragMove">
|
||||||
|
<hc:SimplePanel Margin="20" >
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
@@ -81,5 +82,7 @@
|
|||||||
</hc:UniformSpacingPanel>-->
|
</hc:UniformSpacingPanel>-->
|
||||||
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
|
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -229,6 +229,19 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//private void ShowApp(MainWindow mainWindow)
|
//private void ShowApp(MainWindow mainWindow)
|
||||||
//{
|
//{
|
||||||
// if (appConfig.FollowMouse)
|
// if (appConfig.FollowMouse)
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20">
|
<Grid MouseDown="DragMove" Background="AliceBlue">
|
||||||
|
<hc:SimplePanel Margin="20" >
|
||||||
<StackPanel >
|
<StackPanel >
|
||||||
<TextBlock Text="程序设置" />
|
<TextBlock Text="程序设置" />
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||||
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
|
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -26,8 +27,21 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<TextBlock Text="更新源" Margin="0,20,0,0"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
|
<CheckBox Content="性能模式" IsChecked="{Binding PMModel}"
|
||||||
|
hc:Poptip.HitMode="None"
|
||||||
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="开启性能模式将取消图标动画效果"
|
||||||
|
hc:Poptip.Placement="TopLeft">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<TextBlock Text="更新源" Margin="0,25,0,0"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||||
hc:IconElement.Geometry="{StaticResource Gitee}"
|
hc:IconElement.Geometry="{StaticResource Gitee}"
|
||||||
@@ -41,5 +55,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -33,5 +33,18 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
RegisterUtil.SetSelfStarting(appConfig.SelfStartUp, Constants.MY_NAME);
|
RegisterUtil.SetSelfStarting(appConfig.SelfStartUp, Constants.MY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,12 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="AliceBlue"
|
||||||
d:DesignHeight="380" d:DesignWidth="450">
|
d:DesignHeight="500" d:DesignWidth="450">
|
||||||
<hc:SimplePanel Margin="20">
|
|
||||||
|
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid MouseDown="DragMove" Background="AliceBlue">
|
||||||
|
<hc:SimplePanel Margin="20" >
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,-40,-12" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,-40,-12" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
@@ -97,6 +100,24 @@
|
|||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,341.5,0,-215.5" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,354,-40,-388.313" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
|
||||||
|
<Button Content="选择" Click="ColorButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<StackPanel x:Name="ColorPanel" Visibility="Collapsed" VerticalAlignment="Center">
|
||||||
|
<StackPanel.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
||||||
|
</StackPanel.Background>
|
||||||
|
<hc:ColorPicker
|
||||||
|
Name="ColorPicker"
|
||||||
|
Canceled="ColorPicker_Canceled"
|
||||||
|
SelectedColorChanged="ColorPicker_SelectedColorChanged"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
public ThemeControl()
|
public ThemeControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -35,7 +37,6 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void BGButton_Click(object sender, RoutedEventArgs e)
|
private void BGButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -56,5 +57,35 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ColorPanel.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ColorPicker_Canceled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ColorPanel.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
SolidColorBrush scb = ColorPicker.SelectedBrush;
|
||||||
|
appConfig.TextColor = scb.ToString();
|
||||||
|
ColorPanel.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<!--左侧栏样式动画-->
|
<!--左侧栏样式动画-->
|
||||||
<Style x:Key="MenuStyle" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemBaseStyle}">
|
<Style x:Key="MenuStyle" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemBaseStyle}">
|
||||||
<Setter Property="FontSize" Value="15"/>
|
<Setter Property="FontSize" Value="16"/>
|
||||||
<Setter Property="Margin" Value="0,0,0,1"/>
|
<Setter Property="Margin" Value="0,0,0,1"/>
|
||||||
<Setter Property="Background">
|
<Setter Property="Background">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
</MultiTrigger.Conditions>
|
</MultiTrigger.Conditions>
|
||||||
<MultiTrigger.EnterActions>
|
<MultiTrigger.EnterActions>
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard Timeline.DesiredFrameRate="60">
|
||||||
<DoubleAnimation To="15" Duration="0:0:0.5" Storyboard.TargetProperty="FontSize"/>
|
<DoubleAnimation To="16" Duration="0:0:0.2" Storyboard.TargetProperty="FontSize"/>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</MultiTrigger.EnterActions>
|
</MultiTrigger.EnterActions>
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</MultiTrigger.ExitActions>
|
</MultiTrigger.ExitActions>
|
||||||
</MultiTrigger>
|
</MultiTrigger>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<!--<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="Background" Value="#FFE4DBDB"/>
|
<Setter Property="Background" Value="#FFE4DBDB"/>
|
||||||
</Trigger>
|
</Trigger>-->
|
||||||
<Trigger Property="IsSelected" Value="true">
|
<Trigger Property="IsSelected" Value="true">
|
||||||
<Setter Property="Background" Value="#FFECECEC"/>
|
<Setter Property="Background" Value="#FFECECEC"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
SelectionChanged="menus_SelectionChanged"
|
SelectionChanged="menus_SelectionChanged"
|
||||||
>
|
>
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="menuDialog" Width="200">
|
<ContextMenu x:Key="MenuDialog" Width="200">
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource menuDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
@@ -103,24 +103,24 @@
|
|||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="30" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
||||||
<StackPanel.Background>
|
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
|
|
||||||
</StackPanel.Background>
|
|
||||||
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
FontSize="15"
|
FontSize="16"
|
||||||
|
Height="25"
|
||||||
|
VerticalAlignment="Center"
|
||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
LostFocus="LostFocusOrEnterDown"
|
LostFocus="LostFocusOrEnterDown"
|
||||||
KeyDown="LostFocusOrEnterDown"
|
KeyDown="LostFocusOrEnterDown"
|
||||||
Tag="{Binding}"
|
Tag="{Binding}"
|
||||||
|
Margin="2"
|
||||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||||
Visibility="{Binding MenuEdit}"/>
|
Visibility="{Binding MenuEdit}"/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
|||||||
@@ -11,43 +11,32 @@
|
|||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<!--右侧栏样式动画-->
|
<!--右侧栏样式动画-->
|
||||||
<Style x:Key="imageStyle" TargetType="Image">
|
<Style x:Key="ImageStyle" TargetType="Image">
|
||||||
<Setter Property="Width" Value="{Binding ImageWidth}"/>
|
<Setter Property="Width" Value="{Binding ImageWidth}"/>
|
||||||
<Setter Property="Height" Value="{Binding ImageHeight}"/>
|
<Setter Property="Height" Value="{Binding ImageHeight}"/>
|
||||||
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
||||||
<Style.Triggers>
|
<Setter Property="RenderOptions.BitmapScalingMode" Value="LowQuality" />
|
||||||
<MultiTrigger>
|
<Setter Property="RenderOptions.CachingHint" Value="Cache" />
|
||||||
<MultiTrigger.Conditions>
|
|
||||||
<Condition Property="IsMouseOver" Value="True"/>
|
</Style>
|
||||||
</MultiTrigger.Conditions>
|
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
||||||
<MultiTrigger.EnterActions>
|
<Setter Property="Template">
|
||||||
<BeginStoryboard>
|
<Setter.Value>
|
||||||
<Storyboard>
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||||
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Width"/>
|
<Border>
|
||||||
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Height"/>
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
</Storyboard>
|
</Border>
|
||||||
</BeginStoryboard>
|
</ControlTemplate>
|
||||||
</MultiTrigger.EnterActions>
|
</Setter.Value>
|
||||||
<MultiTrigger.ExitActions>
|
</Setter>
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Width"/>
|
|
||||||
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Height"/>
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</MultiTrigger.ExitActions>
|
|
||||||
</MultiTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<!--右侧栏-->
|
<!--右侧栏-->
|
||||||
<hc:Card AllowDrop="True"
|
<hc:Card AllowDrop="True"
|
||||||
Drop="Wrap_Drop"
|
Drop="Wrap_Drop"
|
||||||
|
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
||||||
@@ -57,57 +46,71 @@
|
|||||||
<hc:Card.BorderBrush>
|
<hc:Card.BorderBrush>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
</hc:Card.BorderBrush>
|
</hc:Card.BorderBrush>
|
||||||
|
<hc:Card.ContextMenu>
|
||||||
|
<ContextMenu Width="200">
|
||||||
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</hc:Card.ContextMenu>
|
||||||
<WrapPanel Orientation="Horizontal">
|
<WrapPanel Orientation="Horizontal">
|
||||||
<ListBox x:Name="icons" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
SelectionChanged="IconSelectionChanged "
|
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
|
||||||
>
|
>
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</ListBox.Background>
|
</ListBox.Background>
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="115" ItemsWidth="100" HorizontalAlignment="Center" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight}"
|
||||||
|
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth}"
|
||||||
|
Background="#00FFFFFF"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="iconDialog" Width="200">
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
<MenuItem Header="资源管理器菜单" Click="MenuItem_Click" Tag="{Binding}"/>
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource iconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Tag="{Binding}"
|
<StackPanel Tag="{Binding}"
|
||||||
MouseLeftButtonUp="IconClick"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight}"
|
||||||
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Margin="5,5,5,5"
|
|
||||||
hc:Poptip.HitMode="None"
|
hc:Poptip.HitMode="None"
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
hc:Poptip.Content="{Binding Content}"
|
hc:Poptip.Content="{Binding Content}"
|
||||||
hc:Poptip.Placement="BottomLeft"
|
hc:Poptip.Placement="BottomLeft"
|
||||||
|
Background="#00FFFFFF"
|
||||||
|
MouseLeftButtonUp="IconClick"
|
||||||
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
>
|
>
|
||||||
<Image Style="{StaticResource imageStyle}" />
|
<Image CacheMode="{Binding BitmapCache}" Style="{StaticResource ImageStyle}"/>
|
||||||
<TextBlock MaxWidth="80"
|
<TextBlock MaxWidth="80"
|
||||||
|
Margin="0,5,0,0"
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
|
FontSize="13"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
TextTrimming="WordEllipsis"
|
TextTrimming="WordEllipsis"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
Text="{Binding Name}"/>
|
Text="{Binding Name}"/>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using System.Windows.Data;
|
|||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
@@ -30,6 +31,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
public partial class RightCardControl : UserControl
|
public partial class RightCardControl : UserControl
|
||||||
{
|
{
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
public RightCardControl()
|
public RightCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -108,16 +110,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = icon.Path;
|
||||||
|
if (icon.IconType == IconType.OTHER)
|
||||||
|
{
|
||||||
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
|
||||||
Process p = new Process();
|
|
||||||
p.StartInfo.FileName = icon.Path;
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case IconStartType.ADMIN_STARTUP:
|
case IconStartType.ADMIN_STARTUP:
|
||||||
@@ -144,6 +146,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
p.Start();
|
p.Start();
|
||||||
icon.Count++;
|
icon.Count++;
|
||||||
}
|
}
|
||||||
@@ -154,15 +157,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// data选中事件 设置不可选中
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void IconSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (icons.SelectedIndex != -1) icons.SelectedIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void Wrap_Drop(object sender, DragEventArgs e)
|
private void Wrap_Drop(object sender, DragEventArgs e)
|
||||||
@@ -173,16 +167,33 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
string path = (string)obj;
|
string path = (string)obj;
|
||||||
|
|
||||||
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
|
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png);
|
||||||
|
|
||||||
|
string ext = System.IO.Path.GetExtension(path).ToLower();
|
||||||
|
|
||||||
|
if (".lnk".Equals(ext))
|
||||||
|
{
|
||||||
|
string targetPath = FileUtil.GetTargetPathByLnk(path);
|
||||||
|
if (targetPath!=null)
|
||||||
|
{
|
||||||
|
path = targetPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapImage bi = ImageUtil.GetBitmapIconByPath(path);
|
||||||
IconInfo iconInfo = new IconInfo
|
IconInfo iconInfo = new IconInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
BitmapImage = ImageUtil.GetBitmapIconByPath(path)
|
BitmapImage = bi
|
||||||
};
|
};
|
||||||
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
||||||
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path);
|
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||||
|
if (StringUtil.IsEmpty(iconInfo.Name))
|
||||||
|
{
|
||||||
|
iconInfo.Name = path;
|
||||||
|
}
|
||||||
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,13 +207,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Remove((IconInfo)((MenuItem)sender).Tag);
|
appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Remove((IconInfo)((MenuItem)sender).Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
private void SystemContextMenu(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||||
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
|
DirectoryInfo[] folders = new DirectoryInfo[1];
|
||||||
psi.Arguments = "/e,/select," + icon.Path;
|
folders[0] = new DirectoryInfo(icon.Path);
|
||||||
System.Diagnostics.Process.Start(psi);
|
ShellContextMenu scm = new ShellContextMenu();
|
||||||
|
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
|
||||||
|
p.X -= 80;
|
||||||
|
p.Y -= 80;
|
||||||
|
scm.ShowContextMenu(folders, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -212,7 +226,66 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void PropertyConfig(object sender, RoutedEventArgs e)
|
private void PropertyConfig(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Dialog.Show(new IconInfoDialog((IconInfo)((MenuItem)sender).Tag));
|
IconInfo info = (IconInfo)((MenuItem)sender).Tag;
|
||||||
|
switch (info.IconType)
|
||||||
|
{
|
||||||
|
case IconType.URL:
|
||||||
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
|
||||||
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
IconInfoDialog dialog = new IconInfoDialog(info);
|
||||||
|
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
ImgStroyBoard(sender, (int)CommonEnum.IMAGE_HEIGHT_AM, (int)CommonEnum.IMAGE_WIDTH_AM, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
ImgStroyBoard(sender, (int)CommonEnum.IMAGE_HEIGHT, (int)CommonEnum.IMAGE_WIDTH, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ImgStroyBoard(object sender, int height, int width, int milliseconds)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (appData.AppConfig.PMModel) return;
|
||||||
|
|
||||||
|
StackPanel sp = sender as StackPanel;
|
||||||
|
|
||||||
|
Image img = sp.Children[0] as Image;
|
||||||
|
|
||||||
|
|
||||||
|
DoubleAnimation heightAnimation = new DoubleAnimation();
|
||||||
|
DoubleAnimation widthAnimation = new DoubleAnimation();
|
||||||
|
|
||||||
|
heightAnimation.From = img.Height;
|
||||||
|
widthAnimation.From = img.Width;
|
||||||
|
|
||||||
|
heightAnimation.To = height;
|
||||||
|
widthAnimation.To = width;
|
||||||
|
|
||||||
|
heightAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
|
||||||
|
widthAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
|
||||||
|
|
||||||
|
|
||||||
|
Timeline.SetDesiredFrameRate(heightAnimation, 60);
|
||||||
|
Timeline.SetDesiredFrameRate(widthAnimation, 60);
|
||||||
|
|
||||||
|
img.BeginAnimation(HeightProperty, heightAnimation);
|
||||||
|
img.BeginAnimation(WidthProperty, widthAnimation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
||||||
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1">
|
<hc:ScrollViewer Grid.Row="0" Grid.Column="1">
|
||||||
<hc:Card x:Name="RightCard" Height="448" MouseDown="DragMove">
|
<hc:Card x:Name="RightCard" Height="448">
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
</hc:ScrollViewer>
|
</hc:ScrollViewer>
|
||||||
|
|
||||||
|
|||||||
@@ -31,18 +31,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点击关闭按钮
|
/// 点击关闭按钮
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
|
|
||||||
namespace GeekDesk.Control.Windows
|
namespace GeekDesk.Control.Windows
|
||||||
{
|
{
|
||||||
@@ -132,6 +132,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
window = new IconfontWindow(listInfo, menuInfo);
|
window = new IconfontWindow(listInfo, menuInfo);
|
||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
|
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
DateTime dt;
|
||||||
if (Title.Text.Trim() == "" || ExeTime.Text.Trim() == "")
|
if (Title.Text.Trim() == "" || ExeTime.Text.Trim() == "")
|
||||||
{
|
{
|
||||||
Growl.Warning("任务标题 和 待办时间不能为空!");
|
Growl.Warning("任务标题 和 待办时间不能为空!");
|
||||||
@@ -89,7 +89,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Convert.ToDateTime(ExeTime.Text);
|
dt = Convert.ToDateTime(ExeTime.Text);
|
||||||
} catch (Exception)
|
} catch (Exception)
|
||||||
{
|
{
|
||||||
Growl.Warning("请输入正确的时间!");
|
Growl.Warning("请输入正确的时间!");
|
||||||
@@ -107,14 +107,32 @@ namespace GeekDesk.Control.Windows
|
|||||||
appData.ToDoList.Add(info);
|
appData.ToDoList.Add(info);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
int index =appData.ToDoList.IndexOf(info);
|
appData.HiToDoList.Remove(info);
|
||||||
appData.ToDoList.Remove(info);
|
|
||||||
info.Title = Title.Text;
|
info.Title = Title.Text;
|
||||||
info.Msg = Msg.Text;
|
info.Msg = Msg.Text;
|
||||||
info.ExeTime = ExeTime.Text;
|
info.ExeTime = ExeTime.Text;
|
||||||
info.DoneTime = DoneTime.Text;
|
info.DoneTime = null;
|
||||||
appData.ToDoList.Insert(index, info);
|
appData.ToDoList.Add(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateTime dtNow = DateTime.Now;
|
||||||
|
TimeSpan ts = dt.Subtract(dtNow);
|
||||||
|
int minutes = (int)Math.Ceiling(ts.TotalMinutes);
|
||||||
|
if (minutes < 0)
|
||||||
|
{
|
||||||
|
minutes = 0;
|
||||||
|
}
|
||||||
|
if (minutes > 60)
|
||||||
|
{
|
||||||
|
int m = minutes % 60;
|
||||||
|
int h = minutes / 60;
|
||||||
|
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
||||||
|
}
|
||||||
|
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ namespace GeekDesk.Converts
|
|||||||
{
|
{
|
||||||
if (value != null && value.ToString().Length > 0)
|
if (value != null && value.ToString().Length > 0)
|
||||||
{
|
{
|
||||||
return System.Convert.ToDouble(value.ToString()) - 10d;
|
if (parameter == null) parameter = 0.00;
|
||||||
|
double p = System.Convert.ToDouble(parameter.ToString());
|
||||||
|
return System.Convert.ToDouble(value.ToString()) - p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -66,9 +67,10 @@
|
|||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Drawing.Common.6.0.0-preview.3.21201.4\lib\net461\System.Drawing.Common.dll</HintPath>
|
<HintPath>packages\System.Drawing.Common.6.0.0-preview.6.21352.12\lib\net461\System.Drawing.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -92,7 +94,8 @@
|
|||||||
<Compile Include="Command\DelegateCommandBase.cs" />
|
<Compile Include="Command\DelegateCommandBase.cs" />
|
||||||
<Compile Include="Constant\AppHideType.cs" />
|
<Compile Include="Constant\AppHideType.cs" />
|
||||||
<Compile Include="Constant\Constants.cs" />
|
<Compile Include="Constant\Constants.cs" />
|
||||||
<Compile Include="Constant\MainWindowEnum.cs" />
|
<Compile Include="Constant\IconType.cs" />
|
||||||
|
<Compile Include="Constant\CommonEnum.cs" />
|
||||||
<Compile Include="Constant\IconStartType.cs" />
|
<Compile Include="Constant\IconStartType.cs" />
|
||||||
<Compile Include="Constant\SortType.cs" />
|
<Compile Include="Constant\SortType.cs" />
|
||||||
<Compile Include="Constant\UpdateType.cs" />
|
<Compile Include="Constant\UpdateType.cs" />
|
||||||
@@ -102,6 +105,9 @@
|
|||||||
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
||||||
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
|
||||||
|
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\UserControls\Config\OtherControl.xaml.cs">
|
<Compile Include="Control\UserControls\Config\OtherControl.xaml.cs">
|
||||||
<DependentUpon>OtherControl.xaml</DependentUpon>
|
<DependentUpon>OtherControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -123,9 +129,6 @@
|
|||||||
<Compile Include="Control\Other\IconInfoDialog.xaml.cs">
|
<Compile Include="Control\Other\IconInfoDialog.xaml.cs">
|
||||||
<DependentUpon>IconInfoDialog.xaml</DependentUpon>
|
<DependentUpon>IconInfoDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Control\Other\MenuGeometryDialog.xaml.cs">
|
|
||||||
<DependentUpon>MenuGeometryDialog.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Control\UserControls\Config\AboutControl.xaml.cs">
|
<Compile Include="Control\UserControls\Config\AboutControl.xaml.cs">
|
||||||
<DependentUpon>AboutControl.xaml</DependentUpon>
|
<DependentUpon>AboutControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -161,6 +164,7 @@
|
|||||||
<Compile Include="Util\ConsoleManager.cs" />
|
<Compile Include="Util\ConsoleManager.cs" />
|
||||||
<Compile Include="Util\DragAdorner.cs" />
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
<Compile Include="Util\FileIcon.cs" />
|
<Compile Include="Util\FileIcon.cs" />
|
||||||
|
<Compile Include="Util\FileUtil.cs" />
|
||||||
<Compile Include="Util\HotKey.cs" />
|
<Compile Include="Util\HotKey.cs" />
|
||||||
<Compile Include="Util\HttpUtil.cs" />
|
<Compile Include="Util\HttpUtil.cs" />
|
||||||
<Compile Include="Util\ImageUtil.cs" />
|
<Compile Include="Util\ImageUtil.cs" />
|
||||||
@@ -169,9 +173,10 @@
|
|||||||
<Compile Include="Util\MouseUtil.cs" />
|
<Compile Include="Util\MouseUtil.cs" />
|
||||||
<Compile Include="Util\MouseUtilities.cs" />
|
<Compile Include="Util\MouseUtilities.cs" />
|
||||||
<Compile Include="Util\RegisterUtil.cs" />
|
<Compile Include="Util\RegisterUtil.cs" />
|
||||||
|
<Compile Include="Util\ShellContextMenu.cs" />
|
||||||
|
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||||
<Compile Include="Util\StringUtil.cs" />
|
<Compile Include="Util\StringUtil.cs" />
|
||||||
<Compile Include="Util\SvgToGeometry.cs" />
|
<Compile Include="Util\SvgToGeometry.cs" />
|
||||||
<Compile Include="Util\SystemIcon.cs" />
|
|
||||||
<Compile Include="ViewModel\AppConfig.cs" />
|
<Compile Include="ViewModel\AppConfig.cs" />
|
||||||
<Compile Include="ViewModel\AppData.cs" />
|
<Compile Include="ViewModel\AppData.cs" />
|
||||||
<Compile Include="ViewModel\ToDoInfo.cs" />
|
<Compile Include="ViewModel\ToDoInfo.cs" />
|
||||||
@@ -186,6 +191,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Control\Other\IconInfoUrlDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\UserControls\Config\OtherControl.xaml">
|
<Page Include="Control\UserControls\Config\OtherControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -214,10 +223,6 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Control\Other\MenuGeometryDialog.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Control\UserControls\Config\AboutControl.xaml">
|
<Page Include="Control\UserControls\Config\AboutControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -312,5 +317,16 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Taskbar.ico" />
|
<Resource Include="Taskbar.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<COMReference Include="IWshRuntimeLibrary">
|
||||||
|
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
|
||||||
|
<VersionMajor>1</VersionMajor>
|
||||||
|
<VersionMinor>0</VersionMinor>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<WrapperTool>tlbimp</WrapperTool>
|
||||||
|
<Isolated>False</Isolated>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
2
LICENSE.md
Normal file
2
LICENSE.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
||||||
|
- 商用需联系作者
|
||||||
@@ -18,6 +18,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
{
|
{
|
||||||
@@ -260,7 +261,7 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowAppAndFollowMouse();
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
mainWindow.Visibility = Visibility.Visible;
|
mainWindow.Visibility = Visibility.Visible;
|
||||||
@@ -268,55 +269,8 @@ namespace GeekDesk
|
|||||||
Keyboard.Focus(mainWindow);
|
Keyboard.Focus(mainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 随鼠标位置显示面板 (鼠标始终在中间)
|
|
||||||
/// </summary>
|
|
||||||
private static void ShowAppAndFollowMouse()
|
|
||||||
{
|
|
||||||
//获取鼠标位置
|
|
||||||
System.Windows.Point p = MouseUtil.GetMousePosition();
|
|
||||||
double left = SystemParameters.VirtualScreenLeft;
|
|
||||||
double top = SystemParameters.VirtualScreenTop;
|
|
||||||
double width = SystemParameters.VirtualScreenWidth;
|
|
||||||
double height = SystemParameters.VirtualScreenHeight;
|
|
||||||
double right = width - Math.Abs(left);
|
|
||||||
double bottom = height - Math.Abs(top);
|
|
||||||
|
|
||||||
|
|
||||||
if (p.X - mainWindow.Width / 2 < left)
|
|
||||||
{
|
|
||||||
//判断是否在最左边缘
|
|
||||||
mainWindow.Left = left;
|
|
||||||
}
|
|
||||||
else if (p.X + mainWindow.Width / 2 > right)
|
|
||||||
{
|
|
||||||
//判断是否在最右边缘
|
|
||||||
mainWindow.Left = right - mainWindow.Width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainWindow.Left = p.X - mainWindow.Width / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (p.Y - mainWindow.Height / 2 < top)
|
|
||||||
{
|
|
||||||
//判断是否在最上边缘
|
|
||||||
mainWindow.Top = top;
|
|
||||||
}
|
|
||||||
else if (p.Y + mainWindow.Height / 2 > bottom)
|
|
||||||
{
|
|
||||||
//判断是否在最下边缘
|
|
||||||
mainWindow.Top = bottom - mainWindow.Height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainWindow.Top = p.Y - mainWindow.Height / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.Visibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图片图标单击事件
|
/// 图片图标单击事件
|
||||||
|
|||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0")]
|
[assembly: AssemblyVersion("2.1")]
|
||||||
[assembly: AssemblyFileVersion("1.0")]
|
[assembly: AssemblyFileVersion("2.1")]
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
## 定时提醒 永不忘记
|
## 定时提醒 永不忘记
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WJU6df.gif" alt="WJU6df.gif" border="0" width="800px"/>
|
<img src="https://z3.ax1x.com/2021/07/19/WJU6df.gif" alt="WJU6df.gif" border="0" width="800px"/>
|
||||||
|
|
||||||
## Release
|
## LICENSE
|
||||||
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
||||||
- 商用需联系作者
|
- 商用需联系作者
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ namespace GeekDesk.Thread
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//等待1分钟后再检查更新 有的网络连接过慢
|
||||||
|
System.Threading.Thread.Sleep(60 * 1000);
|
||||||
|
|
||||||
string updateUrl;
|
string updateUrl;
|
||||||
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
||||||
switch (appConfig.UpdateType)
|
switch (appConfig.UpdateType)
|
||||||
@@ -57,7 +61,8 @@ namespace GeekDesk.Thread
|
|||||||
}
|
}
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(e.Message);
|
//不做处理
|
||||||
|
//MessageBox.Show(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
Update.json
10
Update.json
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title" : "<22>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
|
"title" : "<22>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
|
||||||
"subTitle" : "V1.0-beta",
|
"subTitle" : "V2.1 <20><>ʽ<EFBFBD><CABD>",
|
||||||
"msgTitle" : "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
"msgTitle" : "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
||||||
"msg" : "['<27><><EFBFBD>²<EFBFBD><EFBFBD><EFBFBD>1','<27><><EFBFBD>²<EFBFBD><EFBFBD><EFBFBD>23']",
|
"msg" : "['<27><><EFBFBD>ֳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD>ͼ<EFBFBD>깦<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>URL<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>']",
|
||||||
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag/1.0-beta",
|
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag/2.1",
|
||||||
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases/1.0-beta",
|
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases/2.1",
|
||||||
"version": "1.0-beta"
|
"version": "2.1"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 提取一些代码
|
/// 提取一些代码
|
||||||
@@ -53,6 +55,5 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
52
Util/DefaultIcons.cs
Normal file
52
Util/DefaultIcons.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public static class DefaultIcons
|
||||||
|
{
|
||||||
|
private static Icon folderIcon;
|
||||||
|
|
||||||
|
public static Icon FolderLarge => folderIcon ?? (folderIcon = GetStockIcon(SHGSI_ICON, SHGSI_LARGEICON));
|
||||||
|
|
||||||
|
public static Icon GetStockIcon(uint type, uint size)
|
||||||
|
{
|
||||||
|
var info = new SHSTOCKICONINFO();
|
||||||
|
info.cbSize = (uint)Marshal.SizeOf(info);
|
||||||
|
|
||||||
|
SHGetStockIconInfo(type, SHGSI_ICON | size, ref info);
|
||||||
|
|
||||||
|
var icon = (Icon)Icon.FromHandle(info.hIcon).Clone(); // Get a copy that doesn't use the original handle
|
||||||
|
DestroyIcon(info.hIcon); // Clean up native icon to prevent resource leak
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct SHSTOCKICONINFO
|
||||||
|
{
|
||||||
|
public uint cbSize;
|
||||||
|
public IntPtr hIcon;
|
||||||
|
public int iSysIconIndex;
|
||||||
|
public int iIcon;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
||||||
|
public string szPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("shell32.dll")]
|
||||||
|
public static extern int SHGetStockIconInfo(uint siid, uint uFlags, ref SHSTOCKICONINFO psii);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool DestroyIcon(IntPtr handle);
|
||||||
|
|
||||||
|
public static uint SHSIID_FOLDER = 0x3;
|
||||||
|
public static uint SHGSI_ICON = 0x100;
|
||||||
|
public static uint SHGSI_LARGEICON = 0x0;
|
||||||
|
public static uint SHGSI_SMALLICON = 0x1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using IWshRuntimeLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -6,20 +8,61 @@ using System.Windows.Media.Imaging;
|
|||||||
|
|
||||||
namespace GeekDesk.Util
|
namespace GeekDesk.Util
|
||||||
{
|
{
|
||||||
class FileIcon
|
public class FileIcon
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static List<string> GetBlurExts()
|
||||||
public static Icon GetIcon(string filePath)
|
|
||||||
{
|
{
|
||||||
IntPtr hIcon = GetJumboIcon(GetIconIndex(filePath));
|
List<string> list = new List<string>();
|
||||||
Icon ico = Icon.FromHandle(hIcon);
|
list.Add(".exe");
|
||||||
return ico;
|
list.Add(".cer");
|
||||||
|
list.Add(".lnk");
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("User32.dll")]
|
||||||
|
public static extern int PrivateExtractIcons(
|
||||||
|
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
||||||
|
int nIconIndex, //从第几个图标开始获取
|
||||||
|
int cxIcon, //获取图标的尺寸x
|
||||||
|
int cyIcon, //获取图标的尺寸y
|
||||||
|
IntPtr[] phicon, //获取到的图标指针数组
|
||||||
|
int[] piconid, //图标对应的资源编号
|
||||||
|
int nIcons, //指定获取的图标数量,仅当文件类型为.exe 和 .dll时候可用
|
||||||
|
int flags //标志,默认0就可以,具体可以看LoadImage函数
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public static BitmapImage GetBitmapImage(string filePath)
|
public static BitmapImage GetBitmapImage(string filePath)
|
||||||
{
|
{
|
||||||
Icon ico = GetIcon(filePath);
|
Icon ico;
|
||||||
|
//选中文件中的图标总数
|
||||||
|
var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0);
|
||||||
|
//用于接收获取到的图标指针
|
||||||
|
IntPtr[] hIcons = new IntPtr[iconTotalCount];
|
||||||
|
//对应的图标id
|
||||||
|
int[] ids = new int[iconTotalCount];
|
||||||
|
//成功获取到的图标个数
|
||||||
|
var successCount = PrivateExtractIcons(filePath, 0, 256, 256, hIcons, ids, iconTotalCount, 0);
|
||||||
|
|
||||||
|
string ext = Path.GetExtension(filePath).ToLower();
|
||||||
|
|
||||||
|
IntPtr ip = IntPtr.Zero;
|
||||||
|
if (successCount > 0)
|
||||||
|
{
|
||||||
|
ip = hIcons[0];
|
||||||
|
ico = Icon.FromHandle(ip);
|
||||||
|
}
|
||||||
|
else if (GetBlurExts().Contains(ext))
|
||||||
|
{
|
||||||
|
ico = Icon.ExtractAssociatedIcon(filePath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ip = GetJumboIcon(GetIconIndex(filePath));
|
||||||
|
ico = Icon.FromHandle(ip);
|
||||||
|
}
|
||||||
|
|
||||||
Bitmap bmp = ico.ToBitmap();
|
Bitmap bmp = ico.ToBitmap();
|
||||||
MemoryStream strm = new MemoryStream();
|
MemoryStream strm = new MemoryStream();
|
||||||
bmp.Save(strm, System.Drawing.Imaging.ImageFormat.Png);
|
bmp.Save(strm, System.Drawing.Imaging.ImageFormat.Png);
|
||||||
@@ -28,10 +71,15 @@ namespace GeekDesk.Util
|
|||||||
strm.Seek(0, SeekOrigin.Begin);
|
strm.Seek(0, SeekOrigin.Begin);
|
||||||
bmpImage.StreamSource = strm;
|
bmpImage.StreamSource = strm;
|
||||||
bmpImage.EndInit();
|
bmpImage.EndInit();
|
||||||
|
if (ip != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Shell32.DestroyIcon(ip);
|
||||||
|
}
|
||||||
return bmpImage.Clone();
|
return bmpImage.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int GetIconIndex(string pszFile)
|
public static int GetIconIndex(string pszFile)
|
||||||
{
|
{
|
||||||
SHFILEINFO sfi = new SHFILEINFO();
|
SHFILEINFO sfi = new SHFILEINFO();
|
||||||
|
|||||||
32
Util/FileUtil.cs
Normal file
32
Util/FileUtil.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using IWshRuntimeLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class FileUtil
|
||||||
|
{
|
||||||
|
|
||||||
|
public static string GetTargetPathByLnk(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WshShell shell = new WshShell();
|
||||||
|
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
|
||||||
|
|
||||||
|
if (StringUtil.IsEmpty(shortcut.TargetPath))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return shortcut.TargetPath;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,8 +19,9 @@ namespace GeekDesk.Util
|
|||||||
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||||
//通过Web访问对象获取响应内容
|
//通过Web访问对象获取响应内容
|
||||||
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
|
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
|
||||||
|
|
||||||
//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
|
//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
|
||||||
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.GetEncoding("gbk"));
|
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
|
||||||
string returnStr = reader.ReadToEnd();//利用StreamReader就可以从响应内容从头读到尾
|
string returnStr = reader.ReadToEnd();//利用StreamReader就可以从响应内容从头读到尾
|
||||||
reader.Close();
|
reader.Close();
|
||||||
myResponse.Close();
|
myResponse.Close();
|
||||||
|
|||||||
95
Util/IconHelper.cs
Normal file
95
Util/IconHelper.cs
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class IconHelper
|
||||||
|
{
|
||||||
|
[DllImport("Shell32.dll")]
|
||||||
|
private static extern IntPtr SHGetFileInfo
|
||||||
|
(
|
||||||
|
string pszPath, //һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>Ļ<EFBFBD><C4BB>塣<EFBFBD><E5A1A3><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ע[1]
|
||||||
|
uint dwFileAttributes,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>uFlags<67>а<EFBFBD><D0B0><EFBFBD>SHGFI_USEFILEATTRIBUTES<45><53>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(һ<>㲻ʹ<E3B2BB><CAB9>)<29><><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3>浵<EFBFBD><E6B5B5>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC>ϵͳ<CFB5>ȡ<EFBFBD>
|
||||||
|
out SHFILEINFO psfi,
|
||||||
|
uint cbfileInfo,//<2F>ظ<F2B5A5B5><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD>ijߴ硣
|
||||||
|
SHGFI uFlags//<2F><><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF>ܵı<DCB5>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>Ԧ<EFBFBD><D4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ʵ<EFBFBD>ʵصõ<D8B5><C3B5><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct SHFILEINFO
|
||||||
|
{
|
||||||
|
public SHFILEINFO(bool b)
|
||||||
|
{
|
||||||
|
hIcon = IntPtr.Zero; iIcon = 0; dwAttributes = 0; szDisplayName = ""; szTypeName = "";
|
||||||
|
}
|
||||||
|
public IntPtr hIcon;//ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
public int iIcon;//ϵͳͼ<CDB3><CDBC><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
public uint dwAttributes; //<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
[MarshalAs(UnmanagedType.LPStr, SizeConst = 260)]
|
||||||
|
public string szDisplayName;//<2F>ļ<EFBFBD><C4BC><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD> <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>256<35><36>ANSI<53><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD><CCB7><EFBFBD>X:\<5C><>3<EFBFBD>ֽڣ<D6BD>259<35>ֽڣ<D6BD><DAA3>ټ<EFBFBD><D9BC>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>ֽڣ<D6BD><DAA3><EFBFBD>260
|
||||||
|
[MarshalAs(UnmanagedType.LPStr, SizeConst = 80)]
|
||||||
|
public string szTypeName;//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̶<EFBFBD>80<38>ֽ<EFBFBD>
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private enum SHGFI
|
||||||
|
{
|
||||||
|
SmallIcon = 0x00000001,
|
||||||
|
LargeIcon = 0x00000000,
|
||||||
|
Icon = 0x00000100,
|
||||||
|
DisplayName = 0x00000200,//Retrieve the display name for the file, which is the name as it appears in Windows Explorer. The name is copied to the szDisplayName member of the structure specified in psfi. The returned display name uses the long file name, if there is one, rather than the 8.3 form of the file name. Note that the display name can be affected by settings such as whether extensions are shown.
|
||||||
|
Typename = 0x00000400, //Retrieve the string that describes the file's type. The string is copied to the szTypeName member of the structure specified in psfi.
|
||||||
|
SysIconIndex = 0x00004000, //Retrieve the index of a system image list icon. If successful, the index is copied to the iIcon member of psfi. The return value is a handle to the system image list. Only those images whose indices are successfully copied to iIcon are valid. Attempting to access other images in the system image list will result in undefined behavior.
|
||||||
|
UseFileAttributes = 0x00000010 //Indicates that the function should not attempt to access the file specified by pszPath. Rather, it should act as if the file specified by pszPath exists with the file attributes passed in dwFileAttributes. This flag cannot be combined with the SHGFI_ATTRIBUTES, SHGFI_EXETYPE, or SHGFI_PIDL flags.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>չ<EFBFBD><D5B9><EFBFBD>õ<EFBFBD>ϵͳ<CFB5><CDB3>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName"><3E>ļ<EFBFBD><C4BC><EFBFBD>(<28>磺win.rar;setup.exe;temp.txt)</param>
|
||||||
|
/// <param name="largeIcon">ͼ<><CDBC><EFBFBD>Ĵ<EFBFBD>С</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Icon GetFileIcon(string fileName, bool largeIcon)
|
||||||
|
{
|
||||||
|
SHFILEINFO info = new SHFILEINFO(true);
|
||||||
|
int cbFileInfo = Marshal.SizeOf(info);
|
||||||
|
SHGFI flags;
|
||||||
|
if (largeIcon)
|
||||||
|
flags = SHGFI.Icon | SHGFI.LargeIcon | SHGFI.UseFileAttributes;
|
||||||
|
else
|
||||||
|
flags = SHGFI.Icon | SHGFI.SmallIcon | SHGFI.UseFileAttributes;
|
||||||
|
IntPtr IconIntPtr = SHGetFileInfo(fileName, 256, out info, (uint)cbFileInfo, flags);
|
||||||
|
if (IconIntPtr.Equals(IntPtr.Zero))
|
||||||
|
return null;
|
||||||
|
return Icon.FromHandle(info.hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ͼ<EFBFBD><CDBC>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>ͼ<><CDBC></returns>
|
||||||
|
public static Icon GetDirectoryIcon(string path, bool largeIcon)
|
||||||
|
{
|
||||||
|
SHFILEINFO _SHFILEINFO = new SHFILEINFO();
|
||||||
|
int cbFileInfo = Marshal.SizeOf(_SHFILEINFO);
|
||||||
|
SHGFI flags;
|
||||||
|
if (largeIcon)
|
||||||
|
flags = SHGFI.Icon | SHGFI.LargeIcon;
|
||||||
|
else
|
||||||
|
flags = SHGFI.Icon | SHGFI.SmallIcon;
|
||||||
|
|
||||||
|
IntPtr IconIntPtr = SHGetFileInfo(path, 256, out _SHFILEINFO, (uint)cbFileInfo, flags);
|
||||||
|
if (IconIntPtr.Equals(IntPtr.Zero))
|
||||||
|
return null;
|
||||||
|
Icon _Icon = Icon.FromHandle(_SHFILEINFO.hIcon);
|
||||||
|
return _Icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Util/IconUtil.cs
Normal file
17
Util/IconUtil.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class IconUtil
|
||||||
|
{
|
||||||
|
const string IID_IImageList = "46EB5926-582E-4017-9FDF-E8998DAA0950";
|
||||||
|
const string IID_IImageList2 = "192B9D83-50FC-457B-90A0-2B82A8B5DAE1";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -268,21 +268,13 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
public static BitmapImage Bitmap2BitmapImage(Bitmap bitmap)
|
public static BitmapImage Bitmap2BitmapImage(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
IntPtr hBitmap = bitmap.GetHbitmap();
|
MemoryStream ms = new MemoryStream();
|
||||||
BitmapImage retval;
|
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
|
||||||
try
|
BitmapImage bit3 = new BitmapImage();
|
||||||
{
|
bit3.BeginInit();
|
||||||
retval = (BitmapImage)Imaging.CreateBitmapSourceFromHBitmap(
|
bit3.StreamSource = ms;
|
||||||
hBitmap,
|
bit3.EndInit();
|
||||||
IntPtr.Zero,
|
return bit3;
|
||||||
Int32Rect.Empty,
|
|
||||||
BitmapSizeOptions.FromEmptyOptions());
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
DeleteObject(hBitmap);
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
72
Util/NativeMethods.cs
Normal file
72
Util/NativeMethods.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 保存文件信息的结构体
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||||
|
struct SHFILEINFO
|
||||||
|
{
|
||||||
|
public IntPtr hIcon;
|
||||||
|
public int iIcon;
|
||||||
|
public uint dwAttributes;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
||||||
|
public string szDisplayName;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
|
||||||
|
public string szTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
class NativeMethods
|
||||||
|
{
|
||||||
|
|
||||||
|
[DllImport("Shell32.dll", EntryPoint = "SHGetFileInfo", SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
|
public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbFileInfo, uint uFlags);
|
||||||
|
|
||||||
|
[DllImport("User32.dll", EntryPoint = "DestroyIcon")]
|
||||||
|
public static extern int DestroyIcon(IntPtr hIcon);
|
||||||
|
|
||||||
|
#region API 参数的常量定义
|
||||||
|
|
||||||
|
public const uint SHGFI_ICON = 0x100;
|
||||||
|
public const uint SHGFI_LARGEICON = 0x0; //大图标 32×32
|
||||||
|
public const uint SHGFI_SMALLICON = 0x1; //小图标 16×16
|
||||||
|
public const uint SHGFI_USEFILEATTRIBUTES = 0x10;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取文件类型的关联图标
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">文件类型的扩展名或文件的绝对路径</param>
|
||||||
|
/// <param name="isLargeIcon">是否返回大图标</param>
|
||||||
|
/// <returns>获取到的图标</returns>
|
||||||
|
static Icon GetIcon(string fileName, bool isLargeIcon)
|
||||||
|
{
|
||||||
|
SHFILEINFO shfi = new SHFILEINFO();
|
||||||
|
IntPtr hI;
|
||||||
|
|
||||||
|
if (isLargeIcon)
|
||||||
|
hI = NativeMethods.SHGetFileInfo(fileName, 0, ref shfi, (uint)Marshal.SizeOf(shfi), NativeMethods.SHGFI_ICON | NativeMethods.SHGFI_USEFILEATTRIBUTES | NativeMethods.SHGFI_LARGEICON);
|
||||||
|
else
|
||||||
|
hI = NativeMethods.SHGetFileInfo(fileName, 0, ref shfi, (uint)Marshal.SizeOf(shfi), NativeMethods.SHGFI_ICON | NativeMethods.SHGFI_USEFILEATTRIBUTES | NativeMethods.SHGFI_SMALLICON);
|
||||||
|
|
||||||
|
Icon icon = Icon.FromHandle(shfi.hIcon).Clone() as Icon;
|
||||||
|
|
||||||
|
NativeMethods.DestroyIcon(shfi.hIcon); //释放资源
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
1584
Util/ShellContextMenu.cs
Normal file
1584
Util/ShellContextMenu.cs
Normal file
File diff suppressed because it is too large
Load Diff
107
Util/ShowWindowFollowMouse.cs
Normal file
107
Util/ShowWindowFollowMouse.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class ShowWindowFollowMouse
|
||||||
|
{
|
||||||
|
|
||||||
|
public enum MousePosition
|
||||||
|
{
|
||||||
|
CENTER = 1,
|
||||||
|
LEFT_TOP = 2,
|
||||||
|
LEFT_BOTTOM = 3,
|
||||||
|
RIGHT_TOP = 4,
|
||||||
|
RIGHT_BOTTOM = 5,
|
||||||
|
LEFT_CENTER = 6,
|
||||||
|
RIGHT_CENTER = 7
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 随鼠标位置显示面板 (鼠标始终在中间)
|
||||||
|
/// </summary>
|
||||||
|
public static void Show(Window window, MousePosition position, double widthOffset, double heightOffset)
|
||||||
|
{
|
||||||
|
//获取鼠标位置
|
||||||
|
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||||
|
double left = SystemParameters.VirtualScreenLeft;
|
||||||
|
double top = SystemParameters.VirtualScreenTop;
|
||||||
|
double width = SystemParameters.VirtualScreenWidth;
|
||||||
|
double height = SystemParameters.VirtualScreenHeight;
|
||||||
|
double right = width - Math.Abs(left);
|
||||||
|
double bottom = height - Math.Abs(top);
|
||||||
|
|
||||||
|
double afterWidth;
|
||||||
|
double afterHeight;
|
||||||
|
|
||||||
|
switch (position)
|
||||||
|
{
|
||||||
|
|
||||||
|
case MousePosition.LEFT_BOTTOM:
|
||||||
|
afterWidth = 0;
|
||||||
|
afterHeight = window.Height;
|
||||||
|
break;
|
||||||
|
case MousePosition.LEFT_TOP:
|
||||||
|
afterWidth = 0;
|
||||||
|
afterHeight = 0;
|
||||||
|
break;
|
||||||
|
case MousePosition.LEFT_CENTER:
|
||||||
|
afterWidth = 0;
|
||||||
|
afterHeight = window.Height / 2;
|
||||||
|
break;
|
||||||
|
case MousePosition.RIGHT_BOTTOM:
|
||||||
|
afterWidth = window.Width;
|
||||||
|
afterHeight = window.Height;
|
||||||
|
break;
|
||||||
|
case MousePosition.RIGHT_TOP:
|
||||||
|
afterWidth = window.Width;
|
||||||
|
afterHeight = 0;
|
||||||
|
break;
|
||||||
|
case MousePosition.RIGHT_CENTER:
|
||||||
|
afterWidth = window.Width;
|
||||||
|
afterHeight = window.Height / 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
afterWidth = window.Width / 2;
|
||||||
|
afterHeight = window.Height / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
afterWidth += widthOffset;
|
||||||
|
afterHeight -= heightOffset;
|
||||||
|
|
||||||
|
if (p.X - afterWidth < left)
|
||||||
|
{
|
||||||
|
//判断是否在最左边缘
|
||||||
|
window.Left = left;
|
||||||
|
}
|
||||||
|
else if (p.X + afterWidth > right)
|
||||||
|
{
|
||||||
|
//判断是否在最右边缘
|
||||||
|
window.Left = right - window.Width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Left = p.X - afterWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (p.Y - afterHeight < top)
|
||||||
|
{
|
||||||
|
//判断是否在最上边缘
|
||||||
|
window.Top = top;
|
||||||
|
}
|
||||||
|
else if (p.Y + afterHeight > bottom)
|
||||||
|
{
|
||||||
|
//判断是否在最下边缘
|
||||||
|
window.Top = bottom - window.Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Top = p.Y - afterHeight;
|
||||||
|
}
|
||||||
|
window.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace GeekDesk.Util
|
|
||||||
{
|
|
||||||
class SystemIcon
|
|
||||||
{
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
|
||||||
public struct SHFILEINFO
|
|
||||||
{
|
|
||||||
public IntPtr hIcon;
|
|
||||||
public int iIcon;
|
|
||||||
public uint dwAttributes;
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
|
||||||
public string szDisplayName;
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
|
|
||||||
public string szTypeName;
|
|
||||||
}
|
|
||||||
[DllImport("Shell32.dll", EntryPoint = "SHGetFileInfo", SetLastError = true, CharSet = CharSet.Auto)]
|
|
||||||
public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbFileInfo, uint uFlags);
|
|
||||||
[DllImport("User32.dll", EntryPoint = "DestroyIcon")]
|
|
||||||
public static extern int DestroyIcon(IntPtr hIcon);
|
|
||||||
#region API 参数的常量定义
|
|
||||||
public enum FileInfoFlags : uint
|
|
||||||
{
|
|
||||||
SHGFI_ICON = 0x000000100, // get icon
|
|
||||||
SHGFI_DISPLAYNAME = 0x000000200, // get display name
|
|
||||||
SHGFI_TYPENAME = 0x000000400, // get type name
|
|
||||||
SHGFI_ATTRIBUTES = 0x000000800, // get attributes
|
|
||||||
SHGFI_ICONLOCATION = 0x000001000, // get icon location
|
|
||||||
SHGFI_EXETYPE = 0x000002000, // return exe type
|
|
||||||
SHGFI_SYSICONINDEX = 0x000004000, // get system icon index
|
|
||||||
SHGFI_LINKOVERLAY = 0x000008000, // put a link overlay on icon
|
|
||||||
SHGFI_SELECTED = 0x000010000, // show icon in selected state
|
|
||||||
SHGFI_ATTR_SPECIFIED = 0x000020000, // get only specified attributes
|
|
||||||
SHGFI_LARGEICON = 0x000000000, // get large icon
|
|
||||||
SHGFI_SMALLICON = 0x000000001, // get small icon
|
|
||||||
SHGFI_OPENICON = 0x000000002, // get open icon
|
|
||||||
SHGFI_SHELLICONSIZE = 0x000000004, // get shell size icon
|
|
||||||
SHGFI_PIDL = 0x000000008, // pszPath is a pidl
|
|
||||||
SHGFI_USEFILEATTRIBUTES = 0x000000010, // use passed dwFileAttribute
|
|
||||||
SHGFI_ADDOVERLAYS = 0x000000020, // apply the appropriate overlays
|
|
||||||
SHGFI_OVERLAYINDEX = 0x000000040 // Get the index of the overlay
|
|
||||||
}
|
|
||||||
public enum FileAttributeFlags : uint
|
|
||||||
{
|
|
||||||
FILE_ATTRIBUTE_READONLY = 0x00000001,
|
|
||||||
FILE_ATTRIBUTE_HIDDEN = 0x00000002,
|
|
||||||
FILE_ATTRIBUTE_SYSTEM = 0x00000004,
|
|
||||||
FILE_ATTRIBUTE_DIRECTORY = 0x00000010,
|
|
||||||
FILE_ATTRIBUTE_ARCHIVE = 0x00000020,
|
|
||||||
FILE_ATTRIBUTE_DEVICE = 0x00000040,
|
|
||||||
FILE_ATTRIBUTE_NORMAL = 0x00000080,
|
|
||||||
FILE_ATTRIBUTE_TEMPORARY = 0x00000100,
|
|
||||||
FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200,
|
|
||||||
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400,
|
|
||||||
FILE_ATTRIBUTE_COMPRESSED = 0x00000800,
|
|
||||||
FILE_ATTRIBUTE_OFFLINE = 0x00001000,
|
|
||||||
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000,
|
|
||||||
FILE_ATTRIBUTE_ENCRYPTED = 0x00004000
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
/// <summary>
|
|
||||||
/// 获取文件类型的关联图标
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fileName">文件类型的扩展名或文件的绝对路径</param>
|
|
||||||
/// <param name="isLargeIcon">是否返回大图标</param>
|
|
||||||
/// <returns>获取到的图标</returns>
|
|
||||||
public static Icon GetIcon(string fileName, bool isLargeIcon)
|
|
||||||
{
|
|
||||||
//SHFILEINFO shfi = new SHFILEINFO();
|
|
||||||
//IntPtr hI;
|
|
||||||
//if (isLargeIcon)
|
|
||||||
// hI = SHGetFileInfo(fileName, 0, ref shfi, (uint)Marshal.SizeOf(shfi), (uint)FileInfoFlags.SHGFI_ICON | (uint)FileInfoFlags.SHGFI_USEFILEATTRIBUTES | (uint)FileInfoFlags.SHGFI_LARGEICON);
|
|
||||||
//else
|
|
||||||
// hI = SHGetFileInfo(fileName, 0, ref shfi, (uint)Marshal.SizeOf(shfi), (uint)FileInfoFlags.SHGFI_ICON | (uint)FileInfoFlags.SHGFI_USEFILEATTRIBUTES | (uint)FileInfoFlags.SHGFI_SMALLICON);
|
|
||||||
//Icon icon = Icon.FromHandle(shfi.hIcon).Clone() as Icon;
|
|
||||||
//DestroyIcon(shfi.hIcon); //释放资源
|
|
||||||
|
|
||||||
//选中文件中的图标总数
|
|
||||||
//var iconTotalCount = PrivateExtractIcons(fileName, 0, 0, 0, null, null, 1, 0);
|
|
||||||
//用于接收获取到的图标指针
|
|
||||||
//IntPtr[] hIcons = new IntPtr[1];
|
|
||||||
////对应的图标id
|
|
||||||
//int[] ids = new int[1];
|
|
||||||
////成功获取到的图标个数
|
|
||||||
//int successCount = PrivateExtractIcons(fileName, 0, 0, 0, hIcons, ids, 1, 0);
|
|
||||||
//Icon ico = Icon.FromHandle(hIcons[0]);
|
|
||||||
//var myIcon = ico.ToBitmap();
|
|
||||||
//myIcon.Save("D:\\" + ids[0].ToString("000") + ".png", ImageFormat.Png);
|
|
||||||
IntPtr hIcon = FileIcon.GetJumboIcon(FileIcon.GetIconIndex(fileName));
|
|
||||||
//IntPtr hIcon = GetJumboIcon(GetIconIndex("*." + ext));
|
|
||||||
|
|
||||||
// from native to managed
|
|
||||||
Icon ico = Icon.FromHandle(hIcon);
|
|
||||||
string path = "D:\\test\\" + System.Guid.NewGuid().ToString() + ".png";
|
|
||||||
//using ( ico = (Icon)Icon.FromHandle(hIcon).Clone())
|
|
||||||
//{
|
|
||||||
// // save to file (or show in a picture box)
|
|
||||||
// ico.ToBitmap().Save(path, ImageFormat.Png);
|
|
||||||
//}
|
|
||||||
//FileIcon.Shell32.DestroyIcon(hIcon); // don't forget to cleanup
|
|
||||||
|
|
||||||
return ico;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 获取文件夹图标
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>图标</returns>
|
|
||||||
public static Icon GetDirectoryIcon(bool isLargeIcon)
|
|
||||||
{
|
|
||||||
SHFILEINFO _SHFILEINFO = new SHFILEINFO();
|
|
||||||
IntPtr _IconIntPtr;
|
|
||||||
if (isLargeIcon)
|
|
||||||
{
|
|
||||||
_IconIntPtr = SHGetFileInfo(@"", 0, ref _SHFILEINFO, (uint)Marshal.SizeOf(_SHFILEINFO), ((uint)FileInfoFlags.SHGFI_ICON | (uint)FileInfoFlags.SHGFI_LARGEICON));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_IconIntPtr = SHGetFileInfo(@"", 0, ref _SHFILEINFO, (uint)Marshal.SizeOf(_SHFILEINFO), ((uint)FileInfoFlags.SHGFI_ICON | (uint)FileInfoFlags.SHGFI_SMALLICON));
|
|
||||||
}
|
|
||||||
if (_IconIntPtr.Equals(IntPtr.Zero)) return null;
|
|
||||||
Icon _Icon = System.Drawing.Icon.FromHandle(_SHFILEINFO.hIcon);
|
|
||||||
return _Icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("User32.dll")]
|
|
||||||
public static extern int PrivateExtractIcons(
|
|
||||||
string lpszFile, //file name
|
|
||||||
int nIconIndex, //The zero-based index of the first icon to extract.
|
|
||||||
int cxIcon, //The horizontal icon size wanted.
|
|
||||||
int cyIcon, //The vertical icon size wanted.
|
|
||||||
IntPtr[] phicon, //(out) A pointer to the returned array of icon handles.
|
|
||||||
int[] piconid, //(out) A pointer to a returned resource identifier.
|
|
||||||
int nIcons, //The number of icons to extract from the file. Only valid when *.exe and *.dll
|
|
||||||
int flags //Specifies flags that control this function.
|
|
||||||
);
|
|
||||||
|
|
||||||
//[DllImport("User32.dll")]
|
|
||||||
//public static extern bool DestroyIcon(
|
|
||||||
// IntPtr hIcon //A handle to the icon to be destroyed. The icon must not be in use.
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
442
Util/WindowsThumbnailProvider.cs
Normal file
442
Util/WindowsThumbnailProvider.cs
Normal file
@@ -0,0 +1,442 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class WindowsThumbnailProvider
|
||||||
|
{
|
||||||
|
private struct RECT
|
||||||
|
{
|
||||||
|
public int Left;
|
||||||
|
public int Top;
|
||||||
|
public int Right;
|
||||||
|
public int Bottom;
|
||||||
|
}
|
||||||
|
private struct POINT
|
||||||
|
{
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
}
|
||||||
|
// Constants that we need in the function call
|
||||||
|
|
||||||
|
private const int SHGFI_ICON = 0x100;
|
||||||
|
|
||||||
|
private const int SHGFI_SMALLICON = 0x1;
|
||||||
|
|
||||||
|
private const int SHGFI_LARGEICON = 0x0;
|
||||||
|
|
||||||
|
private const int SHIL_JUMBO = 0x4;
|
||||||
|
private const int SHIL_EXTRALARGE = 0x2;
|
||||||
|
|
||||||
|
// This structure will contain information about the file
|
||||||
|
|
||||||
|
public struct SHFILEINFO
|
||||||
|
{
|
||||||
|
|
||||||
|
// Handle to the icon representing the file
|
||||||
|
|
||||||
|
public IntPtr hIcon;
|
||||||
|
|
||||||
|
// Index of the icon within the image list
|
||||||
|
|
||||||
|
public int iIcon;
|
||||||
|
|
||||||
|
// Various attributes of the file
|
||||||
|
|
||||||
|
public uint dwAttributes;
|
||||||
|
|
||||||
|
// Path to the file
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
|
|
||||||
|
public string szDisplayName;
|
||||||
|
|
||||||
|
// File type
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
|
||||||
|
|
||||||
|
public string szTypeName;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("Kernel32.dll")]
|
||||||
|
public static extern Boolean CloseHandle(IntPtr handle);
|
||||||
|
|
||||||
|
private struct IMAGELISTDRAWPARAMS
|
||||||
|
{
|
||||||
|
public int cbSize;
|
||||||
|
public IntPtr himl;
|
||||||
|
public int i;
|
||||||
|
public IntPtr hdcDst;
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int cx;
|
||||||
|
public int cy;
|
||||||
|
public int xBitmap; // x offest from the upperleft of bitmap
|
||||||
|
public int yBitmap; // y offset from the upperleft of bitmap
|
||||||
|
public int rgbBk;
|
||||||
|
public int rgbFg;
|
||||||
|
public int fStyle;
|
||||||
|
public int dwRop;
|
||||||
|
public int fState;
|
||||||
|
public int Frame;
|
||||||
|
public int crEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct IMAGEINFO
|
||||||
|
{
|
||||||
|
public IntPtr hbmImage;
|
||||||
|
public IntPtr hbmMask;
|
||||||
|
public int Unused1;
|
||||||
|
public int Unused2;
|
||||||
|
public RECT rcImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Private ImageList COM Interop (XP)
|
||||||
|
[ComImportAttribute()]
|
||||||
|
[GuidAttribute("46EB5926-582E-4017-9FDF-E8998DAA0950")]
|
||||||
|
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
//helpstring("Image List"),
|
||||||
|
interface IImageList
|
||||||
|
{
|
||||||
|
[PreserveSig]
|
||||||
|
int Add(
|
||||||
|
IntPtr hbmImage,
|
||||||
|
IntPtr hbmMask,
|
||||||
|
ref int pi);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int ReplaceIcon(
|
||||||
|
int i,
|
||||||
|
IntPtr hicon,
|
||||||
|
ref int pi);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int SetOverlayImage(
|
||||||
|
int iImage,
|
||||||
|
int iOverlay);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int Replace(
|
||||||
|
int i,
|
||||||
|
IntPtr hbmImage,
|
||||||
|
IntPtr hbmMask);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int AddMasked(
|
||||||
|
IntPtr hbmImage,
|
||||||
|
int crMask,
|
||||||
|
ref int pi);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int Draw(
|
||||||
|
ref IMAGELISTDRAWPARAMS pimldp);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int Remove(
|
||||||
|
int i);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetIcon(
|
||||||
|
int i,
|
||||||
|
int flags,
|
||||||
|
ref IntPtr picon);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetImageInfo(
|
||||||
|
int i,
|
||||||
|
ref IMAGEINFO pImageInfo);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int Copy(
|
||||||
|
int iDst,
|
||||||
|
IImageList punkSrc,
|
||||||
|
int iSrc,
|
||||||
|
int uFlags);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int Merge(
|
||||||
|
int i1,
|
||||||
|
IImageList punk2,
|
||||||
|
int i2,
|
||||||
|
int dx,
|
||||||
|
int dy,
|
||||||
|
ref Guid riid,
|
||||||
|
ref IntPtr ppv);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int Clone(
|
||||||
|
ref Guid riid,
|
||||||
|
ref IntPtr ppv);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetImageRect(
|
||||||
|
int i,
|
||||||
|
ref RECT prc);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetIconSize(
|
||||||
|
ref int cx,
|
||||||
|
ref int cy);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int SetIconSize(
|
||||||
|
int cx,
|
||||||
|
int cy);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetImageCount(
|
||||||
|
ref int pi);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int SetImageCount(
|
||||||
|
int uNewCount);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int SetBkColor(
|
||||||
|
int clrBk,
|
||||||
|
ref int pclr);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetBkColor(
|
||||||
|
ref int pclr);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int BeginDrag(
|
||||||
|
int iTrack,
|
||||||
|
int dxHotspot,
|
||||||
|
int dyHotspot);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int EndDrag();
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int DragEnter(
|
||||||
|
IntPtr hwndLock,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int DragLeave(
|
||||||
|
IntPtr hwndLock);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int DragMove(
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int SetDragCursorImage(
|
||||||
|
ref IImageList punk,
|
||||||
|
int iDrag,
|
||||||
|
int dxHotspot,
|
||||||
|
int dyHotspot);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int DragShowNolock(
|
||||||
|
int fShow);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetDragImage(
|
||||||
|
ref POINT ppt,
|
||||||
|
ref POINT pptHotspot,
|
||||||
|
ref Guid riid,
|
||||||
|
ref IntPtr ppv);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetItemFlags(
|
||||||
|
int i,
|
||||||
|
ref int dwFlags);
|
||||||
|
|
||||||
|
[PreserveSig]
|
||||||
|
int GetOverlayImage(
|
||||||
|
int iOverlay,
|
||||||
|
ref int piIndex);
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
///
|
||||||
|
/// SHGetImageList is not exported correctly in XP. See KB316931
|
||||||
|
/// http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q316931
|
||||||
|
/// Apparently (and hopefully) ordinal 727 isn't going to change.
|
||||||
|
///
|
||||||
|
[DllImport("shell32.dll", EntryPoint = "#727")]
|
||||||
|
private extern static int SHGetImageList(
|
||||||
|
int iImageList,
|
||||||
|
ref Guid riid,
|
||||||
|
out IImageList ppv
|
||||||
|
);
|
||||||
|
|
||||||
|
// The signature of SHGetFileInfo (located in Shell32.dll)
|
||||||
|
[DllImport("Shell32.dll")]
|
||||||
|
public static extern int SHGetFileInfo(string pszPath, int dwFileAttributes, ref SHFILEINFO psfi, int cbFileInfo, uint uFlags);
|
||||||
|
|
||||||
|
[DllImport("Shell32.dll")]
|
||||||
|
public static extern int SHGetFileInfo(IntPtr pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, int cbFileInfo, uint uFlags);
|
||||||
|
|
||||||
|
[DllImport("shell32.dll", SetLastError = true)]
|
||||||
|
static extern int SHGetSpecialFolderLocation(IntPtr hwndOwner, Int32 nFolder,
|
||||||
|
ref IntPtr ppidl);
|
||||||
|
|
||||||
|
[DllImport("user32")]
|
||||||
|
public static extern int DestroyIcon(IntPtr hIcon);
|
||||||
|
|
||||||
|
public struct pair
|
||||||
|
{
|
||||||
|
public System.Drawing.Icon icon { get; set; }
|
||||||
|
public IntPtr iconHandleToDestroy { set; get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int DestroyIcon2(IntPtr hIcon)
|
||||||
|
{
|
||||||
|
return DestroyIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BitmapSource bitmap_source_of_icon(System.Drawing.Icon ic)
|
||||||
|
{
|
||||||
|
var ic2 = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(ic.Handle,
|
||||||
|
System.Windows.Int32Rect.Empty,
|
||||||
|
System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
|
||||||
|
ic2.Freeze();
|
||||||
|
return ((BitmapSource)ic2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//public static BitmapSource SystemIcon(bool small, ShellLib.ShellApi.CSIDL csidl)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// IntPtr pidlTrash = IntPtr.Zero;
|
||||||
|
// int hr = SHGetSpecialFolderLocation(IntPtr.Zero, (int)csidl, ref pidlTrash);
|
||||||
|
// Debug.Assert(hr == 0);
|
||||||
|
|
||||||
|
// SHFILEINFO shinfo = new SHFILEINFO();
|
||||||
|
|
||||||
|
// uint SHGFI_USEFILEATTRIBUTES = 0x000000010;
|
||||||
|
|
||||||
|
// // Get a handle to the large icon
|
||||||
|
// uint flags;
|
||||||
|
// uint SHGFI_PIDL = 0x000000008;
|
||||||
|
// if (!small)
|
||||||
|
// {
|
||||||
|
// flags = SHGFI_PIDL | SHGFI_ICON | SHGFI_LARGEICON | SHGFI_USEFILEATTRIBUTES;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// flags = SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var res = SHGetFileInfo(pidlTrash, 0, ref shinfo, Marshal.SizeOf(shinfo), flags);
|
||||||
|
// Debug.Assert(res != 0);
|
||||||
|
|
||||||
|
// var myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
|
||||||
|
// Marshal.FreeCoTaskMem(pidlTrash);
|
||||||
|
// var bs = bitmap_source_of_icon(myIcon);
|
||||||
|
// myIcon.Dispose();
|
||||||
|
// bs.Freeze(); // importantissimo se no fa memory leak
|
||||||
|
// DestroyIcon(shinfo.hIcon);
|
||||||
|
// CloseHandle(shinfo.hIcon);
|
||||||
|
// return bs;
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
public static BitmapSource icon_of_path(string FileName, bool small, bool checkDisk, bool addOverlay)
|
||||||
|
{
|
||||||
|
SHFILEINFO shinfo = new SHFILEINFO();
|
||||||
|
|
||||||
|
uint SHGFI_USEFILEATTRIBUTES = 0x000000010;
|
||||||
|
uint SHGFI_LINKOVERLAY = 0x000008000;
|
||||||
|
|
||||||
|
uint flags;
|
||||||
|
if (small)
|
||||||
|
{
|
||||||
|
flags = SHGFI_ICON | SHGFI_SMALLICON;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags = SHGFI_ICON | SHGFI_LARGEICON;
|
||||||
|
}
|
||||||
|
if (!checkDisk)
|
||||||
|
flags |= SHGFI_USEFILEATTRIBUTES;
|
||||||
|
if (addOverlay)
|
||||||
|
flags |= SHGFI_LINKOVERLAY;
|
||||||
|
|
||||||
|
var res = SHGetFileInfo(FileName, 0, ref shinfo, Marshal.SizeOf(shinfo), flags);
|
||||||
|
if (res == 0)
|
||||||
|
{
|
||||||
|
throw (new System.IO.FileNotFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
var myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
|
||||||
|
|
||||||
|
var bs = bitmap_source_of_icon(myIcon);
|
||||||
|
myIcon.Dispose();
|
||||||
|
bs.Freeze(); // importantissimo se no fa memory leak
|
||||||
|
DestroyIcon(shinfo.hIcon);
|
||||||
|
CloseHandle(shinfo.hIcon);
|
||||||
|
return bs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Icon icon_of_path_large(string FileName, bool jumbo, bool checkDisk)
|
||||||
|
{
|
||||||
|
|
||||||
|
SHFILEINFO shinfo = new SHFILEINFO();
|
||||||
|
|
||||||
|
uint SHGFI_USEFILEATTRIBUTES = 0x000000010;
|
||||||
|
uint SHGFI_SYSICONINDEX = 0x4000;
|
||||||
|
|
||||||
|
int FILE_ATTRIBUTE_NORMAL = 0x80;
|
||||||
|
|
||||||
|
uint flags;
|
||||||
|
flags = SHGFI_SYSICONINDEX;
|
||||||
|
|
||||||
|
if (!checkDisk) // This does not seem to work. If I try it, a folder icon is always returned.
|
||||||
|
flags |= SHGFI_USEFILEATTRIBUTES;
|
||||||
|
|
||||||
|
var res = SHGetFileInfo(FileName, FILE_ATTRIBUTE_NORMAL, ref shinfo, Marshal.SizeOf(shinfo), flags);
|
||||||
|
if (res == 0)
|
||||||
|
{
|
||||||
|
throw (new System.IO.FileNotFoundException());
|
||||||
|
}
|
||||||
|
var iconIndex = shinfo.iIcon;
|
||||||
|
|
||||||
|
// Get the System IImageList object from the Shell:
|
||||||
|
Guid iidImageList = new Guid("46EB5926-582E-4017-9FDF-E8998DAA0950");
|
||||||
|
|
||||||
|
IImageList iml;
|
||||||
|
int size = jumbo ? SHIL_JUMBO : SHIL_EXTRALARGE;
|
||||||
|
var hres = SHGetImageList(size, ref iidImageList, out iml); // writes iml
|
||||||
|
//if (hres == 0)
|
||||||
|
//{
|
||||||
|
// throw (new System.Exception("Error SHGetImageList"));
|
||||||
|
//}
|
||||||
|
|
||||||
|
IntPtr hIcon = IntPtr.Zero;
|
||||||
|
int ILD_TRANSPARENT = 1;
|
||||||
|
hres = iml.GetIcon(iconIndex, ILD_TRANSPARENT, ref hIcon);
|
||||||
|
//if (hres == 0)
|
||||||
|
//{
|
||||||
|
// throw (new System.Exception("Error iml.GetIcon"));
|
||||||
|
//}
|
||||||
|
|
||||||
|
var myIcon = System.Drawing.Icon.FromHandle(hIcon);
|
||||||
|
var bs = bitmap_source_of_icon(myIcon);
|
||||||
|
myIcon.Dispose();
|
||||||
|
bs.Freeze(); // very important to avoid memory leak
|
||||||
|
//DestroyIcon(hIcon);
|
||||||
|
//CloseHandle(hIcon);
|
||||||
|
|
||||||
|
return myIcon;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,9 +19,9 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
|
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
|
||||||
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
|
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
|
||||||
private double windowWidth = (double)MainWindowEnum.WINDOW_WIDTH; //窗口宽度
|
private double windowWidth = (double)CommonEnum.WINDOW_WIDTH; //窗口宽度
|
||||||
private double windowHeight = (double)MainWindowEnum.WINDOW_HEIGHT; //窗口高度
|
private double windowHeight = (double)CommonEnum.WINDOW_HEIGHT; //窗口高度
|
||||||
private double menuCardWidth = (double)MainWindowEnum.MENU_CARD_WIDHT;//菜单栏宽度
|
private double menuCardWidth = (double)CommonEnum.MENU_CARD_WIDHT;//菜单栏宽度
|
||||||
private int selectedMenuIndex = 0; //上次选中菜单索引
|
private int selectedMenuIndex = 0; //上次选中菜单索引
|
||||||
private bool followMouse = true; //面板跟随鼠标 默认是
|
private bool followMouse = true; //面板跟随鼠标 默认是
|
||||||
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
|
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
|
||||||
@@ -56,9 +56,68 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
private bool selfStartUp = true; //开机自启动设置
|
private bool selfStartUp = true; //开机自启动设置
|
||||||
private bool selfStartUped = false; //是否已设置
|
private bool selfStartUped = false; //是否已设置
|
||||||
|
private bool pmModel = false; //性能模式
|
||||||
|
private string textColor = "#000000"; //字体颜色
|
||||||
|
private double imgPanelWidth = (double)CommonEnum.IMAGE_PANEL_WIDTH;
|
||||||
|
private double imgPanelHeight = (double)CommonEnum.IMAGE_PANEL_HEIGHT;
|
||||||
|
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
|
||||||
|
public double ImgPanelWidth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (imgPanelWidth == 0d) return (double)CommonEnum.IMAGE_PANEL_WIDTH;
|
||||||
|
return imgPanelWidth;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
imgPanelWidth = value;
|
||||||
|
OnPropertyChanged("ImgPanelWidth");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ImgPanelHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (imgPanelHeight == 0d) return (double)CommonEnum.IMAGE_PANEL_HEIGHT;
|
||||||
|
return imgPanelHeight;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
imgPanelHeight = value;
|
||||||
|
OnPropertyChanged("ImgPanelHeight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TextColor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (textColor == null) return "#000000";
|
||||||
|
return textColor;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
textColor = value;
|
||||||
|
OnPropertyChanged("TextColor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool PMModel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return pmModel;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
pmModel = value;
|
||||||
|
OnPropertyChanged("PMModel");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool SelfStartUped
|
public bool SelfStartUped
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,13 +20,28 @@ namespace GeekDesk.ViewModel
|
|||||||
private BitmapImage bitmapImage; //位图
|
private BitmapImage bitmapImage; //位图
|
||||||
private byte[] imageByteArr; //图片 byte数组
|
private byte[] imageByteArr; //图片 byte数组
|
||||||
private string content; //显示信息
|
private string content; //显示信息
|
||||||
private int imageWidth = (int)MainWindowEnum.IMAGE_WIDTH; //图片宽度
|
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
|
||||||
private int imageHeight = (int)MainWindowEnum.IMAGE_HEIGHT; //图片高度
|
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
|
||||||
private bool adminStartUp = false; //始终管理员方式启动 默认否
|
private bool adminStartUp = false; //始终管理员方式启动 默认否
|
||||||
private byte[] defaultImage; //默认图标
|
private byte[] defaultImage; //默认图标
|
||||||
|
|
||||||
|
private IconType iconType = IconType.OTHER;
|
||||||
|
|
||||||
|
|
||||||
|
public IconType IconType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (iconType == 0) return IconType.OTHER;
|
||||||
|
return iconType;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
iconType = value;
|
||||||
|
OnPropertyChanged("IconType");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] DefaultImage
|
public byte[] DefaultImage
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -141,7 +156,8 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return imageWidth;
|
// 为了兼容旧版 暂时使用默认
|
||||||
|
return (int)CommonEnum.IMAGE_WIDTH;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -154,7 +170,8 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return imageHeight;
|
// 为了兼容旧版 暂时使用默认
|
||||||
|
return (int)CommonEnum.IMAGE_HEIGHT;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
||||||
<package id="HandyControl" version="3.1.0" targetFramework="net472" />
|
<package id="HandyControl" version="3.1.0" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||||
<package id="System.Drawing.Common" version="6.0.0-preview.3.21201.4" targetFramework="net472" />
|
<package id="System.Drawing.Common" version="6.0.0-preview.6.21352.12" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user