Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56584e1c99 | ||
|
|
05b63d107d | ||
|
|
eaa37aacae | ||
|
|
0c9cd85b82 | ||
|
|
3e0d0c502b | ||
|
|
5a89b40244 | ||
|
|
0495b8a121 | ||
|
|
1ef3129017 | ||
|
|
ca3d6b50e3 | ||
|
|
683b4bc870 | ||
|
|
abdc4b6046 | ||
|
|
ff2a103682 | ||
|
|
9c687117f9 |
18
App.config
18
App.config
@@ -2,8 +2,6 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
|
||||
<section name="SystemBGs" type="System.Collections.ObjectModel.ObservableCollection" />
|
||||
<section name="GradientBGParam" type="GeekDesk.ViewModel.GradientBGParam" />
|
||||
</configSections>
|
||||
<SystemIcons>
|
||||
<add key="Calculator" value="计算器" />
|
||||
@@ -18,9 +16,6 @@
|
||||
<add key="CMD" value="命令行" />
|
||||
<add key="Services" value="服务" />
|
||||
</SystemIcons>
|
||||
<SystemBGs>
|
||||
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏"/>
|
||||
</SystemBGs>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
@@ -49,13 +44,12 @@
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="Version" value="2.4.15" />
|
||||
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
|
||||
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
|
||||
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />
|
||||
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
|
||||
<!--<add key="GiteeUpdateUrl" value="file:///C:/Users/Fei/Desktop/GeekDesk/Update.json" />-->
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="Version" value="2.4.13" />
|
||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
||||
<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="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
|
||||
18
App.xaml.cs
18
App.xaml.cs
@@ -1,8 +1,11 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace GeekDesk
|
||||
@@ -40,7 +43,6 @@ namespace GeekDesk
|
||||
void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。
|
||||
Mouse.OverrideCursor = null;
|
||||
LogUtil.WriteErrorLog(e, "未捕获异常!");
|
||||
if (Constants.DEV)
|
||||
{
|
||||
@@ -53,18 +55,6 @@ namespace GeekDesk
|
||||
LogUtil.WriteErrorLog(e, "严重异常!");
|
||||
MessageBox.Show("GeekDesk遇到未知问题崩溃!");
|
||||
}
|
||||
public static void DoEvents()
|
||||
{
|
||||
var frame = new DispatcherFrame();
|
||||
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new DispatcherOperationCallback(
|
||||
delegate (object f)
|
||||
{
|
||||
((DispatcherFrame)f).Continue = false;
|
||||
return null;
|
||||
}), frame);
|
||||
Dispatcher.PushFrame(frame);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/// <summary>
|
||||
/// 背景风格
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum BGStyle
|
||||
{
|
||||
ImgBac = 1, //图片
|
||||
GradientBac = 2 //渐变色
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
@@ -9,7 +13,7 @@ namespace GeekDesk.Constant
|
||||
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
|
||||
|
||||
// 是否为开发模式
|
||||
public static bool DEV = false;
|
||||
public static bool DEV = true;
|
||||
|
||||
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
||||
|
||||
@@ -22,7 +26,8 @@ namespace GeekDesk.Constant
|
||||
|
||||
public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
|
||||
|
||||
public static int SHADOW_WIDTH = 20;
|
||||
//阴影宽度
|
||||
public static readonly int SHADOW_WIDTH = 20;
|
||||
|
||||
//系统图标
|
||||
public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum HotKeyType
|
||||
{
|
||||
|
||||
Main = 0, //主窗口
|
||||
ToDo = 1, //待办任务
|
||||
ColorPicker = 2 //拾色器
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
/// <summary>
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// 图标应用启动方式
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
namespace GeekDesk.Constant
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum IconType
|
||||
{
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
internal class RunTimeStatus
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 查询框是否在工作
|
||||
/// </summary>
|
||||
public static bool SEARCH_BOX_SHOW = false;
|
||||
|
||||
/// <summary>
|
||||
/// 贴边隐藏后 以非鼠标经过方式触发显示
|
||||
/// </summary>
|
||||
public static bool MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否锁定主面板 锁定后 不执行隐藏动作
|
||||
/// </summary>
|
||||
public static bool LOCK_APP_PANEL = false;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum SearchType
|
||||
{
|
||||
HOT_KEY = 0, //快捷键
|
||||
KEY_DOWN = 1, //按下即搜
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
namespace GeekDesk.Constant
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum TodoTaskExecType
|
||||
{
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
/// <summary>
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// 更新源
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
|
||||
@@ -5,8 +5,18 @@ using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using Quartz;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
<Border x:Class="GeekDesk.Control.Other.GradientBGDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
CornerRadius="4"
|
||||
>
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<Grid Width="750"
|
||||
Height="550"
|
||||
Panel.ZIndex="0"
|
||||
MouseDown="DragMove"
|
||||
>
|
||||
<Grid.Background>
|
||||
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||
</Grid.Background>
|
||||
</Grid>
|
||||
<hc:TransitioningContentControl TransitionMode="Fade"
|
||||
Panel.ZIndex="99"
|
||||
Width="600"
|
||||
Height="400"
|
||||
Margin="0,-620,0,0">
|
||||
<Border Style="{StaticResource BorderBG}">
|
||||
<Grid>
|
||||
<ListBox x:Name="GradientBGs"
|
||||
ItemsSource="{Binding}"
|
||||
Background="Transparent"
|
||||
Margin="20,20,20,50"
|
||||
BorderThickness="0"
|
||||
>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Margin" Value="10"/>
|
||||
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Background="Transparent"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="4" Width="100" Height="100"
|
||||
MouseLeftButtonDown="BGBorder_MouseLeftButtonDown"
|
||||
Tag="{Binding}">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush>
|
||||
<GradientStop Offset="0" Color="{Binding Color1}"/>
|
||||
<GradientStop Offset="1" Color="{Binding Color2}"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<Border Width="100" Height="30" VerticalAlignment="Bottom">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="Gray" Opacity="0.4"/>
|
||||
</Border.Background>
|
||||
<TextBlock Text="{Binding Name}" TextAlignment="Center" VerticalAlignment="Center" FontSize="17" FontWeight="Bold" Foreground="White"/>
|
||||
</Border>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<Button Content="关闭" Style="{StaticResource Btn1}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</hc:TransitioningContentControl>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -1,52 +0,0 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
/// <summary>
|
||||
/// TextDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class GradientBGDialog
|
||||
{
|
||||
public HandyControl.Controls.Dialog dialog;
|
||||
|
||||
public GradientBGDialog()
|
||||
{
|
||||
this.DataContext = GradientBGParamList.GradientBGParams;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
dialog.Close();
|
||||
}
|
||||
|
||||
private void BGBorder_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
GradientBGParam bgParam = (sender as Border).Tag as GradientBGParam;
|
||||
MainWindow.appData.AppConfig.GradientBGParam = bgParam;
|
||||
BGSettingUtil.BGSetting();
|
||||
}
|
||||
|
||||
/// <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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
@@ -88,13 +89,12 @@ namespace GeekDesk.Control.Other
|
||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
} catch (Exception ex)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||
LogUtil.WriteErrorLog(ex, "修改图标失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<Border x:Class="GeekDesk.Control.Other.MyColorPickerDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
CornerRadius="4"
|
||||
>
|
||||
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<Grid Width="750"
|
||||
Height="550"
|
||||
Panel.ZIndex="0"
|
||||
MouseDown="DragMove"
|
||||
>
|
||||
<Grid.Background>
|
||||
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||
</Grid.Background>
|
||||
</Grid>
|
||||
<hc:ColorPicker x:Name="MyColorPicker"
|
||||
Panel.ZIndex="99"
|
||||
Margin="0,-500,0,0"
|
||||
Confirmed="MyColorPicker_Confirmed"
|
||||
Canceled="MyColorPicker_Canceled"
|
||||
ToggleButton.Checked="MyColorPicker_Checked"
|
||||
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Border>
|
||||
@@ -1,106 +0,0 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
|
||||
public enum ColorType
|
||||
{
|
||||
COLOR_1 = 1,
|
||||
COLOR_2 = 2,
|
||||
TEXT_COLOR = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TextDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MyColorPickerDialog
|
||||
{
|
||||
public static ColorType COLOR_TYPE = new ColorType();
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
public static HandyControl.Controls.Dialog dialog;
|
||||
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
|
||||
|
||||
private static ColorType colorType;
|
||||
|
||||
|
||||
public MyColorPickerDialog(string strType, string token)
|
||||
{
|
||||
InitializeComponent();
|
||||
switch (strType)
|
||||
{
|
||||
case "Color1":
|
||||
colorType = ColorType.COLOR_1; break;
|
||||
case "Color2":
|
||||
colorType = ColorType.COLOR_2; break;
|
||||
default:
|
||||
colorType = ColorType.TEXT_COLOR; break;
|
||||
}
|
||||
dialog = HandyControl.Controls.Dialog.Show(this, token);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MyColorPicker_Canceled(object sender, EventArgs e)
|
||||
{
|
||||
MyColorPickerClose(sender);
|
||||
}
|
||||
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||
{
|
||||
MyColorPickerClose(sender);
|
||||
}
|
||||
|
||||
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||
{
|
||||
SolidColorBrush scb = MyColorPicker.SelectedBrush;
|
||||
switch (colorType)
|
||||
{
|
||||
case ColorType.COLOR_1:
|
||||
appConfig.GradientBGParam.Color1 = scb.ToString(); break;
|
||||
case ColorType.COLOR_2:
|
||||
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
|
||||
default:
|
||||
appConfig.TextColor = scb.ToString(); break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 MyColorPicker_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
|
||||
|
||||
PixelColorPickerWindow colorPickerWindow = new PixelColorPickerWindow(MyColorPicker);
|
||||
colorPickerWindow.Show();
|
||||
}
|
||||
|
||||
private void MyColorPickerClose(object sender)
|
||||
{
|
||||
dialog.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="Transparent"
|
||||
@@ -23,17 +22,13 @@
|
||||
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||
|
||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Star"
|
||||
MouseEnter="SC_MouseEnter"
|
||||
MouseLeave="SC_MouseLeave"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://github.com/BookerLiu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#24292F"/>
|
||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Star"
|
||||
MouseEnter="SC_MouseEnter"
|
||||
MouseLeave="SC_MouseLeave"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://gitee.com/BookerLiu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#C71D23"/>
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#24292F"/>
|
||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Star"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#C71D23"/>
|
||||
|
||||
|
||||
</hc:UniformSpacingPanel>
|
||||
@@ -66,17 +61,9 @@
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
</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">
|
||||
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>-->
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Grid>
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
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;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.Constant;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
@@ -34,14 +45,5 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
Window.GetWindow(this).DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
private void SC_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Hand;
|
||||
}
|
||||
private void SC_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Arrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,13 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||
Background="Transparent"
|
||||
d:DesignHeight="450" d:DesignWidth="450">
|
||||
d:DesignHeight="300" d:DesignWidth="450">
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||
<cvt:SearchTypeConvert x:Key="SearchTypeConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid Background="Transparent" MouseDown="DragMove"
|
||||
>
|
||||
@@ -109,93 +105,34 @@
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="搜索方式" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="快捷键"
|
||||
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=0}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="按键即搜"
|
||||
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=1}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="热键设置" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
|
||||
<TextBlock Text="主面板:" VerticalAlignment="Center" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Tag="{x:Static cst:HotKeyType.Main}"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="170"
|
||||
Text="{Binding HotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
/>
|
||||
<CheckBox Content="启用"
|
||||
Click="EnableHotKey_Click"
|
||||
Tag="{x:Static cst:HotKeyType.Main}"
|
||||
IsChecked="{Binding EnableAppHotKey}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
Tag="Main"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="200"
|
||||
Text="{Binding HotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="待办任务:" Margin="0,5,0,0" Width="55"/>
|
||||
<TextBlock Text="新建待办:" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Tag="{x:Static cst:HotKeyType.ToDo}"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="170"
|
||||
Text="{Binding ToDoHotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
/>
|
||||
<CheckBox Content="启用"
|
||||
Click="EnableHotKey_Click"
|
||||
Tag="{x:Static cst:HotKeyType.ToDo}"
|
||||
IsChecked="{Binding EnableTodoHotKey}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="拾色器:" Margin="0,5,0,0" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Tag="{x:Static cst:HotKeyType.ColorPicker}"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="170"
|
||||
Text="{Binding ColorPickerHotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
/>
|
||||
<CheckBox Content="启用"
|
||||
Tag="{x:Static cst:HotKeyType.ColorPicker}"
|
||||
Click="EnableHotKey_Click"
|
||||
IsChecked="{Binding EnableColorPickerHotKey}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
Tag="ToDo"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="200"
|
||||
Text="{Binding ToDoHotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Data;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
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.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using static GeekDesk.Util.GlobalHotKey;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
@@ -35,130 +48,95 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
/// <param name="e"></param>
|
||||
private void HotKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
Console.WriteLine("downKey:" + e.Key.ToString());
|
||||
string tag = (sender as TextBox).Tag.ToString();
|
||||
|
||||
lock (this)
|
||||
Key downKey = e.Key;
|
||||
if (downKey == Key.System)
|
||||
{
|
||||
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||
downKey = e.SystemKey;
|
||||
}
|
||||
|
||||
Key downKey = e.Key;
|
||||
if (downKey == Key.System)
|
||||
bool main = false;
|
||||
if ("Main".Equals(tag))
|
||||
{
|
||||
main = true;
|
||||
}
|
||||
|
||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||
{
|
||||
if (hotkeyFinished)
|
||||
{
|
||||
downKey = e.SystemKey;
|
||||
}
|
||||
|
||||
if (!CheckIsEnable(hkType)) return;
|
||||
|
||||
|
||||
Console.WriteLine("prevKeyTemp:" + prevKeyTemp.ToString());
|
||||
|
||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||
{
|
||||
if (hotkeyFinished)
|
||||
if (main)
|
||||
{
|
||||
switch (hkType)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
appConfig.Hotkey = Key.None;
|
||||
appConfig.HotkeyStr = "";
|
||||
appConfig.HotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
|
||||
break;
|
||||
case HotKeyType.ToDo:
|
||||
appConfig.ToDoHotkey = Key.None;
|
||||
appConfig.ToDoHotkeyStr = "";
|
||||
appConfig.ToDoHotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
|
||||
break;
|
||||
case HotKeyType.ColorPicker:
|
||||
appConfig.ColorPickerHotkey = Key.None;
|
||||
appConfig.ColorPickerHotkeyStr = "";
|
||||
appConfig.ColorPickerHotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
|
||||
break;
|
||||
}
|
||||
hotkeyFinished = false;
|
||||
}
|
||||
|
||||
//首次按下按键
|
||||
if ((HotKeyType.Main == hkType && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
||||
|| (HotKeyType.ToDo == hkType && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0))
|
||||
|| (HotKeyType.ColorPicker == hkType && (appConfig.ColorPickerHotkeyStr == null || appConfig.ColorPickerHotkeyStr.Length == 0))
|
||||
)
|
||||
{
|
||||
if (CheckModifierKeys(downKey))
|
||||
{
|
||||
//辅助键
|
||||
switch (hkType)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
appConfig.HotkeyStr = GetKeyName(downKey);
|
||||
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
|
||||
break;
|
||||
case HotKeyType.ToDo:
|
||||
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
|
||||
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
|
||||
break;
|
||||
case HotKeyType.ColorPicker:
|
||||
appConfig.ColorPickerHotkeyStr = GetKeyName(downKey);
|
||||
appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
|
||||
break;
|
||||
}
|
||||
Console.WriteLine("进入设置" + downKey.ToString());
|
||||
prevKeyTemp = downKey;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
appConfig.Hotkey = 0;
|
||||
appConfig.HotkeyStr = "";
|
||||
appConfig.HotkeyModifiers = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//非首次按下 需要判断前一个键值是否为辅助键
|
||||
if (CheckModifierKeys(prevKeyTemp)
|
||||
&& ((downKey >= Key.A && downKey <= Key.Z)
|
||||
|| (downKey >= Key.F1 && downKey <= Key.F12)
|
||||
|| (downKey >= Key.D0 && downKey <= Key.D9)
|
||||
|| downKey == Key.Oem3
|
||||
))
|
||||
appConfig.ToDoHotkey = 0;
|
||||
appConfig.ToDoHotkeyStr = "";
|
||||
appConfig.ToDoHotkeyModifiers = 0;
|
||||
}
|
||||
hotkeyFinished = false;
|
||||
}
|
||||
//首次按下按键
|
||||
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
||||
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
|
||||
{
|
||||
if (CheckModifierKeys(downKey))
|
||||
{
|
||||
//辅助键
|
||||
if (main)
|
||||
{
|
||||
KeyUtil.KeyProp keyProp = new KeyUtil.KeyProp();
|
||||
KeyUtil.KeyToChar(downKey, ref keyProp, true);
|
||||
string downKeyStr = keyProp.character.ToString();
|
||||
//string downKeyStr = "";
|
||||
switch (hkType)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
appConfig.Hotkey = downKey;
|
||||
appConfig.HotkeyStr += downKeyStr;
|
||||
break;
|
||||
case HotKeyType.ToDo:
|
||||
appConfig.ToDoHotkey = downKey;
|
||||
appConfig.ToDoHotkeyStr += downKeyStr;
|
||||
break;
|
||||
case HotKeyType.ColorPicker:
|
||||
appConfig.ColorPickerHotkey = downKey;
|
||||
appConfig.ColorPickerHotkeyStr += downKeyStr;
|
||||
break;
|
||||
}
|
||||
prevKeyTemp = downKey;
|
||||
keysTemp.Add(e);
|
||||
appConfig.HotkeyStr = GetKeyName(downKey);
|
||||
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
|
||||
}
|
||||
else if (CheckModifierKeys(downKey))
|
||||
else
|
||||
{
|
||||
switch (hkType)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
appConfig.HotkeyStr += GetKeyName(downKey);
|
||||
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
|
||||
break;
|
||||
case HotKeyType.ToDo:
|
||||
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
|
||||
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
|
||||
break;
|
||||
case HotKeyType.ColorPicker:
|
||||
appConfig.ColorPickerHotkeyStr += GetKeyName(downKey);
|
||||
appConfig.ColorPickerHotkeyModifiers |= GetModifierKeys(downKey);
|
||||
break;
|
||||
}
|
||||
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
|
||||
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
|
||||
}
|
||||
prevKeyTemp = downKey;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//非首次按下 需要判断前一个键值是否为辅助键
|
||||
if (CheckModifierKeys(prevKeyTemp)
|
||||
&& ((downKey >= Key.A && downKey <= Key.Z)
|
||||
|| (downKey >= Key.F1 && downKey <= Key.F12)
|
||||
|| (downKey >= Key.D0 && downKey <= Key.D9)))
|
||||
{
|
||||
if (main)
|
||||
{
|
||||
appConfig.Hotkey = downKey;
|
||||
appConfig.HotkeyStr += downKey.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
appConfig.ToDoHotkey = downKey;
|
||||
appConfig.ToDoHotkeyStr += downKey.ToString();
|
||||
}
|
||||
prevKeyTemp = downKey;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
else if (CheckModifierKeys(downKey))
|
||||
{
|
||||
if (main)
|
||||
{
|
||||
appConfig.HotkeyStr += GetKeyName(downKey);
|
||||
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
|
||||
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
|
||||
}
|
||||
|
||||
prevKeyTemp = downKey;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
prevKeyTemp = downKey;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,9 +191,15 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
}
|
||||
|
||||
|
||||
//[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
private void HotKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
string tag = (sender as TextBox).Tag.ToString();
|
||||
bool main = false;
|
||||
if ("Main".Equals(tag))
|
||||
{
|
||||
main = true;
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
bool allKeyUp = true;
|
||||
@@ -234,55 +218,30 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
prevKeyTemp = Key.None;
|
||||
hotkeyFinished = true;
|
||||
|
||||
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||
if (!CheckIsEnable(hkType)) return;
|
||||
|
||||
switch (hkType)
|
||||
if (main)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
||||
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||
}
|
||||
MainWindow.RegisterHotKey(false);
|
||||
break;
|
||||
case HotKeyType.ToDo:
|
||||
if (MainWindow.toDoHotKeyId != -1)
|
||||
{
|
||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||
}
|
||||
MainWindow.RegisterCreateToDoHotKey(false);
|
||||
break;
|
||||
case HotKeyType.ColorPicker:
|
||||
if (MainWindow.colorPickerHotKeyId != -1)
|
||||
{
|
||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||
GlobalHotKey.Dispose(MainWindow.colorPickerHotKeyId);
|
||||
}
|
||||
MainWindow.RegisterColorPickerHotKey(false);
|
||||
break;
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
||||
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||
}
|
||||
MainWindow.RegisterHotKey(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainWindow.toDoHotKeyId != -1)
|
||||
{
|
||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||
}
|
||||
MainWindow.RegisterCreateToDoHotKey(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckIsEnable(HotKeyType hkType)
|
||||
{
|
||||
switch (hkType)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
return true == appConfig.EnableAppHotKey;
|
||||
case HotKeyType.ToDo:
|
||||
return true == appConfig.EnableTodoHotKey;
|
||||
case HotKeyType.ColorPicker:
|
||||
return true == appConfig.EnableColorPickerHotKey;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移动窗口
|
||||
/// </summary>
|
||||
@@ -336,55 +295,5 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用热键
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void EnableHotKey_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HotKeyType hkType = (HotKeyType)(sender as CheckBox).Tag;
|
||||
switch (hkType)
|
||||
{
|
||||
case HotKeyType.Main:
|
||||
if (true == appConfig.EnableAppHotKey)
|
||||
{
|
||||
MainWindow.RegisterHotKey(false);
|
||||
} else
|
||||
{
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HotKeyType.ToDo:
|
||||
if (true == appConfig.EnableTodoHotKey)
|
||||
{
|
||||
MainWindow.RegisterCreateToDoHotKey(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HotKeyType.ColorPicker:
|
||||
if (true == appConfig.EnableColorPickerHotKey)
|
||||
{
|
||||
MainWindow.RegisterColorPickerHotKey(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
GlobalHotKey.Dispose(MainWindow.colorPickerHotKeyId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||
<RadioButton x:Name="CustomSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="自定义"
|
||||
@@ -50,28 +50,28 @@
|
||||
hc:IconElement.Geometry="{StaticResource CustomSort}"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=1}"/>
|
||||
|
||||
|
||||
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
hc:IconElement.Geometry="{StaticResource UpSort}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
|
||||
Tag="2"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=2}"/>
|
||||
|
||||
|
||||
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
hc:IconElement.Geometry="{StaticResource LowSort}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
|
||||
Tag="3"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=3}"/>
|
||||
|
||||
|
||||
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
hc:IconElement.Geometry="{StaticResource UpSort}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="名称"
|
||||
Tag="4"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=4}"/>
|
||||
|
||||
|
||||
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
hc:IconElement.Geometry="{StaticResource LowSort}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="名称"
|
||||
@@ -96,6 +96,6 @@
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
@@ -16,7 +27,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += OtherControl_Loaded;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void OtherControl_Loaded(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -2,238 +2,157 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
mc:Ignorable="d"
|
||||
Background="Transparent"
|
||||
d:DesignHeight="500" d:DesignWidth="450">
|
||||
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
|
||||
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid Background="Transparent">
|
||||
<StackPanel Margin="20" >
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景风格" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
|
||||
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色"
|
||||
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<UniformGrid x:Name="ImgBGConf">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade"
|
||||
Height="130">
|
||||
<StackPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图片背景" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,15,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Center"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="{Binding BacImgName}"
|
||||
hc:Poptip.Placement="TopLeft"
|
||||
/>
|
||||
<Button Content="修改" Click="BGButton_Click"/>
|
||||
<Button Content="默认" Click="DefaultButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
|
||||
</UniformGrid>
|
||||
|
||||
<UniformGrid x:Name="GradientBGConf">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade"
|
||||
Height="130">
|
||||
<StackPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="纯色背景" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True}"
|
||||
TargetUpdated="Color_TargetUpdated"
|
||||
Width="65"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
<Button Content="设置" Tag="Color1" Click="ColorButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True}"
|
||||
TargetUpdated="Color_TargetUpdated"
|
||||
Width="65"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
<Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<Button Content="系统预设"
|
||||
Margin="0,5,0,0"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="{Binding GradientBGParam.Name, Converter={StaticResource StringAppendConvert}, ConverterParameter=当前设置: \{\}}"
|
||||
hc:Poptip.Placement="Top"
|
||||
Click="SysBG_Click"
|
||||
/>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UniformGrid>
|
||||
|
||||
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<StackPanel Margin="0,15,0,0">
|
||||
<Grid MouseDown="DragMove" Background="Transparent">
|
||||
<StackPanel Margin="20" >
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="卡片不透明度" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Center"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="{Binding BacImgName}"
|
||||
hc:Poptip.Placement="TopLeft"
|
||||
/>
|
||||
<Button Content="修改" Click="BGButton_Click"/>
|
||||
<Button Content="默认" Click="DefaultButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" IsChecked="{Binding BlurEffect}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
|
||||
<StackPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="托盘不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||
ValueChanged="BGOpacity_ValueChanged"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||
Minimum="50"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
||||
Maximum="25"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图标大小" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图标大小" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"
|
||||
Background="#00FFFFFF"
|
||||
PreviewMouseLeftButtonDown="PreviewSlider_MouseLeftButtonUp"
|
||||
>
|
||||
<hc:PreviewSlider Value="{Binding ImageWidth, Mode=TwoWay}"
|
||||
<hc:PreviewSlider Value="{Binding ImageWidth, Mode=TwoWay}"
|
||||
Minimum="40"
|
||||
Maximum="60"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
|
||||
<Button Content="选择" Margin="0,-10,0,0" Click="ColorButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
|
||||
<Button Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!--<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
||||
</Grid>
|
||||
|
||||
<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
||||
Visibility="Collapsed"
|
||||
Height="500"
|
||||
Width="450"
|
||||
VerticalAlignment="Center">
|
||||
<StackPanel.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
|
||||
</StackPanel.Background>-->
|
||||
|
||||
<!--<hc:ColorPicker Name="MyColorPicker"
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
||||
</StackPanel.Background>
|
||||
|
||||
<hc:ColorPicker Name="MyColorPicker"
|
||||
ToggleButton.Checked="MyColorPicker_Checked"
|
||||
Canceled="MyColorPicker_Canceled"
|
||||
Confirmed="MyColorPicker_Confirmed"
|
||||
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>-->
|
||||
|
||||
<!--</StackPanel>-->
|
||||
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,39 +1,41 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// MotionControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||
{
|
||||
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
|
||||
public ThemeControl()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||
{
|
||||
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||
ImgBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||
GradientBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -62,7 +64,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
}
|
||||
BGSettingUtil.BGSetting();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -79,16 +81,47 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
}
|
||||
BGSettingUtil.BGSetting();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string tag = (sender as Button).Tag.ToString();
|
||||
new MyColorPickerDialog(tag, "ConfigWindowDialog");
|
||||
ColorPanel.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MyColorPicker_Canceled(object sender, EventArgs e)
|
||||
{
|
||||
MyColorPickerClose(sender);
|
||||
}
|
||||
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||
{
|
||||
MyColorPickerClose(sender);
|
||||
}
|
||||
|
||||
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||
{
|
||||
SolidColorBrush scb = MyColorPicker.SelectedBrush;
|
||||
appConfig.TextColor = scb.ToString();
|
||||
}
|
||||
|
||||
/// <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 PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -98,7 +131,6 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
};
|
||||
System.Threading.ThreadStart ts = new System.Threading.ThreadStart(cbu.CheckButtonUp);
|
||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
@@ -126,36 +158,26 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void BGStyle_Changed(object sender, RoutedEventArgs e)
|
||||
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BGSettingUtil.BGSetting();
|
||||
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
|
||||
}
|
||||
|
||||
|
||||
private void MyColorPickerClose(object sender)
|
||||
{
|
||||
if (toggleButton != null && toggleButton.IsChecked == true)
|
||||
{
|
||||
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||
ImgBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||
GradientBGConf.Visibility = Visibility.Visible;
|
||||
HandyControl.Controls.ColorPicker cp = sender as HandyControl.Controls.ColorPicker;
|
||||
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||
Type type = cp.GetType();
|
||||
toggleButton.IsChecked = false;
|
||||
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
|
||||
mi.Invoke(cp, new object[] { null, null });
|
||||
}
|
||||
ColorPanel.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void BGOpacity_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
BGSettingUtil.BGSetting();
|
||||
}
|
||||
|
||||
private void Color_TargetUpdated(object sender, DataTransferEventArgs e)
|
||||
{
|
||||
BGSettingUtil.BGSetting();
|
||||
}
|
||||
|
||||
private void SysBG_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GradientBGDialog gbg = new GradientBGDialog();
|
||||
gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "ConfigWindowDialog");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
using System.Windows.Controls;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.IconFont
|
||||
{
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
>
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
|
||||
<!--左侧栏样式动画-->
|
||||
@@ -23,7 +21,7 @@
|
||||
</Setter>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
||||
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
||||
<!--<EventSetter Event="Unselected" Handler="ListBoxItem_Unselected"/>-->
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
@@ -51,7 +49,11 @@
|
||||
</MultiTrigger>
|
||||
|
||||
|
||||
<!--移到代码设置-->
|
||||
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#ECECEC"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
<!--<Trigger Property="IsSelected" Value="False">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
@@ -65,10 +67,12 @@
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>-->
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
|
||||
<!--<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property=""></Condition>
|
||||
</MultiTrigger.Conditions>
|
||||
</MultiTrigger>-->
|
||||
|
||||
|
||||
</Style.Triggers>
|
||||
@@ -78,11 +82,10 @@
|
||||
</UserControl.Resources>
|
||||
<!--左侧栏-->
|
||||
<hc:Card x:Name="MyCard"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,0,5"
|
||||
MouseDown="MyCard_MouseDown"
|
||||
>
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,0,5"
|
||||
>
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||
|
||||
@@ -105,7 +108,6 @@
|
||||
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
SelectionChanged="Menu_SelectionChanged"
|
||||
PreviewMouseWheel="Menu_MouseWheel"
|
||||
>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="MenuDialog" Width="200">
|
||||
@@ -133,7 +135,7 @@
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Tag="{Binding}" MouseDown="ListBoxItem_MouseDown">
|
||||
<StackPanel Tag="{Binding}">
|
||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using DraggAnimatedPanelExample;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
@@ -9,8 +9,10 @@ using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
@@ -21,8 +23,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
private int menuSelectIndexTemp = -1;
|
||||
private AppData appData = MainWindow.appData;
|
||||
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
||||
|
||||
|
||||
//是否正在修改菜单
|
||||
private static bool IS_EDIT = false;
|
||||
@@ -30,56 +30,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
public LeftCardControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
this.Loaded += (s, e) =>
|
||||
{
|
||||
SelectLastMenu();
|
||||
SetMenuListBoxItemEvent();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void SetMenuListBoxItemEvent()
|
||||
{
|
||||
int size = MenuListBox.Items.Count;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ListBoxItem lbi = (ListBoxItem)(MenuListBox.ItemContainerGenerator.ContainerFromIndex(i));
|
||||
if (lbi != null)
|
||||
{
|
||||
SetListBoxItemEvent(lbi);
|
||||
}
|
||||
}
|
||||
//首次触发不了Selected事件
|
||||
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||
Lbi_Selected(obj, null);
|
||||
}
|
||||
|
||||
private void SetListBoxItemEvent(ListBoxItem lbi)
|
||||
{
|
||||
lbi.MouseEnter += (s, me) =>
|
||||
{
|
||||
lbi.Background = bac;
|
||||
};
|
||||
lbi.Unselected += Lbi_Unselected;
|
||||
|
||||
lbi.MouseLeave += Lbi_MouseLeave;
|
||||
|
||||
lbi.Selected += Lbi_Selected;
|
||||
}
|
||||
|
||||
private void SelectLastMenu()
|
||||
{
|
||||
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
|
||||
{
|
||||
MenuListBox.SelectedIndex = 0;
|
||||
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuListBox.SelectedIndex = appData.AppConfig.SelectedMenuIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||
}
|
||||
}
|
||||
@@ -109,6 +65,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
}
|
||||
|
||||
//////菜单点击事件
|
||||
//private void MenuClick(object sender, MouseButtonEventArgs e)
|
||||
//{
|
||||
// //设置对应菜单的图标列表
|
||||
// MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag);
|
||||
// appData.AppConfig.SelectedMenuIcons = mi.IconList;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中
|
||||
@@ -119,11 +82,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
private void MenuWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
StackPanel sp = sender as StackPanel;
|
||||
|
||||
ListBoxItem lbi = (sp.TemplatedParent as ContentPresenter).TemplatedParent as ListBoxItem;
|
||||
|
||||
//ListBoxItem lbi = (sp.TemplatedParent as ContentPresenter).TemplatedParent as ListBoxItem;
|
||||
if (sp.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
lbi.MouseEnter += Lbi_MouseEnter;
|
||||
//SolidColorBrush scb = new SolidColorBrush(Colors.Red);
|
||||
//lbi.MouseEnter += Lbi_MouseEnter;
|
||||
|
||||
if (MenuListBox.SelectedIndex != -1)
|
||||
{
|
||||
menuSelectIndexTemp = MenuListBox.SelectedIndex;
|
||||
@@ -133,51 +98,32 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
lbi.MouseEnter += (s, me) =>
|
||||
{
|
||||
lbi.Background = bac;
|
||||
};
|
||||
//SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
||||
//SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||
|
||||
lbi.MouseLeave += Lbi_MouseLeave;
|
||||
lbi.Selected += Lbi_Selected;
|
||||
//lbi.MouseEnter += (s, me) =>
|
||||
//{
|
||||
// lbi.Background = bac;
|
||||
//};
|
||||
|
||||
//lbi.MouseLeave += Lbi_MouseLeave;
|
||||
|
||||
//lbi.Selected += (s, me) =>
|
||||
//{
|
||||
// lbi.MouseLeave -= Lbi_MouseLeave;
|
||||
// lbi.Background = bac;
|
||||
// lbi.Foreground = fontColor;
|
||||
//};
|
||||
}
|
||||
}
|
||||
|
||||
#region 设置菜单触发事件
|
||||
private void Lbi_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
lbi.Background = Brushes.Transparent;
|
||||
}
|
||||
|
||||
private void Lbi_Unselected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//添加Leave效果
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
lbi.Background = Brushes.Transparent;
|
||||
lbi.MouseLeave += Lbi_MouseLeave;
|
||||
}
|
||||
|
||||
private void Lbi_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
|
||||
SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||
|
||||
lbi.MouseLeave -= Lbi_MouseLeave;
|
||||
lbi.Background = bac;
|
||||
lbi.Foreground = fontColor;
|
||||
}
|
||||
|
||||
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
lbi.Background = Brushes.Transparent;
|
||||
}
|
||||
#endregion
|
||||
//private void Lbi_MouseEnter(object sender, MouseEventArgs e)
|
||||
//{
|
||||
// ListBoxItem lbi = sender as ListBoxItem;
|
||||
// lbi.Background = Brushes.Transparent;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 新建菜单
|
||||
@@ -188,15 +134,32 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
MenuInfo info = new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" };
|
||||
appData.MenuList.Add(info);
|
||||
MenuListBox.Items.Refresh();
|
||||
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
|
||||
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = info.IconList;
|
||||
//首次触发不了Selected事件
|
||||
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||
SetListBoxItemEvent((ListBoxItem)obj);
|
||||
Lbi_Selected(obj, null);
|
||||
}
|
||||
|
||||
//ItemCollection ic = MenuListBox.Items;
|
||||
//SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
||||
//SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||
//foreach (var icItem in ic)
|
||||
//{
|
||||
// ListBoxItem lbi = icItem as ListBoxItem;
|
||||
// lbi.MouseEnter += (s, me) =>
|
||||
// {
|
||||
// lbi.Background = bac;
|
||||
// };
|
||||
|
||||
// lbi.MouseLeave += Lbi_MouseLeave;
|
||||
|
||||
// lbi.Selected += (s, me) =>
|
||||
// {
|
||||
// lbi.MouseLeave -= Lbi_MouseLeave;
|
||||
// lbi.Background = bac;
|
||||
// lbi.Foreground = fontColor;
|
||||
// };
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重命名菜单 将textbox 设置为可见
|
||||
@@ -224,13 +187,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
CreateMenu(null, null);
|
||||
}
|
||||
int index = appData.MenuList.IndexOf(menuInfo);
|
||||
if (index == 0)
|
||||
if(index == 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
index--;
|
||||
index = index - 1;
|
||||
}
|
||||
|
||||
appData.MenuList.Remove(menuInfo);
|
||||
@@ -255,13 +217,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (eKey.Key == Key.Enter)
|
||||
{
|
||||
menuBox = ((TextBox)sender);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
else if (e.GetType() == typeof(RoutedEventArgs))
|
||||
} else if (e.GetType() == typeof(RoutedEventArgs))
|
||||
{
|
||||
menuBox = ((TextBox)sender);
|
||||
}
|
||||
@@ -320,6 +280,19 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
}
|
||||
|
||||
//private void ListBoxItem_Unselected(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// //添加Leave效果
|
||||
// ListBoxItem lbi = sender as ListBoxItem;
|
||||
// //lbi.Background = Brushes.Transparent;
|
||||
// //lbi.MouseLeave += Lbi_MouseLeave;
|
||||
//}
|
||||
|
||||
//private void Lbi_MouseLeave(object sender, MouseEventArgs e)
|
||||
//{
|
||||
// ListBoxItem lbi = sender as ListBoxItem;
|
||||
// lbi.Background = Brushes.Transparent;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标悬停切换菜单
|
||||
@@ -330,7 +303,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
if (appData.AppConfig.HoverMenu && !IS_EDIT)
|
||||
{
|
||||
Thread t = new Thread(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
@@ -342,64 +315,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
MenuListBox.SelectedIndex = index;
|
||||
}
|
||||
});
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击菜单后 隐藏搜索框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏搜索框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MyCard_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (e.Delta < 0)
|
||||
{
|
||||
int index = MenuListBox.SelectedIndex;
|
||||
if (index < MenuListBox.Items.Count - 1)
|
||||
{
|
||||
index ++;
|
||||
} else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
MenuListBox.SelectedIndex = index;
|
||||
} else if (e.Delta > 0)
|
||||
{
|
||||
int index = MenuListBox.SelectedIndex;
|
||||
if (index > 0)
|
||||
{
|
||||
index --;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = MenuListBox.Items.Count - 1;
|
||||
}
|
||||
MenuListBox.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,7 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
|
||||
<Storyboard x:Key="Custom1Transition" x:Shared="False">
|
||||
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<ElasticEase Oscillations="1"/>
|
||||
</DoubleAnimation.EasingFunction>
|
||||
</DoubleAnimation>
|
||||
</Storyboard>
|
||||
|
||||
|
||||
<Style x:Key="ImageStyle" TargetType="Image">
|
||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||
@@ -58,8 +50,7 @@
|
||||
Drop="Wrap_Drop"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown">
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
</hc:Card.Background>
|
||||
@@ -70,16 +61,15 @@
|
||||
<ContextMenu Width="200">
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||
</ContextMenu>
|
||||
</hc:Card.ContextMenu>
|
||||
<Grid>
|
||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
>
|
||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
>
|
||||
@@ -117,35 +107,26 @@
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<hc:SimpleStackPanel Tag="{Binding}"
|
||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
hc:Poptip.Content="{Binding Content}"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
Background="#00FFFFFF"
|
||||
MouseEnter="StackPanel_MouseEnter"
|
||||
MouseLeave="StackPanel_MouseLeave"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
>
|
||||
<!--<StackPanel Background="#00FFFFFF"
|
||||
MouseEnter="CursorPanel_MouseEnter"
|
||||
MouseLeave="CursorPanel_MouseLeave"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
||||
<Image Style="{StaticResource ImageStyle}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
<TextBlock MaxWidth="80"
|
||||
Margin="0,5,0,0"
|
||||
MaxHeight="40"
|
||||
FontSize="13"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="WordEllipsis"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||
Text="{Binding Name}"/>
|
||||
<!--</StackPanel>-->
|
||||
|
||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
hc:Poptip.Content="{Binding Content}"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
Background="#00FFFFFF"
|
||||
MouseEnter="StackPanel_MouseEnter"
|
||||
MouseLeave="StackPanel_MouseLeave"
|
||||
>
|
||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
<TextBlock MaxWidth="80"
|
||||
Margin="0,5,0,0"
|
||||
MaxHeight="40"
|
||||
FontSize="13"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="WordEllipsis"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||
Text="{Binding Name}"/>
|
||||
</hc:SimpleStackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
@@ -156,17 +137,14 @@
|
||||
</Grid>
|
||||
</hc:Card>
|
||||
|
||||
<hc:Card x:Name="VerticalCard"
|
||||
<hc:Card
|
||||
x:Name="VerticalCard"
|
||||
Visibility="Hidden"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||
MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
|
||||
>
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="AliceBlue"
|
||||
hc:GeometryEffect.GeometryEffect="20"
|
||||
Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||
@@ -177,46 +155,36 @@
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
>
|
||||
<UniformGrid x:Name="VerticalUFG">
|
||||
<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
|
||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="IconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="IconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Background="#00FFFFFF"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
|
||||
/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<WrapPanel Tag="{Binding}"
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<WrapPanel Tag="{Binding}"
|
||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}}"
|
||||
HorizontalAlignment="Left"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
@@ -227,8 +195,8 @@
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
Margin="25,20,0,0"
|
||||
>
|
||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
<TextBlock
|
||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
<TextBlock
|
||||
Margin="10,5,0,0"
|
||||
MaxHeight="40"
|
||||
FontSize="13"
|
||||
@@ -238,13 +206,11 @@
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||
Text="{Binding Name}"/>
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
</hc:TransitioningContentControl>
|
||||
</UniformGrid>
|
||||
</WrapPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -9,12 +9,13 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
@@ -45,7 +46,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
(indexes) =>
|
||||
{
|
||||
DROP_ICON = true;
|
||||
if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
||||
if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
||||
&& (dropCheckThread == null || !dropCheckThread.IsAlive))
|
||||
{
|
||||
dropCheckThread = new Thread(() =>
|
||||
@@ -116,7 +117,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
@@ -128,7 +129,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
@@ -198,12 +199,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
||||
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
|
||||
//p.StartInfo.ErrorDialog = false;
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
if (!MarginHide.IsMargin())
|
||||
if (!MarginHide.IS_HIDE)
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
@@ -216,12 +217,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
break;// c#好像不能case穿透
|
||||
case IconStartType.DEFAULT_STARTUP:
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
if (!MarginHide.IsMargin())
|
||||
if (!MarginHide.IS_HIDE)
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
@@ -240,7 +241,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
else
|
||||
{
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
@@ -260,12 +261,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
}
|
||||
icon.Count++;
|
||||
|
||||
//隐藏搜索框
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -421,31 +416,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
double height = appData.AppConfig.ImageHeight;
|
||||
width += width * 0.15;
|
||||
height += height * 0.15;
|
||||
Thread t = new Thread(() =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
||||
}));
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
|
||||
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
||||
}
|
||||
|
||||
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
Thread t = new Thread(() =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
|
||||
}));
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
|
||||
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 220);
|
||||
}
|
||||
|
||||
|
||||
@@ -454,59 +430,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
if (appData.AppConfig.PMModel) return;
|
||||
|
||||
//int count = 0;
|
||||
//Panel sp = sender as Panel;
|
||||
//Image img = sp.Children[0] as Image;
|
||||
|
||||
|
||||
//int nowH = (int)img.Height;
|
||||
|
||||
//bool isSmall = nowH > height;
|
||||
|
||||
//if (!isSmall)
|
||||
//{
|
||||
// img.Height = height;
|
||||
// img.Width = width;
|
||||
// return;
|
||||
//}
|
||||
//double subLen = (double)Math.Abs(nowH - height) / (double)milliseconds;
|
||||
|
||||
//new Thread(() =>
|
||||
//{
|
||||
// this.Dispatcher.Invoke(() =>
|
||||
// {
|
||||
// while (count < milliseconds)
|
||||
// {
|
||||
// if (!isSmall)
|
||||
// {
|
||||
// img.Height += subLen;
|
||||
// img.Width += subLen;
|
||||
// } else
|
||||
// {
|
||||
// //if (img.Height > 1)
|
||||
// //{
|
||||
// // img.Height -= 1;
|
||||
// // img.Width -= 1;
|
||||
// //}
|
||||
// Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
|
||||
// new Action(delegate {
|
||||
// img.Height -= subLen;
|
||||
// img.Width -= subLen;
|
||||
// }));
|
||||
// //img.Height -= subLen;
|
||||
// //img.Width -= subLen;
|
||||
// }
|
||||
// count++;
|
||||
// Thread.Sleep(1);
|
||||
// }
|
||||
// img.Height = height;
|
||||
// img.Width = width;
|
||||
// });
|
||||
//}).Start();
|
||||
|
||||
|
||||
|
||||
|
||||
Panel sp = sender as Panel;
|
||||
|
||||
DependencyObject dos = sp.Parent;
|
||||
@@ -562,7 +485,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
ThreadStart ts = new ThreadStart(crs.Remove);
|
||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
@@ -573,10 +495,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
};
|
||||
img.BeginAnimation(WidthProperty, widthAnimation);
|
||||
img.BeginAnimation(HeightProperty, heightAnimation);
|
||||
//###################################################################
|
||||
|
||||
//myStoryboard.Completed += (s, e) =>
|
||||
//{
|
||||
// if (checkRmStoryboard)
|
||||
// if (checkRmStoryboard || true)
|
||||
// {
|
||||
// ThreadStart ts = new ThreadStart(crs.Remove);
|
||||
// System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
@@ -655,66 +577,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (vb == Visibility.Visible)
|
||||
{
|
||||
WrapCard.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
WrapCard.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索Card点击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void VerticalCard_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//隐藏搜索框
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置光标
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void CursorPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置光标
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void CursorPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Arrow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 锁定/解锁主面板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LockAppPanel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RunTimeStatus.LOCK_APP_PANEL = !RunTimeStatus.LOCK_APP_PANEL;
|
||||
}
|
||||
|
||||
private void WrapCard_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RunTimeStatus.LOCK_APP_PANEL)
|
||||
{
|
||||
CardLockCM.Header = "解锁主面板";
|
||||
} else
|
||||
{
|
||||
CardLockCM.Header = "锁定主面板";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.SystemItem
|
||||
{
|
||||
@@ -35,13 +47,13 @@ namespace GeekDesk.Control.UserControls.SystemItem
|
||||
};
|
||||
iconInfo.Content_NoWrite = iconInfo.Name_NoWrite
|
||||
+ "\n使用次数:" + iconInfo.Count;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
//startupMenu or Store
|
||||
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
||||
}
|
||||
menuInfo.IconList.Add(iconInfo);
|
||||
CommonCode.SortIconList();
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,58 +6,25 @@
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:ToDoInfo}"
|
||||
mc:Ignorable="d"
|
||||
xmlns:cst="clr-namespace:GeekDesk.Converts"
|
||||
Background="Transparent"
|
||||
>
|
||||
|
||||
<UserControl.Resources>
|
||||
<!--<cst:Count2VisibleConvert x:Key="Count2VisibleConvert"/>
|
||||
<cst:CountGreZero2BoolConvert x:Key="CountGreZero2BoolConvert"/>
|
||||
<Style x:Key="NoDataStyle" TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="False">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="True">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ToDoStyle" TargetType="DataGrid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="False">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
</UserControl.Resources>
|
||||
<hc:SimplePanel Margin="20" Background="Transparent">
|
||||
<Grid Background="Transparent">
|
||||
<TextBlock x:Name="IsNewToDo" Visibility="Collapsed" />
|
||||
<TextBlock x:Name="NoData"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
Text="暂无数据!"
|
||||
/>
|
||||
|
||||
<DataGrid x:Name="BacklogList"
|
||||
HeadersVisibility="All"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding}"
|
||||
IsReadOnly="True"
|
||||
Initialized="DataGridMenu_Initialized"
|
||||
>
|
||||
HeadersVisibility="All"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding}"
|
||||
IsReadOnly="True"
|
||||
Initialized="DataGridMenu_Initialized"
|
||||
>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu x:Name="Menu" Width="120">
|
||||
<MenuItem Header="详情" Click="DetailMenu_Click"/>
|
||||
<MenuItem Header="删除" Click="DeleteMenu_Click"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<!--<DataGrid.RowStyle>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
|
||||
<EventSetter Event="MouseRightButtonDown" Handler="DataGridRow_MouseRightButtonDown" />
|
||||
<Setter Property="Background" Value="White"/>
|
||||
@@ -70,59 +37,8 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>-->
|
||||
|
||||
|
||||
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Style.Setters>
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type DataGridRow}">
|
||||
<Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<SelectiveScrollingGrid>
|
||||
<SelectiveScrollingGrid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</SelectiveScrollingGrid.ColumnDefinitions>
|
||||
<SelectiveScrollingGrid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</SelectiveScrollingGrid.RowDefinitions>
|
||||
<DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<Path Name="Cross" Grid.ColumnSpan="2" Visibility="Collapsed" Margin="10,0,10,0" Data="M0,0.5 L1,0.5" Stretch="Fill" Stroke="Gray" StrokeThickness="1" Opacity="0.5" />
|
||||
</SelectiveScrollingGrid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=IsNewToDo, Path=Text}" Value="N">
|
||||
<Setter TargetName="Cross" Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=IsNewToDo, Path=Text}" Value="Y">
|
||||
<Setter TargetName="Cross" Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#E5E5E2" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
|
||||
@@ -3,10 +3,19 @@ using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Backlog
|
||||
{
|
||||
@@ -71,17 +80,7 @@ namespace GeekDesk.Control.UserControls.Backlog
|
||||
/// <param name="e"></param>
|
||||
private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
int index;
|
||||
ToDoInfo info = ((Border)sender).DataContext as ToDoInfo;
|
||||
if (type == ToDoType.NEW)
|
||||
{
|
||||
index = MainWindow.appData.ToDoList.IndexOf(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
index = MainWindow.appData.HiToDoList.IndexOf(info);
|
||||
}
|
||||
BacklogList.SelectedIndex = index;
|
||||
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
|
||||
Menu.IsOpen = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,32 +24,30 @@
|
||||
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<Grid hc:Dialog.Token="ConfigWindowDialog">
|
||||
<hc:DialogContainer Margin="10">
|
||||
<Border Style="{StaticResource BorderBG}">
|
||||
<Grid Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Style="{StaticResource BorderBG}">
|
||||
<Grid Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
||||
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
||||
|
||||
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
||||
<hc:SideMenu.ItemContainerStyle>
|
||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
||||
</hc:SideMenu.ItemContainerStyle>
|
||||
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
||||
<hc:SideMenu.ItemContainerStyle>
|
||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
||||
</hc:SideMenu.ItemContainerStyle>
|
||||
|
||||
<hc:SideMenuItem Header="关于"
|
||||
<hc:SideMenuItem Header="关于"
|
||||
IsSelected="True"
|
||||
Selected="MemuClick"
|
||||
Tag="About"
|
||||
>
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="0.9"
|
||||
BorderThickness="0"
|
||||
@@ -58,13 +56,13 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="显示设置"
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="显示设置"
|
||||
Tag="Theme"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -73,14 +71,14 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
|
||||
<hc:SideMenuItem Header="动作"
|
||||
<hc:SideMenuItem Header="动作"
|
||||
Tag="Motion"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -89,13 +87,13 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="其它"
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="其它"
|
||||
Tag="Other"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -104,28 +102,21 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
||||
<UniformGrid x:Name="UFG">
|
||||
<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
|
||||
<hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</hc:Card.Background>
|
||||
</hc:Card>
|
||||
</hc:TransitioningContentControl>
|
||||
</UniformGrid>
|
||||
</hc:ScrollViewer>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
||||
<hc:Card x:Name="RightCard" Height="480" BorderThickness="0" MouseDown="DragMove">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</hc:Card.Background>
|
||||
</hc:Card>
|
||||
</hc:ScrollViewer>
|
||||
|
||||
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</hc:DialogContainer>
|
||||
</Grid>
|
||||
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</hc:Window>
|
||||
@@ -1,10 +1,14 @@
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.UserControls;
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using System.Collections.Generic;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
@@ -18,14 +22,6 @@ namespace GeekDesk.Control.Windows
|
||||
private static readonly ThemeControl theme = new ThemeControl();
|
||||
private static readonly MotionControl motion = new MotionControl();
|
||||
private static readonly OtherControl other = new OtherControl();
|
||||
private static List<UserControl> ucList = new List<UserControl>();
|
||||
static ConfigWindow()
|
||||
{
|
||||
ucList.Add(about);
|
||||
ucList.Add(theme);
|
||||
ucList.Add(motion);
|
||||
ucList.Add(other);
|
||||
}
|
||||
public MainWindow mainWindow;
|
||||
|
||||
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
|
||||
@@ -38,8 +34,8 @@ namespace GeekDesk.Control.Windows
|
||||
this.mainWindow = mainWindow;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 点击关闭按钮
|
||||
@@ -57,24 +53,16 @@ namespace GeekDesk.Control.Windows
|
||||
switch (smi.Tag.ToString())
|
||||
{
|
||||
case "Motion":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = motion;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "Theme":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = theme;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "Other":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = other;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
default:
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = about;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<Window x:Class="GeekDesk.Control.Windows.GlobalColorPickerWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
<Border CornerRadius="8"
|
||||
Background="White"
|
||||
Height="385"
|
||||
Width="228">
|
||||
<StackPanel>
|
||||
|
||||
<Border MouseDown="DragMove"
|
||||
VerticalAlignment="Top"
|
||||
CornerRadius="8,8,0,0"
|
||||
Height="20"
|
||||
Background="White"
|
||||
>
|
||||
<Button Width="18" Height="18"
|
||||
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"
|
||||
Padding="0"
|
||||
Background="Transparent"
|
||||
Opacity="0.6"
|
||||
Margin="0,0,5,0"
|
||||
Click="Button_Click"
|
||||
HorizontalAlignment="Right"
|
||||
MouseEnter="Button_MouseEnter"
|
||||
MouseLeave="Button_MouseLeave"
|
||||
VerticalAlignment="Center">
|
||||
|
||||
</Button>
|
||||
</Border>
|
||||
|
||||
<hc:ColorPicker HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"
|
||||
SelectedColorChanged="MyColorPicker_SelectedColorChanged"
|
||||
x:Name="MyColorPicker"
|
||||
Confirmed="MyColorPicker_Confirmed"
|
||||
Canceled="MyColorPicker_Canceled"
|
||||
ToggleButton.Checked="MyColorPicker_Checked"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -1,141 +0,0 @@
|
||||
using GeekDesk.Interface;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// GlobalColorPickerWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class GlobalColorPickerWindow : IWindowCommon
|
||||
{
|
||||
PixelColorPickerWindow colorPickerWindow = null;
|
||||
public GlobalColorPickerWindow()
|
||||
{
|
||||
this.Topmost = true;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MyColorPicker_Canceled(object sender, EventArgs e)
|
||||
{
|
||||
MyColorPickerClose();
|
||||
}
|
||||
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||
{
|
||||
Color c = MyColorPicker.SelectedBrush.Color;
|
||||
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B));
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
if (colorPickerWindow == null || !colorPickerWindow.Activate())
|
||||
{
|
||||
colorPickerWindow = new PixelColorPickerWindow(MyColorPicker);
|
||||
}
|
||||
colorPickerWindow.Show();
|
||||
}
|
||||
|
||||
private void MyColorPickerClose()
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private static System.Windows.Window window = null;
|
||||
|
||||
public static void CreateNoShow()
|
||||
{
|
||||
if (window == null || !window.Activate())
|
||||
{
|
||||
window = new GlobalColorPickerWindow();
|
||||
window.Show();
|
||||
}
|
||||
window.Hide();
|
||||
GlobalColorPickerWindow thisWindow = (GlobalColorPickerWindow)window;
|
||||
if (thisWindow.colorPickerWindow == null || !thisWindow.colorPickerWindow.Activate())
|
||||
{
|
||||
thisWindow.colorPickerWindow = new PixelColorPickerWindow(thisWindow.MyColorPicker);
|
||||
}
|
||||
thisWindow.colorPickerWindow.Show();
|
||||
}
|
||||
|
||||
public static void Show()
|
||||
{
|
||||
if (window == null || !window.Activate())
|
||||
{
|
||||
window = new GlobalColorPickerWindow();
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
public static void ShowOrHide()
|
||||
{
|
||||
if (window == null || !window.Activate())
|
||||
{
|
||||
window = new GlobalColorPickerWindow();
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||
{
|
||||
Show();
|
||||
}
|
||||
|
||||
private void Button_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
Button btn = sender as Button;
|
||||
btn.Opacity = 1;
|
||||
}
|
||||
|
||||
private void Button_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
Button btn = sender as Button;
|
||||
btn.Opacity = 0.6;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
<Window
|
||||
x:Class="GeekDesk.Control.Windows.PixelColorPickerWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xml:lang="zh-CN"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Black"
|
||||
PreviewMouseMove="Window_PreviewMouseMove"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
>
|
||||
<Window.Resources>
|
||||
<Style x:Key="TextKey" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
</Style>
|
||||
<Style x:Key="TextValue" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Margin" Value="10,0,0,0"/>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Image x:Name="DesktopBG" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
|
||||
<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent">
|
||||
<Canvas x:Name="ColorCanvas"
|
||||
Width="185"
|
||||
Height="160">
|
||||
<Border Background="White"
|
||||
CornerRadius="5"
|
||||
>
|
||||
<Grid>
|
||||
<WrapPanel HorizontalAlignment="Center" Height="70" Margin="0,5,0,80">
|
||||
<Border Width="70" Height="70"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<Rectangle x:Name="PixelColor" StrokeThickness="0">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush />
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</Border>
|
||||
<Border x:Name="Pixel"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="70"
|
||||
Background="Black"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Margin="20,0,0,0"
|
||||
>
|
||||
<Grid>
|
||||
<Rectangle x:Name="PixelBG" StrokeThickness="0">
|
||||
<Rectangle.Fill>
|
||||
<VisualBrush ViewboxUnits="Absolute" Viewbox="0,0,20,20"
|
||||
ViewportUnits="RelativeToBoundingBox" Viewport="0,0,1,1">
|
||||
</VisualBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Border HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Width="6" Height="6"
|
||||
BorderBrush="White" BorderThickness="0.6">
|
||||
|
||||
<Border Width="4.5" Height="4.5" BorderBrush="Black" BorderThickness="0.6"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
<WrapPanel HorizontalAlignment="Center" Height="80" Margin="0,85,0,5">
|
||||
<StackPanel Width="100" Height="80">
|
||||
<TextBlock Text="RGB:" Style="{StaticResource TextKey}"/>
|
||||
<TextBlock x:Name="PixelColor_RGB" Style="{StaticResource TextValue}"/>
|
||||
|
||||
<TextBlock Text="HTML:" Margin="0,5,0,0" Style="{StaticResource TextKey}"/>
|
||||
<TextBlock x:Name="PixelColor_HTML" Style="{StaticResource TextValue}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Width="65" Height="80" Margin="10,0,0,0">
|
||||
<TextBlock x:Name="Pixel_XY" TextAlignment="Right"/>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Canvas>
|
||||
</Canvas>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,195 +0,0 @@
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// ColorPickerWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PixelColorPickerWindow : IWindowCommon
|
||||
{
|
||||
private static int PIXEL_REC_LENGTH = 20;
|
||||
|
||||
private static readonly int MIN_LENGTH = 10;
|
||||
private static readonly int MAX_LENGTH = 50;
|
||||
|
||||
private static System.Drawing.Bitmap bgBitmap;
|
||||
|
||||
private readonly ColorPicker colorPicker;
|
||||
|
||||
public PixelColorPickerWindow(ColorPicker colorPicker)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.colorPicker = colorPicker;
|
||||
ColorPickerWindow_Init();
|
||||
}
|
||||
|
||||
private void ColorPickerWindow_Init()
|
||||
{
|
||||
|
||||
this.WindowState = WindowState.Normal;//还原窗口(非最小化和最大化)
|
||||
|
||||
this.Width = SystemParameters.VirtualScreenWidth;
|
||||
this.Height = SystemParameters.VirtualScreenHeight;
|
||||
|
||||
this.Left = SystemParameters.VirtualScreenLeft;
|
||||
this.Top = SystemParameters.VirtualScreenTop;
|
||||
|
||||
DesktopBG.Width = this.Width;
|
||||
DesktopBG.Height = this.Height;
|
||||
this.Topmost = true;
|
||||
|
||||
bgBitmap = new System.Drawing.Bitmap(
|
||||
(int)SystemParameters.VirtualScreenWidth,
|
||||
(int)SystemParameters.VirtualScreenHeight,
|
||||
System.Drawing.Imaging.PixelFormat.Format32bppArgb
|
||||
);
|
||||
|
||||
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bgBitmap))
|
||||
{
|
||||
g.CopyFromScreen(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
bgBitmap.Size
|
||||
);
|
||||
}
|
||||
BitmapSource bs = Imaging.CreateBitmapSourceFromHBitmap(
|
||||
bgBitmap.GetHbitmap(),
|
||||
IntPtr.Zero,
|
||||
Int32Rect.Empty,
|
||||
BitmapSizeOptions.FromEmptyOptions()
|
||||
);
|
||||
DesktopBG.Source = bs;
|
||||
VisualBrush b = (VisualBrush)PixelBG.Fill;
|
||||
b.Visual = DesktopBG;
|
||||
Mouse.OverrideCursor = Cursors.Cross;
|
||||
SetPixelAbout(null);
|
||||
}
|
||||
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Mouse.OverrideCursor = null;
|
||||
Point pos = e.MouseDevice.GetPosition(DesktopBG);
|
||||
System.Drawing.Color colorD = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
|
||||
colorPicker.SelectedBrush = new SolidColorBrush(Color.FromArgb(colorD.A, colorD.R, colorD.G, colorD.B));
|
||||
DeleteObject(bgBitmap.GetHbitmap());
|
||||
this.Close();
|
||||
ClickColorPickerToggleButton(colorPicker);
|
||||
}
|
||||
|
||||
public void ClickColorPickerToggleButton(ColorPicker colorPicker)
|
||||
{
|
||||
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||
Type type = colorPicker.GetType();
|
||||
FieldInfo fi = type.GetField("_toggleButtonDropper", InstanceBindFlags);
|
||||
|
||||
ToggleButton tb = (ToggleButton)fi.GetValue(colorPicker);
|
||||
if (tb != null && tb.IsChecked == true)
|
||||
{
|
||||
tb.IsChecked = false;
|
||||
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
|
||||
mi.Invoke(colorPicker, new object[] { null, null });
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
SetPixelAbout(e);
|
||||
}
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||
public static extern bool DeleteObject(IntPtr onj);
|
||||
|
||||
private void SetPixelAbout(MouseEventArgs e)
|
||||
{
|
||||
VisualBrush b = (VisualBrush)PixelBG.Fill;
|
||||
|
||||
Point pos;
|
||||
if (e == null)
|
||||
{
|
||||
pos = MouseUtil.GetMousePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = e.MouseDevice.GetPosition(DesktopBG);
|
||||
}
|
||||
Rect viewBox = b.Viewbox;
|
||||
|
||||
viewBox.Width = PIXEL_REC_LENGTH;
|
||||
viewBox.Height = PIXEL_REC_LENGTH;
|
||||
|
||||
viewBox.X = pos.X - PIXEL_REC_LENGTH / 2;
|
||||
viewBox.Y = pos.Y - PIXEL_REC_LENGTH / 2;
|
||||
b.Viewbox = viewBox;
|
||||
|
||||
double x = pos.X + 10;
|
||||
double y = pos.Y + 10;
|
||||
if (x + ColorCanvas.Width > SystemParameters.VirtualScreenWidth)
|
||||
{
|
||||
x = pos.X - ColorCanvas.Width - 10;
|
||||
}
|
||||
if (y + ColorCanvas.Height > SystemParameters.VirtualScreenHeight)
|
||||
{
|
||||
y = pos.Y - ColorCanvas.Height - 10;
|
||||
}
|
||||
|
||||
Canvas.SetLeft(ColorCanvas, x);
|
||||
Canvas.SetTop(ColorCanvas, y);
|
||||
|
||||
|
||||
System.Drawing.Color dColor = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
|
||||
|
||||
PixelColor_HTML.Text = "#" + dColor.Name.ToUpper();
|
||||
PixelColor_RGB.Text = dColor.R + "," + dColor.G + "," + dColor.B;
|
||||
Pixel_XY.Text = pos.X + "*" + pos.Y;
|
||||
|
||||
SolidColorBrush scb = (SolidColorBrush)PixelColor.Fill;
|
||||
scb.Color = Color.FromArgb(dColor.A, dColor.R, dColor.G, dColor.B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 滚轮控制缩放区域
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
|
||||
if (e.Delta < 0 && PIXEL_REC_LENGTH < MAX_LENGTH)
|
||||
{
|
||||
//缩小
|
||||
PIXEL_REC_LENGTH += 5;
|
||||
}
|
||||
else if (e.Delta > 0 && PIXEL_REC_LENGTH > MIN_LENGTH)
|
||||
{
|
||||
//放大
|
||||
PIXEL_REC_LENGTH -= 5;
|
||||
}
|
||||
SetPixelAbout(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
@@ -7,10 +8,13 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||
@@ -81,8 +85,7 @@ namespace GeekDesk.Control.Windows
|
||||
IsBackground = true
|
||||
};
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
StartMenuLoading.Visibility = Visibility.Collapsed;
|
||||
vm.IconInfos = startMenuIcons;
|
||||
@@ -106,8 +109,7 @@ namespace GeekDesk.Control.Windows
|
||||
vm.IconInfos = null;
|
||||
systemIcons = GetSysteIconInfos();
|
||||
vm.IconInfos = systemIcons;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
vm.IconInfos = systemIcons;
|
||||
}
|
||||
@@ -140,7 +142,7 @@ namespace GeekDesk.Control.Windows
|
||||
}
|
||||
StartMenuLoading.Visibility = Visibility.Collapsed;
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -159,8 +161,7 @@ namespace GeekDesk.Control.Windows
|
||||
if (filePaths == null || filePaths.Length == 0)
|
||||
{
|
||||
dirPaths.CopyTo(paths, 0);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
dirPaths.CopyTo(paths, filePaths.Length - 1);
|
||||
}
|
||||
@@ -194,7 +195,7 @@ namespace GeekDesk.Control.Windows
|
||||
//foreach(FileSystemInfo fi in fileInfoArr)
|
||||
//{
|
||||
// string path = fi.FullName;
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,18 @@ using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using Quartz;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
@@ -33,8 +42,7 @@ namespace GeekDesk.Control.Windows
|
||||
DateTime time = DateTime.Now.AddMinutes(10);
|
||||
ExeTime.SelectedDateTime = time;
|
||||
SetTimePanel.Visibility = Visibility.Visible;
|
||||
this.DataContext = new ToDoInfo
|
||||
{
|
||||
this.DataContext = new ToDoInfo {
|
||||
ExeTime = time.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
};
|
||||
}
|
||||
@@ -89,8 +97,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
Growl.Warning("任务标题不能为空!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if (SetTimePanel.Visibility == Visibility.Visible)
|
||||
{
|
||||
@@ -110,9 +117,7 @@ namespace GeekDesk.Control.Windows
|
||||
return;
|
||||
}
|
||||
execTime = ExeTime.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
execType = TodoTaskExecType.CRON;
|
||||
if (Cron.Text.Trim() == "")
|
||||
{
|
||||
@@ -123,8 +128,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
bool isValid = CronExpression.IsValidExpression(Cron.Text);
|
||||
if (!isValid) throw new Exception();
|
||||
}
|
||||
catch (Exception)
|
||||
} catch (Exception)
|
||||
{
|
||||
Growl.Warning("请输入正确的Cron表达式!");
|
||||
return;
|
||||
@@ -151,8 +155,7 @@ namespace GeekDesk.Control.Windows
|
||||
if (appData.HiToDoList.Contains(tdi))
|
||||
{
|
||||
appData.HiToDoList.Remove(tdi);
|
||||
}
|
||||
else if (appData.ToDoList.Contains(tdi))
|
||||
} else if (appData.ToDoList.Contains(tdi))
|
||||
{
|
||||
appData.ToDoList.Remove(tdi);
|
||||
}
|
||||
@@ -172,8 +175,7 @@ namespace GeekDesk.Control.Windows
|
||||
int h = minutes / 60;
|
||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
|
||||
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
||||
}
|
||||
@@ -200,8 +202,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
window = new ToDoInfoWindow();
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
|
||||
@@ -78,12 +78,8 @@
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<UniformGrid x:Name="UFG" Grid.Column="1" Grid.Row="0">
|
||||
<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
|
||||
<hc:Card x:Name="RightCard" VerticalAlignment="Top" MouseDown="DragMove" Background="Transparent" BorderThickness="0" Height="410"/>
|
||||
</hc:TransitioningContentControl>
|
||||
</UniformGrid>
|
||||
|
||||
<hc:Card Grid.Row="0" MouseDown="DragMove" Background="Transparent" BorderThickness="0" Grid.Column="1" x:Name="RightCard" Height="450">
|
||||
</hc:Card>
|
||||
|
||||
|
||||
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
||||
@@ -91,8 +87,8 @@
|
||||
Panel.ZIndex="1"
|
||||
Style="{StaticResource Btn1}"
|
||||
Grid.Column="1"
|
||||
Margin="669,400,0,0"
|
||||
Click="CreateBacklog_BtnClick" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
Margin="590.01,29,10,384"
|
||||
Click="CreateBacklog_BtnClick"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -2,8 +2,20 @@
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
@@ -20,16 +32,6 @@ namespace GeekDesk.Control.Windows
|
||||
RightCard.Content = backlog;
|
||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||
this.Topmost = true;
|
||||
if (backlog.BacklogList.Items.Count > 0)
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Visible;
|
||||
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,37 +64,12 @@ namespace GeekDesk.Control.Windows
|
||||
switch (smi.Tag.ToString())
|
||||
{
|
||||
case "History":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.ItemsSource = appData.HiToDoList;
|
||||
if (backlog.BacklogList.Items.Count > 0)
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||
} else
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Visible;
|
||||
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
backlog.type = ToDoType.HISTORY;
|
||||
backlog.IsNewToDo.Text = "N";
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
default:
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||
if (backlog.BacklogList.Items.Count > 0)
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Visible;
|
||||
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
backlog.type = ToDoType.NEW;
|
||||
backlog.IsNewToDo.Text = "Y";
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -121,21 +98,6 @@ namespace GeekDesk.Control.Windows
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
public static void ShowOrHide()
|
||||
{
|
||||
if (window == null || !window.Activate())
|
||||
{
|
||||
window = new ToDoWindow();
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
|
||||
@@ -22,24 +22,16 @@
|
||||
<StackPanel HorizontalAlignment="Center">
|
||||
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
||||
<!--Card 的内容部分-->
|
||||
<Border CornerRadius="4,4,0,0">
|
||||
<StackPanel>
|
||||
<hc:SimplePanel VerticalAlignment="Center">
|
||||
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
||||
<Button HorizontalAlignment="Right" Margin="0,0,10,0"
|
||||
Content="去点个Star" Click="StarBtnClick"
|
||||
Style="{StaticResource Btn1}"
|
||||
hc:IconElement.Geometry="M718.565517 863.126069c-7.344552 0-15.077517-2.189241-22.987034-6.285241L512 760.337655l-183.613793 96.503173c-18.785103 9.851586-37.499586 7.521103-48.16331-5.12-5.12-6.10869-10.557793-17.125517-7.485794-35.345656l35.063173-204.411586L159.249655 467.155862c-12.747034-12.393931-17.584552-27.153655-13.241379-40.430345 4.343172-13.312 16.913655-22.386759 34.568827-24.929103l205.223725-29.837242 91.806896-185.979586c7.874207-15.995586 20.409379-25.140966 34.392276-25.140965 13.947586 0 26.482759 9.145379 34.392276 25.140965l91.771586 185.979586 205.259035 29.837242c17.619862 2.577655 30.190345 11.652414 34.498206 24.964414 4.378483 13.27669-0.529655 28.001103-13.241379 40.430344l-148.51531 144.807725 35.063172 204.411586c3.10731 18.149517-2.365793 29.272276-7.485793 35.345655a32.273655 32.273655 0 0 1-25.176276 11.369931z"
|
||||
/>
|
||||
</hc:SimplePanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Margin="20,0,20,0"/>
|
||||
<hc:ScrollViewer BorderThickness="0" Margin="0,5,1,5" Height="225">
|
||||
<StackPanel x:Name="MsgPanel">
|
||||
<TextBlock Width="430" FontSize="15" LineHeight="25" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text="测试"/>
|
||||
</StackPanel>
|
||||
<Border CornerRadius="4,4,0,0" Height="260">
|
||||
<StackPanel>
|
||||
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
||||
<StackPanel x:Name="MsgPanel">
|
||||
<hc:ScrollViewer x:Name="MsgBar" HorizontalScrollBarVisibility="Visible" IsInertiaEnabled="True" Margin="10" Width="430">
|
||||
<TextBlock Width="430" FontSize="15" LineHeight="22" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text="测试"/>
|
||||
</hc:ScrollViewer>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!--Card 的尾部部分-->
|
||||
<hc:Card.Footer>
|
||||
<StackPanel Margin="10" Width="520">
|
||||
@@ -55,7 +47,7 @@
|
||||
</hc:Card.Footer>
|
||||
</hc:Card>
|
||||
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||
<Button Content="暂不更新" Click="Close_Click" Style="{StaticResource Btn1}"/>
|
||||
<Button Content="暂不更新" Click="Close_Click" />
|
||||
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -4,11 +4,20 @@ using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
@@ -33,7 +42,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,7 +68,7 @@ namespace GeekDesk.Control.Windows
|
||||
githubUrl = StringUtil.IsEmpty(jo["githubUrl"]) ? ConfigurationManager.AppSettings["GitHubUrl"] : jo["githubUrl"].ToString();
|
||||
giteeUrl = StringUtil.IsEmpty(jo["giteeUrl"]) ? ConfigurationManager.AppSettings["GiteeUrl"] : jo["giteeUrl"].ToString();
|
||||
string msg = "";
|
||||
for (int i = 0; i < ja.Count; i++)
|
||||
for (int i=0; i<ja.Count; i++)
|
||||
{
|
||||
msg += "• " + ja[i].ToString() + "\n";
|
||||
}
|
||||
@@ -83,11 +92,7 @@ namespace GeekDesk.Control.Windows
|
||||
packageUrl = giteeUrl;
|
||||
break;
|
||||
}
|
||||
Process.Start(new ProcessStartInfo("cmd", $"/c start {packageUrl}")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
Process.Start(packageUrl);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -99,7 +104,6 @@ namespace GeekDesk.Control.Windows
|
||||
window = new UpdateWindow(jo);
|
||||
}
|
||||
window.Show();
|
||||
window.Activate();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
@@ -111,59 +115,5 @@ namespace GeekDesk.Control.Windows
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void StarBtnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
string githubUrl = ConfigurationManager.AppSettings["GitHubUrl"];
|
||||
string giteeUrl = ConfigurationManager.AppSettings["GiteeUrl"];
|
||||
|
||||
if(!ReqGitUrl(githubUrl))
|
||||
{
|
||||
if (!ReqGitUrl(giteeUrl))
|
||||
{
|
||||
OpenLinkUrl(githubUrl);
|
||||
} else
|
||||
{
|
||||
OpenLinkUrl(giteeUrl);
|
||||
}
|
||||
} else
|
||||
{
|
||||
OpenLinkUrl(githubUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ReqGitUrl(String url)
|
||||
{
|
||||
HttpWebResponse myResponse = null;
|
||||
try
|
||||
{
|
||||
ServicePointManager.Expect100Continue = true;
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
//创建Web访问对 象
|
||||
WebRequest myRequest = WebRequest.Create(url);
|
||||
|
||||
myRequest.ContentType = "text/plain; charset=utf-8";
|
||||
//通过Web访问对象获取响应内容
|
||||
myResponse = (HttpWebResponse)myRequest.GetResponse();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return myResponse != null && myResponse.StatusCode == HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
private void OpenLinkUrl(String url)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
class BGStyleConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (BGStyle)value == (BGStyle)int.Parse(parameter.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool isChecked = (bool)value;
|
||||
if (!isChecked)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (BGStyle)int.Parse(parameter.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class Count2VisibleConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null) return Visibility.Collapsed;
|
||||
int count = (int)value;
|
||||
|
||||
if (parameter == null || "Y".Equals(parameter.ToString()))
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (count <= 0)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class CountGreZero2BoolConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null) return false;
|
||||
int count = (int)value;
|
||||
if (count > 0)
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class HideTypeConvert : IValueConverter
|
||||
public class HideTypeConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System;
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class MenuInfoConvert : IValueConverter
|
||||
public class MenuInfoConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
@@ -12,8 +17,7 @@ namespace GeekDesk.Converts
|
||||
if (menuIndex == -1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
string type = parameter.ToString();
|
||||
if ("1".Equals(type))
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
@@ -8,17 +13,8 @@ namespace GeekDesk.Converts
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string param = parameter as string;
|
||||
if ("1".Equals(param))
|
||||
{
|
||||
double menuLeftWidth = double.Parse(value.ToString());
|
||||
return MainWindow.mainWindow.Width - menuLeftWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
double menuLeftWidth = double.Parse(value.ToString());
|
||||
return (MainWindow.mainWindow.Width - menuLeftWidth) / 2;
|
||||
}
|
||||
double menuLeftWidth = double.Parse(value.ToString());
|
||||
return MainWindow.mainWindow.Width - menuLeftWidth;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class SearchTypeConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (SearchType)value == (SearchType)int.Parse(parameter.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool isChecked = (bool)value;
|
||||
if (!isChecked)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (SearchType)int.Parse(parameter.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class SortTypeConvert : IValueConverter
|
||||
public class SortTypeConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
class StringAppendConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null) return null;
|
||||
if (parameter == null)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
string val = value.ToString();
|
||||
string param = parameter.ToString();
|
||||
return param.Replace("{}", val);
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class TodoTaskExecConvert : IValueConverter
|
||||
public class TodoTaskExecConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
internal class Visibility2BooleanConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if ((Visibility)value == Visibility.Visible)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if ((bool)value)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,21 +15,6 @@
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -142,15 +127,11 @@
|
||||
<Compile Include="Command\DelegateCommandBase.cs" />
|
||||
<Compile Include="Constant\AppHideType.cs" />
|
||||
<Compile Include="Constant\Constants.cs" />
|
||||
<Compile Include="Constant\HotKeyType.cs" />
|
||||
<Compile Include="Constant\IconType.cs" />
|
||||
<Compile Include="Constant\CommonEnum.cs" />
|
||||
<Compile Include="Constant\IconStartType.cs" />
|
||||
<Compile Include="Constant\RunTimeStatus.cs" />
|
||||
<Compile Include="Constant\SearchType.cs" />
|
||||
<Compile Include="Constant\SortType.cs" />
|
||||
<Compile Include="Constant\TodoTaskExecType.cs" />
|
||||
<Compile Include="Constant\BGStyle.cs" />
|
||||
<Compile Include="Constant\UpdateType.cs" />
|
||||
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
||||
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
||||
@@ -158,12 +139,6 @@
|
||||
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
||||
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
|
||||
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\Other\MyColorPickerDialog.xaml.cs">
|
||||
<DependentUpon>MyColorPickerDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
|
||||
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -179,12 +154,6 @@
|
||||
<Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs">
|
||||
<DependentUpon>IconPannel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\Windows\GlobalColorPickerWindow.xaml.cs">
|
||||
<DependentUpon>GlobalColorPickerWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\Windows\PixelColorPickerWindow.xaml.cs">
|
||||
<DependentUpon>PixelColorPickerWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\Windows\SystemItemWindow.xaml.cs">
|
||||
<DependentUpon>SystemItemWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -221,20 +190,14 @@
|
||||
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
||||
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converts\CountGreZero2BoolConvert.cs" />
|
||||
<Compile Include="Converts\Count2VisibleConvert.cs" />
|
||||
<Compile Include="Converts\SearchTypeConvert.cs" />
|
||||
<Compile Include="Converts\StringAppendConvert.cs" />
|
||||
<Compile Include="Converts\DoubleToGridLength.cs" />
|
||||
<Compile Include="Converts\MenuInfoConvert.cs" />
|
||||
<Compile Include="Converts\SearchResWidth.cs" />
|
||||
<Compile Include="Converts\DoubleToGridLength.cs" />
|
||||
<Compile Include="Converts\SortTypeConvert.cs" />
|
||||
<Compile Include="Converts\MenuInfoConvert.cs" />
|
||||
<Compile Include="Converts\TodoTaskExecConvert.cs" />
|
||||
<Compile Include="Converts\IntToCornerRadius.cs" />
|
||||
<Compile Include="Converts\OpcityConvert.cs" />
|
||||
<Compile Include="Converts\BGStyleConvert.cs" />
|
||||
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
||||
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
|
||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||
<Compile Include="Converts\HideTypeConvert.cs" />
|
||||
@@ -244,19 +207,20 @@
|
||||
<Compile Include="MyThread\DispatcherBuild.cs" />
|
||||
<Compile Include="MyThread\UpdateThread.cs" />
|
||||
<Compile Include="Util\AeroGlassHelper.cs" />
|
||||
<Compile Include="Util\BGSettingUtil.cs" />
|
||||
<Compile Include="Util\ColorUtil.cs" />
|
||||
<Compile Include="Util\GlobalHotKey.cs" />
|
||||
<Compile Include="Util\CommonCode.cs" />
|
||||
<Compile Include="Util\ConsoleManager.cs" />
|
||||
<Compile Include="Util\DragAdorner.cs" />
|
||||
<Compile Include="Util\FileIcon.cs" />
|
||||
<Compile Include="Util\FileUtil.cs" />
|
||||
<Compile Include="Util\KeyUtil.cs" />
|
||||
<Compile Include="Util\LogUtil.cs" />
|
||||
<Compile Include="Util\MarginHide.cs" />
|
||||
<Compile Include="Util\HttpUtil.cs" />
|
||||
<Compile Include="Util\ImageUtil.cs" />
|
||||
<Compile Include="Util\ListViewDragDropManager.cs" />
|
||||
<Compile Include="Converts\MenuWidthConvert.cs" />
|
||||
<Compile Include="Util\MouseUtil.cs" />
|
||||
<Compile Include="Util\MouseUtilities.cs" />
|
||||
<Compile Include="Util\RegisterUtil.cs" />
|
||||
<Compile Include="Util\ShellContextMenu.cs" />
|
||||
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||
@@ -264,9 +228,6 @@
|
||||
<Compile Include="Util\SvgToGeometry.cs" />
|
||||
<Compile Include="ViewModel\AppConfig.cs" />
|
||||
<Compile Include="ViewModel\AppData.cs" />
|
||||
<Compile Include="ViewModel\GradientBGParam.cs" />
|
||||
<Compile Include="ViewModel\CPDataContext.cs" />
|
||||
<Compile Include="ViewModel\Temp\GradientBGParamList.cs" />
|
||||
<Compile Include="ViewModel\Temp\SearchIconList.cs" />
|
||||
<Compile Include="ViewModel\ToDoInfo.cs" />
|
||||
<Compile Include="ViewModel\IconfontInfo.cs" />
|
||||
@@ -280,14 +241,6 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Control\Other\GradientBGDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Control\Other\MyColorPickerDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Control\Other\IconInfoUrlDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -308,14 +261,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Control\Windows\GlobalColorPickerWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Control\Windows\PixelColorPickerWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Control\Windows\SystemItemWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -460,22 +405,6 @@
|
||||
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties update_1json__JsonSchema="https://typedoc.org/schema.json" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32319.34
|
||||
# Blend for Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30907.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}"
|
||||
EndProject
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
using System.Windows.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Interface
|
||||
{
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:cn="clr-namespace:GeekDesk.Constant"
|
||||
mc:Ignorable="d"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
x:Name="AppWindow"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||
x:Name="window"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||
Title="GeekDesk"
|
||||
MinWidth="600"
|
||||
MinHeight="400"
|
||||
@@ -18,36 +16,28 @@
|
||||
Background="Transparent"
|
||||
ShowInTaskbar="False"
|
||||
Opacity="0"
|
||||
Deactivated="AppWindow_Deactivated"
|
||||
Deactivated="App_LostFocus"
|
||||
SizeChanged="Window_SizeChanged"
|
||||
KeyDown="OnKeyDown"
|
||||
Focusable="True"
|
||||
MouseDown="MainWindow_MouseDown"
|
||||
MouseEnter="MainWindow_MouseEnter"
|
||||
GotFocus="Window_GotFocus"
|
||||
>
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.Resources>
|
||||
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
|
||||
<RoutedUICommand x:Key="SearchItem" Text="SearchItem"/>
|
||||
|
||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
||||
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
||||
<Style x:Key="BorderBacStyle" TargetType="Border">
|
||||
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
|
||||
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchItem}"/>
|
||||
</Window.InputBindings>
|
||||
<Window.CommandBindings>
|
||||
<CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
|
||||
<!--<CommandBinding Command="ChangeImgBG" Executed="ChangeImgBG_Executed" CanExecute="ChangeImgBG_CanExecute" />-->
|
||||
|
||||
<CommandBinding Command="{StaticResource SearchItem}" CanExecute="SearchItem"/>
|
||||
</Window.CommandBindings>
|
||||
|
||||
<Window.Effect>
|
||||
@@ -57,16 +47,29 @@
|
||||
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
||||
Background="AliceBlue"
|
||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
hc:Dialog.Token="IconInfoDialog"
|
||||
Focusable="True"
|
||||
>
|
||||
<hc:DialogContainer Focusable="True">
|
||||
<!-- -1是为了解决圆角白线的问题-->
|
||||
<Border x:Name="BGBorder"
|
||||
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
||||
BorderThickness="0"
|
||||
Margin="-1"
|
||||
>
|
||||
|
||||
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
||||
<!--背景图片-->
|
||||
<Border.Background>
|
||||
<VisualBrush>
|
||||
<VisualBrush.Visual>
|
||||
<Grid ClipToBounds="True">
|
||||
<Image Source="{Binding AppConfig.BitmapImage}" Margin="-30" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||
<Image.Effect>
|
||||
<BlurEffect Radius="{Binding AppConfig.BlurValue}"/>
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
</Grid>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Border.Background>
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||
@@ -85,7 +88,7 @@
|
||||
<DockPanel.Background>
|
||||
<SolidColorBrush Opacity="0.01"/>
|
||||
</DockPanel.Background>
|
||||
<Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
|
||||
<Image Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
|
||||
@@ -133,23 +136,24 @@
|
||||
<!--搜索输入框-->
|
||||
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
|
||||
x:Name="SearchBox"
|
||||
Width="0"
|
||||
Visibility="Collapsed"
|
||||
LostFocus="SearchBox_LostFocus"
|
||||
Margin="-100,5,0,0"
|
||||
Height="32"
|
||||
FontSize="16"
|
||||
Width="400"
|
||||
BorderThickness="0"
|
||||
TextChanged="SearchBox_TextChanged"
|
||||
/>
|
||||
|
||||
|
||||
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
|
||||
|
||||
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
|
||||
MouseRightButtonDown="BarIcon_MouseRightButtonDown"
|
||||
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||
<hc:NotifyIcon.ContextMenu>
|
||||
<ContextMenu Width="130" x:Name="TaskbarContextMenu">
|
||||
<ContextMenu Width="130">
|
||||
<MenuItem Header="打开面板" Click="ShowApp"/>
|
||||
<MenuItem Header="拾色器" Click="ColorPicker"/>
|
||||
<MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
|
||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
||||
|
||||
@@ -2,22 +2,21 @@
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Task;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using NPinyin;
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||
using System.Collections.ObjectModel;
|
||||
using NPinyin;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
|
||||
namespace GeekDesk
|
||||
{
|
||||
@@ -32,7 +31,6 @@ namespace GeekDesk
|
||||
public static ToDoInfoWindow toDoInfoWindow;
|
||||
public static int hotKeyId = -1;
|
||||
public static int toDoHotKeyId = -1;
|
||||
public static int colorPickerHotKeyId = -1;
|
||||
public static MainWindow mainWindow;
|
||||
public MainWindow()
|
||||
{
|
||||
@@ -53,25 +51,15 @@ namespace GeekDesk
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 显示搜索框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchHotKeyDown(object sender, CanExecuteRoutedEventArgs e)
|
||||
private void SearchItem(object sender, CanExecuteRoutedEventArgs e)
|
||||
{
|
||||
if (appData.AppConfig.SearchType == SearchType.HOT_KEY)
|
||||
{
|
||||
ShowSearchBox();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowSearchBox()
|
||||
{
|
||||
RunTimeStatus.SEARCH_BOX_SHOW = true;
|
||||
RightCard.VisibilitySearchCard(Visibility.Visible);
|
||||
SearchBox.Width = 400;
|
||||
SearchBox.Visibility = Visibility.Visible;
|
||||
SearchBox.Focus();
|
||||
}
|
||||
/// <summary>
|
||||
@@ -81,20 +69,7 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!RunTimeStatus.SEARCH_BOX_SHOW
|
||||
&& appData.AppConfig.SearchType != SearchType.KEY_DOWN
|
||||
)
|
||||
{
|
||||
SearchBox.TextChanged -= SearchBox_TextChanged;
|
||||
SearchBox.Clear();
|
||||
SearchBox.TextChanged += SearchBox_TextChanged;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RunTimeStatus.SEARCH_BOX_SHOW) ShowSearchBox();
|
||||
|
||||
string inputText = SearchBox.Text.ToLower();
|
||||
RightCard.VerticalUFG.Visibility = Visibility.Collapsed;
|
||||
if (!string.IsNullOrEmpty(inputText))
|
||||
{
|
||||
SearchIconList.IconList.Clear();
|
||||
@@ -105,31 +80,27 @@ namespace GeekDesk
|
||||
foreach (IconInfo icon in iconList)
|
||||
{
|
||||
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
|
||||
if (icon.Name.Contains(inputText) || pyName.Contains(inputText))
|
||||
{
|
||||
if (icon.Name.Contains(inputText) || pyName.Contains(inputText)) {
|
||||
SearchIconList.IconList.Add(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
SearchIconList.IconList.Clear();
|
||||
}
|
||||
RightCard.VerticalUFG.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public void HidedSearchBox()
|
||||
/// <summary>
|
||||
/// 隐藏搜索框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchBox_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RunTimeStatus.SEARCH_BOX_SHOW = false;
|
||||
SearchBox.TextChanged -= SearchBox_TextChanged;
|
||||
SearchBox.Clear();
|
||||
SearchBox.TextChanged += SearchBox_TextChanged;
|
||||
SearchBox.Width = 0;
|
||||
SearchIconList.IconList.Clear();
|
||||
RightCard.VisibilitySearchCard(Visibility.Collapsed);
|
||||
Keyboard.Focus(SearchBox);
|
||||
App.DoEvents();
|
||||
SearchBox.Visibility = Visibility.Collapsed;
|
||||
SearchBox.Text = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -138,6 +109,7 @@ namespace GeekDesk
|
||||
/// </summary>
|
||||
private void LoadData()
|
||||
{
|
||||
GC.KeepAlive(appData); // 持活
|
||||
this.DataContext = appData;
|
||||
if (appData.MenuList.Count == 0)
|
||||
{
|
||||
@@ -148,7 +120,6 @@ namespace GeekDesk
|
||||
this.Height = appData.AppConfig.WindowHeight;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 窗口加载完毕 执行方法
|
||||
/// </summary>
|
||||
@@ -156,7 +127,6 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BGSettingUtil.BGSetting();
|
||||
if (!appData.AppConfig.StartedShowPanel)
|
||||
{
|
||||
if (appData.AppConfig.AppAnimation)
|
||||
@@ -177,19 +147,8 @@ namespace GeekDesk
|
||||
BarIcon.Text = Constants.MY_NAME;
|
||||
|
||||
//注册热键
|
||||
if (true == appData.AppConfig.EnableAppHotKey)
|
||||
{
|
||||
RegisterHotKey(true);
|
||||
}
|
||||
if (true == appData.AppConfig.EnableTodoHotKey)
|
||||
{
|
||||
RegisterCreateToDoHotKey(true);
|
||||
}
|
||||
|
||||
if (true == appData.AppConfig.EnableColorPickerHotKey)
|
||||
{
|
||||
RegisterColorPickerHotKey(true);
|
||||
}
|
||||
RegisterHotKey(true);
|
||||
RegisterCreateToDoHotKey(true);
|
||||
|
||||
//注册自启动
|
||||
if (!appData.AppConfig.SelfStartUped && !Constants.DEV)
|
||||
@@ -214,8 +173,9 @@ namespace GeekDesk
|
||||
{
|
||||
try
|
||||
{
|
||||
if (appData.AppConfig.HotkeyModifiers != GlobalHotKey.HotkeyModifiers.None)
|
||||
if (appData.AppConfig.HotkeyModifiers != 0)
|
||||
{
|
||||
|
||||
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
||||
{
|
||||
if (MotionControl.hotkeyFinished)
|
||||
@@ -230,12 +190,10 @@ namespace GeekDesk
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!first)
|
||||
{
|
||||
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
|
||||
}
|
||||
} else
|
||||
}
|
||||
if (!first)
|
||||
{
|
||||
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -262,22 +220,21 @@ namespace GeekDesk
|
||||
try
|
||||
{
|
||||
|
||||
if (appData.AppConfig.HotkeyModifiers != GlobalHotKey.HotkeyModifiers.None)
|
||||
if (appData.AppConfig.ToDoHotkeyModifiers != 0)
|
||||
{
|
||||
//加载完毕注册热键
|
||||
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
||||
{
|
||||
if (MotionControl.hotkeyFinished)
|
||||
{
|
||||
ToDoWindow.ShowOrHide();
|
||||
ToDoInfoWindow.ShowOrHide();
|
||||
}
|
||||
});
|
||||
if (!first)
|
||||
{
|
||||
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
|
||||
}
|
||||
}
|
||||
|
||||
if (!first)
|
||||
{
|
||||
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -292,42 +249,6 @@ namespace GeekDesk
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册新建待办的热键
|
||||
/// </summary>
|
||||
public static void RegisterColorPickerHotKey(bool first)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (appData.AppConfig.HotkeyModifiers != GlobalHotKey.HotkeyModifiers.None)
|
||||
{
|
||||
//加载完毕注册热键
|
||||
colorPickerHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ColorPickerHotkeyModifiers, appData.AppConfig.ColorPickerHotkey, () =>
|
||||
{
|
||||
if (MotionControl.hotkeyFinished)
|
||||
{
|
||||
GlobalColorPickerWindow.CreateNoShow();
|
||||
}
|
||||
});
|
||||
if (!first)
|
||||
{
|
||||
HandyControl.Controls.Growl.Success("拾色器快捷键注册成功(" + appData.AppConfig.ColorPickerHotkeyStr + ")!", "HotKeyGrowl");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("拾色器快捷键已被其它程序占用(" + appData.AppConfig.ColorPickerHotkeyStr + ")!");
|
||||
}
|
||||
else
|
||||
{
|
||||
HandyControl.Controls.Growl.Warning("拾色器快捷键已被其它程序占用(" + appData.AppConfig.ColorPickerHotkeyStr + ")!", "HotKeyGrowl");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重置窗体大小 写入缓存
|
||||
@@ -388,7 +309,14 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HideApp();
|
||||
if (appData.AppConfig.AppAnimation)
|
||||
{
|
||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -410,7 +338,7 @@ namespace GeekDesk
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void ShowApp(object sender, RoutedEventArgs e)
|
||||
private void ShowApp(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowApp();
|
||||
}
|
||||
@@ -421,51 +349,21 @@ namespace GeekDesk
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//修改贴边隐藏状态为未隐藏
|
||||
mainWindow.Activate();
|
||||
|
||||
MainWindow.mainWindow.Activate();
|
||||
|
||||
if (MarginHide.ON_HIDE)
|
||||
{
|
||||
//修改贴边隐藏状态为未隐藏
|
||||
MarginHide.IS_HIDE = false;
|
||||
if (!CommonCode.MouseInWindow(mainWindow))
|
||||
{
|
||||
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = true;
|
||||
MarginHide.WaitHide(3000);
|
||||
}
|
||||
}
|
||||
|
||||
MarginHide.IS_HIDE = false;
|
||||
if (appData.AppConfig.FollowMouse)
|
||||
{
|
||||
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
||||
}
|
||||
|
||||
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||
Keyboard.Focus(mainWindow);
|
||||
Keyboard.Focus(mainWindow.SearchBox);
|
||||
mainWindow.Focus();
|
||||
}
|
||||
|
||||
public static void HideApp()
|
||||
{
|
||||
if (!MarginHide.IS_HIDE)
|
||||
{
|
||||
//关闭锁定
|
||||
RunTimeStatus.LOCK_APP_PANEL = false;
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
mainWindow.HidedSearchBox();
|
||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||
}
|
||||
else
|
||||
{
|
||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowApp();
|
||||
}
|
||||
|
||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -597,11 +495,10 @@ namespace GeekDesk
|
||||
SettingButton.ContextMenu = null;
|
||||
}
|
||||
|
||||
|
||||
private void AppWindowLostFocus()
|
||||
private void App_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS
|
||||
&& this.Opacity == 1 && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
&& this.Opacity == 1)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (!appData.AppConfig.MarginHide || (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE))
|
||||
@@ -611,7 +508,6 @@ namespace GeekDesk
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (this.DataContext != null)
|
||||
@@ -670,26 +566,12 @@ namespace GeekDesk
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
//char c = (char)e.Key;
|
||||
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
HideApp();
|
||||
}
|
||||
//else if (
|
||||
// appData.AppConfig.SearchType == SearchType.KEY_DOWN &&
|
||||
// (
|
||||
// (e.Key >= Key.D0 && e.Key <= Key.Z)
|
||||
// || (e.Key >= Key.NumPad0 && e.Key < Key.NumPad9)
|
||||
// )
|
||||
// )
|
||||
//{
|
||||
// ShowSearchBox();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 为了让修改菜单的textBox失去焦点
|
||||
/// </summary>
|
||||
@@ -697,50 +579,8 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
SearchBox.Focus();
|
||||
EmptyTextBox.Focus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标进入后
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MainWindow_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
//防止延迟贴边隐藏
|
||||
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开屏幕拾色器
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ColorPicker(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TaskbarContextMenu.Visibility = Visibility.Collapsed;
|
||||
App.DoEvents();
|
||||
GlobalColorPickerWindow.CreateNoShow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防止点击拾色器后无法显示菜单的问题
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BarIcon_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TaskbarContextMenu.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Window_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Keyboard.Focus(SearchBox);
|
||||
}
|
||||
|
||||
private void AppWindow_Deactivated(object sender, EventArgs e)
|
||||
{
|
||||
AppWindowLostFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
||||
@@ -20,6 +20,7 @@
|
||||
SizeChanged="Window_SizeChanged"
|
||||
KeyDown="OnKeyDown"
|
||||
Focusable="True"
|
||||
+ GotFocus="MainWindow_GotFocus"
|
||||
MouseDown="MainWindow_MouseDown"
|
||||
>
|
||||
<WindowChrome.WindowChrome>
|
||||
@@ -1,4 +1,9 @@
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace GeekDesk.MyThread
|
||||
@@ -20,7 +25,6 @@ namespace GeekDesk.MyThread
|
||||
manualResetEvent.Set();
|
||||
Dispatcher.Run();
|
||||
});
|
||||
thread.IsBackground = true;
|
||||
thread.Start();
|
||||
manualResetEvent.WaitOne();
|
||||
manualResetEvent.Dispose();
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
using GeekDesk.ViewModel;
|
||||
using Gma.System.MouseKeyHook;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
@@ -19,16 +24,15 @@ namespace GeekDesk.MyThread
|
||||
{
|
||||
//使用dispatcher来单独监听UI线程 防止程序卡顿
|
||||
dispatcher = DispatcherBuild.Build();
|
||||
m_GlobalHook = Hook.GlobalEvents();
|
||||
dispatcher.BeginInvoke((Action)(() =>
|
||||
dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt;
|
||||
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void Dispose()
|
||||
{
|
||||
m_GlobalHook.MouseUpExt -= M_GlobalHook_MouseUpExt;
|
||||
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
|
||||
m_GlobalHook.Dispose();
|
||||
dispatcher.InvokeShutdown();
|
||||
}
|
||||
@@ -38,13 +42,13 @@ namespace GeekDesk.MyThread
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void M_GlobalHook_MouseUpExt(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
private static void M_GlobalHook_MouseDownExt(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if (appConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
|
||||
{
|
||||
if (MotionControl.hotkeyFinished)
|
||||
{
|
||||
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
|
||||
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
||||
{
|
||||
|
||||
@@ -4,8 +4,13 @@ using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace GeekDesk.MyThread
|
||||
{
|
||||
@@ -27,13 +32,7 @@ namespace GeekDesk.MyThread
|
||||
{
|
||||
|
||||
//等待1分钟后再检查更新 有的网络连接过慢
|
||||
int sleepTime = 60 * 1000;
|
||||
if (Constants.DEV)
|
||||
{
|
||||
sleepTime = 1;
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(sleepTime);
|
||||
System.Threading.Thread.Sleep(60 * 1000);
|
||||
|
||||
string updateUrl;
|
||||
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
||||
@@ -60,8 +59,7 @@ namespace GeekDesk.MyThread
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
} catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "获取更新失败!");
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Windows;
|
||||
[assembly: AssemblyTitle("GeekDesk")]
|
||||
[assembly: AssemblyDescription("小巧、美观的桌面快速启动工具")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("BookerLiu")]
|
||||
[assembly: AssemblyCompany("Demo-Liu")]
|
||||
[assembly: AssemblyProduct("GeekDesk")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.4.1.5")]
|
||||
[assembly: AssemblyFileVersion("2.4.1.5")]
|
||||
[assembly: AssemblyVersion("2.4.1.3")]
|
||||
[assembly: AssemblyFileVersion("2.4.1.3")]
|
||||
|
||||
73
README.md
73
README.md
@@ -1,77 +1,46 @@
|
||||
# GeekDesk 极客桌面
|
||||
小巧、**美观**的桌面快速启动管理工具
|
||||
|
||||
———— 大风, 雨夜...
|
||||
「你来了」
|
||||
「我来了」
|
||||
谈一谈做GeekDesk的原因:
|
||||
|
||||
「你究竟想干什么!」
|
||||
「我想做一款软件, 这个软件要Cool」
|
||||
|
||||
「什么软件?」
|
||||
「从最常用的桌面开始吧」
|
||||
目前的市场上也有一部分桌面图标管理工具, 但是**界面好点的收费**, **免费的界面差**
|
||||
**windows11**都来了, 难道还要用界面停留在**win7时代**的软件吗
|
||||
|
||||
「哼!现在的软件多入牛毛, 会差你一个吗」
|
||||
「我不知道, 但是我想做」
|
||||
所以就萌生了做这款软件的想法, **免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
|
||||
目前GeekDesk只有一个人在开发, 大家如果有好的建议也可以提Issue
|
||||
|
||||
「你以为凭你一个人的力量能在这大海里掀起什么波浪吗」
|
||||
「但只要我想就够了, 这是我的梦想!」
|
||||
|
||||
「梦想? 可笑, 这世界哪有什么梦想. 不过是一日三餐, 车子和房!」
|
||||
「我想...就够了...」
|
||||
|
||||
「...」
|
||||
———— 雨停, 狂风仍在呼啸...
|
||||
|
||||
<img src="https://s4.ax1x.com/2021/12/15/TSrwfU.png" a border="0" width="800px"/>
|
||||
|
||||
|
||||
**免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
|
||||
|
||||
目前GeekDesk只有一个人在开发所以想法有限, 大家如果有好的建议也可以提Issue
|
||||
|
||||
另外如果你喜欢 GeekDesk的话, 或许可以为作者购买防脱洗发水
|
||||
当然, 点个**Star**也是对作者的激励哦~ 😊😊😊
|
||||
|
||||
|
||||
### GitHub
|
||||
[https://github.com/Demo-Liu/GeekDesk](https://github.com/Demo-Liu/GeekDesk)
|
||||
### 码云
|
||||
[https://gitee.com/demo_liu/GeekDesk](https://gitee.com/demo_liu/GeekDesk)
|
||||
|
||||
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
|
||||
## 开发框架
|
||||
- wpf
|
||||
- .net 4.7.2
|
||||
- [HandyControl](https://github.com/HandyOrg/HandyControl)
|
||||
|
||||
## 全局热键 一键呼出 鼠标跟随
|
||||
- 自定义热键 设置并使用自己习惯的快捷键
|
||||
- 一键呼出 使用鼠标中键呼出
|
||||
- 鼠标跟随 自动追随鼠标位置
|
||||
<img src="https://s4.ax1x.com/2021/12/15/TSlg8f.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
|
||||
## 全局热键 鼠标跟随 快速启动 随时随地
|
||||
- 支持自定义热键
|
||||
- 支持鼠标跟随
|
||||
<img src="https://z3.ax1x.com/2021/07/19/WJt4hQ.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
|
||||
|
||||
## 自定义壁纸
|
||||
- 随意选择自己喜欢的壁纸
|
||||
<img src="https://s4.ax1x.com/2021/12/15/TSNx4H.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
|
||||
|
||||
[](https://imgtu.com/i/WJlcIs)
|
||||
|
||||
## 毛玻璃等界面效果
|
||||
- 背景图片毛玻璃效果
|
||||
- 界面透明度
|
||||
- 界面圆角
|
||||
<img src="https://s4.ax1x.com/2021/12/15/TSabTO.gif" alt="WGOYSU.gif" border="0" width="800px"/>
|
||||
<img src="https://z3.ax1x.com/2021/07/19/WGOYSU.gif" alt="WGOYSU.gif" border="0" width="800px"/>
|
||||
|
||||
## 自定义菜单图标
|
||||
- 80多个系统图标可供选择
|
||||
- 另支持在线导入阿里巴巴icon图标
|
||||
- ~~篇幅原因,公众号内回复 **自定义图标** 可以查看教程~~ 现在软件内已经贴上教程链接啦 也欢迎大家关注我的公众号:blush:
|
||||
<img src="https://s4.ax1x.com/2021/12/15/TSd1NF.gif" border="0" width="800px"/>
|
||||
- 篇幅原因,公众号内回复 **自定义图标** 可以查看教程
|
||||
<img src="https://z3.ax1x.com/2021/07/19/WJ3fDU.png" alt="WJ3fDU.png" border="0" width="450px"/>
|
||||
|
||||
## 定时提醒 永不忘记
|
||||
- 快捷键快速新建待办事项
|
||||
<img src="https://s4.ax1x.com/2021/12/15/TSDCvj.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"/>
|
||||
|
||||
## 开发框架
|
||||
- wpf
|
||||
- .net 4.7.2
|
||||
- [HandyControl](https://github.com/HandyOrg/HandyControl)
|
||||
|
||||
## Stargazers over time
|
||||
[](https://starchart.cc/Demo-Liu/GeekDesk)
|
||||
## LICENSE
|
||||
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
||||
- 商用需联系作者
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
M1021.72444445 512a495.16088889 495.16088889 0 0 1-97.57582223 299.64515555 500.62222222 500.62222222 0 0 1-250.85724444 184.22897778 30.58346667 30.58346667 0 0 1-26.2144-4.73315555 25.85031111 25.85031111 0 0 1-8.00995556-20.02488889v-139.81013334a119.05706667 119.05706667 0 0 0-34.58844444-94.29902222 473.31555555 473.31555555 0 0 0 67.72053333-11.65084444 248.30862222 248.30862222 0 0 0 62.2592-26.2144 187.50577778 187.50577778 0 0 0 53.52106667-43.69066667 209.35111111 209.35111111 0 0 0 36.40888889-69.90506667 334.2336 334.2336 0 0 0 13.83537778-100.12444444 191.87484445 191.87484445 0 0 0-52.7928889-136.53333333 176.21902222 176.21902222 0 0 0-5.09724444-135.44106667 87.01724445 87.01724445 0 0 0-53.52106666 7.28177778 341.87946667 341.87946667 0 0 0-61.16693334 29.12711111l-25.12213333 15.65582222a473.31555555 473.31555555 0 0 0-254.86222223 0c-7.28177778-5.09724445-16.384-10.55857778-28.03484444-17.84035555A371.00657778 371.00657778 0 0 0 300.82844445 220.72888889a94.29902222 94.29902222 0 0 0-57.16195556-9.10222222 178.40355555 178.40355555 0 0 0-4.73315556 136.53333333 197.70026667 197.70026667 0 0 0-52.4288 137.26151111A327.68 327.68 0 0 0 200.33991111 584.81777778a223.55057778 223.55057778 0 0 0 36.40888889 69.90506667 172.94222222 172.94222222 0 0 0 53.52106667 44.41884444 304.7424 304.7424 0 0 0 62.2592 26.2144 471.13102222 471.13102222 0 0 0 68.08462222 11.65084444 105.22168889 105.22168889 0 0 0-32.768 68.44871112 112.86755555 112.86755555 0 0 1-30.21937778 9.4663111 190.41848889 190.41848889 0 0 1-36.40888889 3.2768A78.6432 78.6432 0 0 1 274.61404445 803.27111111a124.5184 124.5184 0 0 1-36.4088889-41.50613333 109.22666667 109.22666667 0 0 0-32.03982222-34.58844445 91.7504 91.7504 0 0 0-32.768-16.01991111h-13.1072a47.33155555 47.33155555 0 0 0-19.29671111 2.91271111q-5.46133333 3.2768-3.2768 7.64586667a50.24426667 50.24426667 0 0 0 6.18951111 9.10222222 62.98737778 62.98737778 0 0 0 8.73813334 8.37404445l4.73315555 2.91271111a88.83768889 88.83768889 0 0 1 29.12711111 25.12213333 179.49582222 179.49582222 0 0 1 20.75306667 33.49617778l6.5536 15.29173333a82.28408889 82.28408889 0 0 0 29.12711111 41.14204445 109.22666667 109.22666667 0 0 0 44.05475556 18.93262222 223.18648889 223.18648889 0 0 0 45.8752 4.73315556 207.16657778 207.16657778 0 0 0 36.40888888-2.54862223l15.29173334-2.54862222v95.39128889a26.2144 26.2144 0 0 1-8.73813334 20.02488889 31.67573333 31.67573333 0 0 1-26.57848888 4.73315555 498.43768889 498.43768889 0 0 1-249.40088889-185.32124444A486.78684445 486.78684445 0 0 1 2.27555555 512a497.70951111 497.70951111 0 0 1 68.44871112-254.86222222A504.6272 504.6272 0 0 1 257.13777778 70.72426667 497.70951111 497.70951111 0 0 1 512 2.27555555a497.70951111 497.70951111 0 0 1 254.86222222 68.44871112A504.6272 504.6272 0 0 1 953.27573333 257.13777778 496.98133333 496.98133333 0 0 1 1021.72444445 512z
|
||||
</Geometry>
|
||||
<!--更新源-->
|
||||
|
||||
|
||||
<!--排序方式-->
|
||||
<Geometry x:Key="CustomSort">
|
||||
M950.896028 907.262252 799.11209 753.232157c-12.108782-12.302187-31.893384-12.434194-44.163849-0.325411-12.286838 12.103666-12.434194 31.878035-0.325411 44.163849l151.783938 154.030096c6.110161 6.206352 14.177907 9.31311 22.24463 9.31311 7.919367 0 15.839757-2.989077 21.919219-8.987698C962.857455 939.323459 963.004811 919.54909 950.896028 907.262252z
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Control;
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
||||
namespace GeekDesk.Task
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"title": "GeekDesk版本更新",
|
||||
"subTitle": "V2.4.15",
|
||||
"subTitle": "V2.4.12",
|
||||
"msgTitle": "本次更新内容如下",
|
||||
"msg": "['PS:又一次的更新, 虽然还有很多需求没有完成, 但仍然耗费了我大量的精力, 没有点Star的兄弟萌, 求个免费Star(GitHub国内某些用户可能进不去), 再给我一点更新的动力!','增加纯色/渐变色背景','增加/优化拾色器功能','增加主面板Logo开关','优化待办任务,现在待办任务快捷键不再是新建待办窗口','增加鼠标滚轮切换菜单功能(需要鼠标指针在菜单栏)','优化搜索功能,增加 快捷键搜索/按键即搜 可选操作','优化贴边隐藏动画, 纵享丝滑了属于是兄弟萌', '其它已知问题修复']",
|
||||
"msg": "['各位兄弟去给我点个免费Star呗','这是个修复版本,主要修复上个版本的bug','修复图标无法拖动','修复界面遮挡任务栏']",
|
||||
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
||||
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
|
||||
"version": "2.4.15"
|
||||
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||
"version": "2.4.12"
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Effects;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class BGSettingUtil
|
||||
{
|
||||
private static readonly AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
public static void BGSetting()
|
||||
{
|
||||
if (appConfig.BGStyle == BGStyle.ImgBac || appConfig.BGStyle == 0)
|
||||
{
|
||||
Image image = new Image
|
||||
{
|
||||
Effect = new BlurEffect()
|
||||
{
|
||||
Radius = appConfig.BlurValue
|
||||
},
|
||||
Margin = new Thickness(-30),
|
||||
Source = appConfig.BitmapImage,
|
||||
Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2))
|
||||
};
|
||||
|
||||
|
||||
//binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
|
||||
//image.SetBinding(Image.OpacityProperty, binding);
|
||||
|
||||
Grid grid = new Grid
|
||||
{
|
||||
ClipToBounds = true
|
||||
};
|
||||
grid.Children.Add(image);
|
||||
|
||||
VisualBrush vb = new VisualBrush
|
||||
{
|
||||
Visual = grid
|
||||
};
|
||||
MainWindow.mainWindow.BGBorder.Background = vb;
|
||||
}
|
||||
else
|
||||
{
|
||||
LinearGradientBrush lgb = new LinearGradientBrush();
|
||||
|
||||
GradientStop gs = new GradientStop
|
||||
{
|
||||
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
||||
Offset = 0
|
||||
};
|
||||
|
||||
lgb.GradientStops.Add(gs);
|
||||
|
||||
GradientStop gs2 = new GradientStop
|
||||
{
|
||||
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color2),
|
||||
Offset = 1
|
||||
};
|
||||
lgb.GradientStops.Add(gs2);
|
||||
MainWindow.mainWindow.BGBorder.Background = lgb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class ColorUtil
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -222,34 +222,5 @@ namespace GeekDesk.Util
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断鼠标是否在窗口内
|
||||
/// </summary>
|
||||
/// <param name="window"></param>
|
||||
/// <returns></returns>
|
||||
public static bool MouseInWindow(Window window)
|
||||
{
|
||||
double windowHeight = window.Height;
|
||||
double windowWidth = window.Width;
|
||||
|
||||
double windowTop = window.Top;
|
||||
double windowLeft = window.Left;
|
||||
|
||||
//获取鼠标位置
|
||||
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||
double mouseX = p.X;
|
||||
double mouseY = p.Y;
|
||||
|
||||
//鼠标不在窗口上
|
||||
if (mouseX < windowLeft || mouseX > windowLeft + windowWidth
|
||||
|| mouseY < windowTop || mouseY > windowTop + windowHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
101
Util/ConsoleManager.cs
Normal file
101
Util/ConsoleManager.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
public static class ConsoleManager
|
||||
{
|
||||
private const string Kernel32_DllName = "kernel32.dll";
|
||||
|
||||
[DllImport(Kernel32_DllName)]
|
||||
private static extern bool AllocConsole();
|
||||
|
||||
[DllImport(Kernel32_DllName)]
|
||||
private static extern bool FreeConsole();
|
||||
|
||||
[DllImport(Kernel32_DllName)]
|
||||
private static extern IntPtr GetConsoleWindow();
|
||||
|
||||
[DllImport(Kernel32_DllName)]
|
||||
private static extern int GetConsoleOutputCP();
|
||||
|
||||
public static bool HasConsole
|
||||
{
|
||||
get { return GetConsoleWindow() != IntPtr.Zero; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new console instance if the process is not attached to a console already.
|
||||
/// </summary>
|
||||
public static void Show()
|
||||
{
|
||||
//#if DEBUG
|
||||
if (!HasConsole)
|
||||
{
|
||||
AllocConsole();
|
||||
InvalidateOutAndError();
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the process has a console attached to it, it will be detached and no longer visible. Writing to the System.Console is still possible, but no output will be shown.
|
||||
/// </summary>
|
||||
public static void Hide()
|
||||
{
|
||||
//#if DEBUG
|
||||
if (HasConsole)
|
||||
{
|
||||
SetOutAndErrorNull();
|
||||
FreeConsole();
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
||||
public static void Toggle()
|
||||
{
|
||||
if (HasConsole)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
Show();
|
||||
}
|
||||
}
|
||||
|
||||
static void InvalidateOutAndError()
|
||||
{
|
||||
Type type = typeof(System.Console);
|
||||
|
||||
System.Reflection.FieldInfo _out = type.GetField("_out",
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
System.Reflection.FieldInfo _error = type.GetField("_error",
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
System.Reflection.MethodInfo _InitializeStdOutError = type.GetMethod("InitializeStdOutError",
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
Debug.Assert(_out != null);
|
||||
Debug.Assert(_error != null);
|
||||
|
||||
Debug.Assert(_InitializeStdOutError != null);
|
||||
|
||||
_out.SetValue(null, null);
|
||||
_error.SetValue(null, null);
|
||||
|
||||
_InitializeStdOutError.Invoke(null, new object[] { true });
|
||||
}
|
||||
|
||||
static void SetOutAndErrorNull()
|
||||
{
|
||||
Console.SetOut(TextWriter.Null);
|
||||
Console.SetError(TextWriter.Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
170
Util/DragAdorner.cs
Normal file
170
Util/DragAdorner.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
// Copyright (C) Josh Smith - January 2007
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace WPF.JoshSmith.Adorners
|
||||
{
|
||||
/// <summary>
|
||||
/// Renders a visual which can follow the mouse cursor,
|
||||
/// such as during a drag-and-drop operation.
|
||||
/// </summary>
|
||||
public class DragAdorner : Adorner
|
||||
{
|
||||
#region Data
|
||||
|
||||
private Rectangle child = null;
|
||||
private double offsetLeft = 0;
|
||||
private double offsetTop = 0;
|
||||
|
||||
#endregion // Data
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of DragVisualAdorner.
|
||||
/// </summary>
|
||||
/// <param name="adornedElement">The element being adorned.</param>
|
||||
/// <param name="size">The size of the adorner.</param>
|
||||
/// <param name="brush">A brush to with which to paint the adorner.</param>
|
||||
public DragAdorner(UIElement adornedElement, Size size, Brush brush)
|
||||
: base(adornedElement)
|
||||
{
|
||||
Rectangle rect = new Rectangle();
|
||||
rect.Fill = brush;
|
||||
rect.Width = size.Width;
|
||||
rect.Height = size.Height;
|
||||
rect.IsHitTestVisible = false;
|
||||
this.child = rect;
|
||||
}
|
||||
|
||||
#endregion // Constructor
|
||||
|
||||
#region Public Interface
|
||||
|
||||
#region GetDesiredTransform
|
||||
|
||||
/// <summary>
|
||||
/// Override.
|
||||
/// </summary>
|
||||
/// <param name="transform"></param>
|
||||
/// <returns></returns>
|
||||
public override GeneralTransform GetDesiredTransform(GeneralTransform transform)
|
||||
{
|
||||
GeneralTransformGroup result = new GeneralTransformGroup();
|
||||
result.Children.Add(base.GetDesiredTransform(transform));
|
||||
result.Children.Add(new TranslateTransform(this.offsetLeft, this.offsetTop));
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion // GetDesiredTransform
|
||||
|
||||
#region OffsetLeft
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the horizontal offset of the adorner.
|
||||
/// </summary>
|
||||
public double OffsetLeft
|
||||
{
|
||||
get { return this.offsetLeft; }
|
||||
set
|
||||
{
|
||||
this.offsetLeft = value;
|
||||
UpdateLocation();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // OffsetLeft
|
||||
|
||||
#region SetOffsets
|
||||
|
||||
/// <summary>
|
||||
/// Updates the location of the adorner in one atomic operation.
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <param name="top"></param>
|
||||
public void SetOffsets(double left, double top)
|
||||
{
|
||||
this.offsetLeft = left;
|
||||
this.offsetTop = top;
|
||||
this.UpdateLocation();
|
||||
}
|
||||
|
||||
#endregion // SetOffsets
|
||||
|
||||
#region OffsetTop
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the vertical offset of the adorner.
|
||||
/// </summary>
|
||||
public double OffsetTop
|
||||
{
|
||||
get { return this.offsetTop; }
|
||||
set
|
||||
{
|
||||
this.offsetTop = value;
|
||||
UpdateLocation();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // OffsetTop
|
||||
|
||||
#endregion // Public Interface
|
||||
|
||||
#region Protected Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Override.
|
||||
/// </summary>
|
||||
/// <param name="constraint"></param>
|
||||
/// <returns></returns>
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
this.child.Measure(constraint);
|
||||
return this.child.DesiredSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override.
|
||||
/// </summary>
|
||||
/// <param name="finalSize"></param>
|
||||
/// <returns></returns>
|
||||
protected override Size ArrangeOverride(Size finalSize)
|
||||
{
|
||||
this.child.Arrange(new Rect(finalSize));
|
||||
return finalSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override.
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
return this.child;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override. Always returns 1.
|
||||
/// </summary>
|
||||
protected override int VisualChildrenCount
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
#endregion // Protected Overrides
|
||||
|
||||
#region Private Helpers
|
||||
|
||||
private void UpdateLocation()
|
||||
{
|
||||
AdornerLayer adornerLayer = this.Parent as AdornerLayer;
|
||||
if (adornerLayer != null)
|
||||
adornerLayer.Update(this.AdornedElement);
|
||||
}
|
||||
|
||||
#endregion // Private Helpers
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using IWshRuntimeLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
@@ -20,17 +21,17 @@ namespace GeekDesk.Util
|
||||
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函数
|
||||
);
|
||||
[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)
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using IWshRuntimeLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace GeekDesk.Util
|
||||
{
|
||||
public enum HotkeyModifiers
|
||||
{
|
||||
None = 0,
|
||||
MOD_ALT = 0x1,
|
||||
MOD_CONTROL = 0x2,
|
||||
MOD_SHIFT = 0x4,
|
||||
@@ -54,8 +53,7 @@ namespace GeekDesk.Util
|
||||
UnregisterHotKey(handleTemp[id].Handle, id);
|
||||
GlobalHotKey.handleTemp[id].Dispose();
|
||||
GlobalHotKey.handleTemp.Remove(id);
|
||||
}
|
||||
catch
|
||||
} catch
|
||||
{
|
||||
//nothing
|
||||
}
|
||||
@@ -77,7 +75,7 @@ namespace GeekDesk.Util
|
||||
{
|
||||
CreateHandle(new CreateParams());
|
||||
this.callback += callback;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly int WM_HOTKEY = 0x0312;
|
||||
protected override void WndProc(ref Message m)
|
||||
@@ -96,4 +94,4 @@ namespace GeekDesk.Util
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -12,10 +16,10 @@ namespace GeekDesk.Util
|
||||
ServicePointManager.Expect100Continue = true;
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
//创建Web访问对 象
|
||||
WebRequest myRequest = WebRequest.Create(url);
|
||||
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
myRequest.ContentType = "text/plain; charset=utf-8";
|
||||
//通过Web访问对象获取响应内容
|
||||
WebResponse myResponse = myRequest.GetResponse();
|
||||
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
|
||||
|
||||
//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
|
||||
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
137
Util/KeyUtil.cs
137
Util/KeyUtil.cs
@@ -1,137 +0,0 @@
|
||||
using System;
|
||||
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class KeyUtil
|
||||
{
|
||||
public class KeyProp
|
||||
{
|
||||
public Key key;
|
||||
public bool printable;
|
||||
public char character;
|
||||
public bool shift;
|
||||
public bool ctrl;
|
||||
public bool alt;
|
||||
public int type; //sideband
|
||||
public string s; //sideband
|
||||
};
|
||||
|
||||
public static void KeyToChar(Key key,
|
||||
ref KeyProp keyProp,
|
||||
bool downCap = false,
|
||||
bool downShift = false
|
||||
)
|
||||
{
|
||||
bool iscap;
|
||||
bool caplock = false;
|
||||
bool shift;
|
||||
|
||||
keyProp.key = key;
|
||||
|
||||
keyProp.alt = Keyboard.IsKeyDown(Key.LeftAlt) ||
|
||||
Keyboard.IsKeyDown(Key.RightAlt);
|
||||
|
||||
keyProp.ctrl = Keyboard.IsKeyDown(Key.LeftCtrl) ||
|
||||
Keyboard.IsKeyDown(Key.RightCtrl);
|
||||
|
||||
keyProp.shift = Keyboard.IsKeyDown(Key.LeftShift) ||
|
||||
Keyboard.IsKeyDown(Key.RightShift);
|
||||
|
||||
if (keyProp.alt || keyProp.ctrl)
|
||||
{
|
||||
keyProp.printable = false;
|
||||
keyProp.type = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyProp.printable = true;
|
||||
keyProp.type = 0;
|
||||
}
|
||||
|
||||
shift = downShift || keyProp.shift;
|
||||
//caplock = Console.CapsLock; //Keyboard.IsKeyToggled(Key.CapsLock);
|
||||
iscap = downCap || ((caplock && !shift) || (!caplock && shift));
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case Key.Enter: keyProp.character = '\n'; return;
|
||||
case Key.A: keyProp.character = (iscap ? 'A' : 'a'); return;
|
||||
case Key.B: keyProp.character = (iscap ? 'B' : 'b'); return;
|
||||
case Key.C: keyProp.character = (iscap ? 'C' : 'c'); return;
|
||||
case Key.D: keyProp.character = (iscap ? 'D' : 'd'); return;
|
||||
case Key.E: keyProp.character = (iscap ? 'E' : 'e'); return;
|
||||
case Key.F: keyProp.character = (iscap ? 'F' : 'f'); return;
|
||||
case Key.G: keyProp.character = (iscap ? 'G' : 'g'); return;
|
||||
case Key.H: keyProp.character = (iscap ? 'H' : 'h'); return;
|
||||
case Key.I: keyProp.character = (iscap ? 'I' : 'i'); return;
|
||||
case Key.J: keyProp.character = (iscap ? 'J' : 'j'); return;
|
||||
case Key.K: keyProp.character = (iscap ? 'K' : 'k'); return;
|
||||
case Key.L: keyProp.character = (iscap ? 'L' : 'l'); return;
|
||||
case Key.M: keyProp.character = (iscap ? 'M' : 'm'); return;
|
||||
case Key.N: keyProp.character = (iscap ? 'N' : 'n'); return;
|
||||
case Key.O: keyProp.character = (iscap ? 'O' : 'o'); return;
|
||||
case Key.P: keyProp.character = (iscap ? 'P' : 'p'); return;
|
||||
case Key.Q: keyProp.character = (iscap ? 'Q' : 'q'); return;
|
||||
case Key.R: keyProp.character = (iscap ? 'R' : 'r'); return;
|
||||
case Key.S: keyProp.character = (iscap ? 'S' : 's'); return;
|
||||
case Key.T: keyProp.character = (iscap ? 'T' : 't'); return;
|
||||
case Key.U: keyProp.character = (iscap ? 'U' : 'u'); return;
|
||||
case Key.V: keyProp.character = (iscap ? 'V' : 'v'); return;
|
||||
case Key.W: keyProp.character = (iscap ? 'W' : 'w'); return;
|
||||
case Key.X: keyProp.character = (iscap ? 'X' : 'x'); return;
|
||||
case Key.Y: keyProp.character = (iscap ? 'Y' : 'y'); return;
|
||||
case Key.Z: keyProp.character = (iscap ? 'Z' : 'z'); return;
|
||||
case Key.D0: keyProp.character = (shift ? ')' : '0'); return;
|
||||
case Key.D1: keyProp.character = (shift ? '!' : '1'); return;
|
||||
case Key.D2: keyProp.character = (shift ? '@' : '2'); return;
|
||||
case Key.D3: keyProp.character = (shift ? '#' : '3'); return;
|
||||
case Key.D4: keyProp.character = (shift ? '$' : '4'); return;
|
||||
case Key.D5: keyProp.character = (shift ? '%' : '5'); return;
|
||||
case Key.D6: keyProp.character = (shift ? '^' : '6'); return;
|
||||
case Key.D7: keyProp.character = (shift ? '&' : '7'); return;
|
||||
case Key.D8: keyProp.character = (shift ? '*' : '8'); return;
|
||||
case Key.D9: keyProp.character = (shift ? '(' : '9'); return;
|
||||
case Key.OemPlus: keyProp.character = (shift ? '+' : '='); return;
|
||||
case Key.OemMinus: keyProp.character = (shift ? '_' : '-'); return;
|
||||
case Key.OemQuestion: keyProp.character = (shift ? '?' : '/'); return;
|
||||
case Key.OemComma: keyProp.character = (shift ? '<' : ','); return;
|
||||
case Key.OemPeriod: keyProp.character = (shift ? '>' : '.'); return;
|
||||
case Key.OemOpenBrackets: keyProp.character = (shift ? '{' : '['); return;
|
||||
case Key.OemQuotes: keyProp.character = (shift ? '"' : '\''); return;
|
||||
case Key.Oem1: keyProp.character = (shift ? ':' : ';'); return;
|
||||
case Key.Oem3: keyProp.character = (shift ? '~' : '`'); return;
|
||||
case Key.Oem5: keyProp.character = (shift ? '|' : '\\'); return;
|
||||
case Key.Oem6: keyProp.character = (shift ? '}' : ']'); return;
|
||||
case Key.Tab: keyProp.character = '\t'; return;
|
||||
case Key.Space: keyProp.character = ' '; return;
|
||||
|
||||
// Number Pad
|
||||
case Key.NumPad0: keyProp.character = '0'; return;
|
||||
case Key.NumPad1: keyProp.character = '1'; return;
|
||||
case Key.NumPad2: keyProp.character = '2'; return;
|
||||
case Key.NumPad3: keyProp.character = '3'; return;
|
||||
case Key.NumPad4: keyProp.character = '4'; return;
|
||||
case Key.NumPad5: keyProp.character = '5'; return;
|
||||
case Key.NumPad6: keyProp.character = '6'; return;
|
||||
case Key.NumPad7: keyProp.character = '7'; return;
|
||||
case Key.NumPad8: keyProp.character = '8'; return;
|
||||
case Key.NumPad9: keyProp.character = '9'; return;
|
||||
case Key.Subtract: keyProp.character = '-'; return;
|
||||
case Key.Add: keyProp.character = '+'; return;
|
||||
case Key.Decimal: keyProp.character = '.'; return;
|
||||
case Key.Divide: keyProp.character = '/'; return;
|
||||
case Key.Multiply: keyProp.character = '*'; return;
|
||||
|
||||
default:
|
||||
keyProp.type = 1;
|
||||
keyProp.printable = false;
|
||||
keyProp.character = '\x00';
|
||||
return;
|
||||
} //switch
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
862
Util/ListViewDragDropManager.cs
Normal file
862
Util/ListViewDragDropManager.cs
Normal file
@@ -0,0 +1,862 @@
|
||||
// Copyright (C) Josh Smith - January 2007
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using WPF.JoshSmith.Adorners;
|
||||
using WPF.JoshSmith.Controls.Utilities;
|
||||
|
||||
namespace WPF.JoshSmith.ServiceProviders.UI
|
||||
{
|
||||
#region ListViewDragDropManager
|
||||
|
||||
/// <summary>
|
||||
/// Manages the dragging and dropping of ListViewItems in a ListView.
|
||||
/// The ItemType type parameter indicates the type of the objects in
|
||||
/// the ListView's items source. The ListView's ItemsSource must be
|
||||
/// set to an instance of ObservableCollection of ItemType, or an
|
||||
/// Exception will be thrown.
|
||||
/// </summary>
|
||||
/// <typeparam name="ItemType">The type of the ListView's items.</typeparam>
|
||||
public class ListViewDragDropManager<ItemType> where ItemType : class
|
||||
{
|
||||
#region Data
|
||||
|
||||
bool canInitiateDrag;
|
||||
DragAdorner dragAdorner;
|
||||
double dragAdornerOpacity;
|
||||
int indexToSelect;
|
||||
bool isDragInProgress;
|
||||
ItemType itemUnderDragCursor;
|
||||
ListView listView;
|
||||
Point ptMouseDown;
|
||||
bool showDragAdorner;
|
||||
|
||||
#endregion // Data
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of ListViewDragManager.
|
||||
/// </summary>
|
||||
public ListViewDragDropManager()
|
||||
{
|
||||
this.canInitiateDrag = false;
|
||||
this.dragAdornerOpacity = 0.7;
|
||||
this.indexToSelect = -1;
|
||||
this.showDragAdorner = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of ListViewDragManager.
|
||||
/// </summary>
|
||||
/// <param name="listView"></param>
|
||||
public ListViewDragDropManager(ListView listView)
|
||||
: this()
|
||||
{
|
||||
this.ListView = listView;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of ListViewDragManager.
|
||||
/// </summary>
|
||||
/// <param name="listView"></param>
|
||||
/// <param name="dragAdornerOpacity"></param>
|
||||
public ListViewDragDropManager(ListView listView, double dragAdornerOpacity)
|
||||
: this(listView)
|
||||
{
|
||||
this.DragAdornerOpacity = dragAdornerOpacity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of ListViewDragManager.
|
||||
/// </summary>
|
||||
/// <param name="listView"></param>
|
||||
/// <param name="showDragAdorner"></param>
|
||||
public ListViewDragDropManager(ListView listView, bool showDragAdorner)
|
||||
: this(listView)
|
||||
{
|
||||
this.ShowDragAdorner = showDragAdorner;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Public Interface
|
||||
|
||||
#region DragAdornerOpacity
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the opacity of the drag adorner. This property has no
|
||||
/// effect if ShowDragAdorner is false. The default value is 0.7
|
||||
/// </summary>
|
||||
public double DragAdornerOpacity
|
||||
{
|
||||
get { return this.dragAdornerOpacity; }
|
||||
set
|
||||
{
|
||||
if (this.IsDragInProgress)
|
||||
throw new InvalidOperationException("Cannot set the DragAdornerOpacity property during a drag operation.");
|
||||
|
||||
if (value < 0.0 || value > 1.0)
|
||||
throw new ArgumentOutOfRangeException("DragAdornerOpacity", value, "Must be between 0 and 1.");
|
||||
|
||||
this.dragAdornerOpacity = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // DragAdornerOpacity
|
||||
|
||||
#region IsDragInProgress
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if there is currently a drag operation being managed.
|
||||
/// </summary>
|
||||
public bool IsDragInProgress
|
||||
{
|
||||
get { return this.isDragInProgress; }
|
||||
private set { this.isDragInProgress = value; }
|
||||
}
|
||||
|
||||
#endregion // IsDragInProgress
|
||||
|
||||
#region ListView
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the ListView whose dragging is managed. This property
|
||||
/// can be set to null, to prevent drag management from occuring. If
|
||||
/// the ListView's AllowDrop property is false, it will be set to true.
|
||||
/// </summary>
|
||||
public ListView ListView
|
||||
{
|
||||
get { return listView; }
|
||||
set
|
||||
{
|
||||
if (this.IsDragInProgress)
|
||||
throw new InvalidOperationException("Cannot set the ListView property during a drag operation.");
|
||||
|
||||
if (this.listView != null)
|
||||
{
|
||||
#region Unhook Events
|
||||
|
||||
this.listView.PreviewMouseLeftButtonDown -= listView_PreviewMouseLeftButtonDown;
|
||||
this.listView.PreviewMouseMove -= listView_PreviewMouseMove;
|
||||
this.listView.DragOver -= listView_DragOver;
|
||||
this.listView.DragLeave -= listView_DragLeave;
|
||||
this.listView.DragEnter -= listView_DragEnter;
|
||||
this.listView.Drop -= listView_Drop;
|
||||
|
||||
#endregion // Unhook Events
|
||||
}
|
||||
|
||||
this.listView = value;
|
||||
|
||||
if (this.listView != null)
|
||||
{
|
||||
if (!this.listView.AllowDrop)
|
||||
this.listView.AllowDrop = true;
|
||||
|
||||
#region Hook Events
|
||||
|
||||
this.listView.PreviewMouseLeftButtonDown += listView_PreviewMouseLeftButtonDown;
|
||||
this.listView.PreviewMouseMove += listView_PreviewMouseMove;
|
||||
this.listView.DragOver += listView_DragOver;
|
||||
this.listView.DragLeave += listView_DragLeave;
|
||||
this.listView.DragEnter += listView_DragEnter;
|
||||
this.listView.Drop += listView_Drop;
|
||||
|
||||
#endregion // Hook Events
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // ListView
|
||||
|
||||
#region ProcessDrop [event]
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a drop occurs. By default the dropped item will be moved
|
||||
/// to the target index. Handle this event if relocating the dropped item
|
||||
/// requires custom behavior. Note, if this event is handled the default
|
||||
/// item dropping logic will not occur.
|
||||
/// </summary>
|
||||
public event EventHandler<ProcessDropEventArgs<ItemType>> ProcessDrop;
|
||||
|
||||
#endregion // ProcessDrop [event]
|
||||
|
||||
#region ShowDragAdorner
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets whether a visual representation of the ListViewItem being dragged
|
||||
/// follows the mouse cursor during a drag operation. The default value is true.
|
||||
/// </summary>
|
||||
public bool ShowDragAdorner
|
||||
{
|
||||
get { return this.showDragAdorner; }
|
||||
set
|
||||
{
|
||||
if (this.IsDragInProgress)
|
||||
throw new InvalidOperationException("Cannot set the ShowDragAdorner property during a drag operation.");
|
||||
|
||||
this.showDragAdorner = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // ShowDragAdorner
|
||||
|
||||
#endregion // Public Interface
|
||||
|
||||
#region Event Handling Methods
|
||||
|
||||
#region listView_PreviewMouseLeftButtonDown
|
||||
|
||||
void listView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (this.IsMouseOverScrollbar)
|
||||
{
|
||||
// 4/13/2007 - Set the flag to false when cursor is over scrollbar.
|
||||
this.canInitiateDrag = false;
|
||||
return;
|
||||
}
|
||||
|
||||
int index = this.IndexUnderDragCursor;
|
||||
this.canInitiateDrag = index > -1;
|
||||
|
||||
if (this.canInitiateDrag)
|
||||
{
|
||||
// Remember the location and index of the ListViewItem the user clicked on for later.
|
||||
this.ptMouseDown = MouseUtilities.GetMousePosition(this.listView);
|
||||
this.indexToSelect = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ptMouseDown = new Point(-10000, -10000);
|
||||
this.indexToSelect = -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // listView_PreviewMouseLeftButtonDown
|
||||
|
||||
#region listView_PreviewMouseMove
|
||||
|
||||
void listView_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!this.CanStartDragOperation)
|
||||
return;
|
||||
|
||||
// Select the item the user clicked on.
|
||||
if (this.listView.SelectedIndex != this.indexToSelect)
|
||||
this.listView.SelectedIndex = this.indexToSelect;
|
||||
|
||||
// If the item at the selected index is null, there's nothing
|
||||
// we can do, so just return;
|
||||
if (this.listView.SelectedItem == null)
|
||||
return;
|
||||
|
||||
ListViewItem itemToDrag = this.GetListViewItem(this.listView.SelectedIndex);
|
||||
if (itemToDrag == null)
|
||||
return;
|
||||
|
||||
AdornerLayer adornerLayer = this.ShowDragAdornerResolved ? this.InitializeAdornerLayer(itemToDrag) : null;
|
||||
|
||||
this.InitializeDragOperation(itemToDrag);
|
||||
this.PerformDragOperation();
|
||||
this.FinishDragOperation(itemToDrag, adornerLayer);
|
||||
}
|
||||
|
||||
#endregion // listView_PreviewMouseMove
|
||||
|
||||
#region listView_DragOver
|
||||
|
||||
void listView_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effects = DragDropEffects.Move;
|
||||
|
||||
if (this.ShowDragAdornerResolved)
|
||||
this.UpdateDragAdornerLocation();
|
||||
|
||||
// Update the item which is known to be currently under the drag cursor.
|
||||
int index = this.IndexUnderDragCursor;
|
||||
this.ItemUnderDragCursor = index < 0 ? null : this.ListView.Items[index] as ItemType;
|
||||
}
|
||||
|
||||
#endregion // listView_DragOver
|
||||
|
||||
#region listView_DragLeave
|
||||
|
||||
void listView_DragLeave(object sender, DragEventArgs e)
|
||||
{
|
||||
if (!this.IsMouseOver(this.listView))
|
||||
{
|
||||
if (this.ItemUnderDragCursor != null)
|
||||
this.ItemUnderDragCursor = null;
|
||||
|
||||
if (this.dragAdorner != null)
|
||||
this.dragAdorner.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // listView_DragLeave
|
||||
|
||||
#region listView_DragEnter
|
||||
|
||||
void listView_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (this.dragAdorner != null && this.dragAdorner.Visibility != Visibility.Visible)
|
||||
{
|
||||
// Update the location of the adorner and then show it.
|
||||
this.UpdateDragAdornerLocation();
|
||||
this.dragAdorner.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // listView_DragEnter
|
||||
|
||||
#region listView_Drop
|
||||
|
||||
void listView_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (this.ItemUnderDragCursor != null)
|
||||
this.ItemUnderDragCursor = null;
|
||||
|
||||
e.Effects = DragDropEffects.None;
|
||||
|
||||
if (!e.Data.GetDataPresent(typeof(ItemType)))
|
||||
return;
|
||||
|
||||
// Get the data object which was dropped.
|
||||
ItemType data = e.Data.GetData(typeof(ItemType)) as ItemType;
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
// Get the ObservableCollection<ItemType> which contains the dropped data object.
|
||||
ObservableCollection<ItemType> itemsSource = this.listView.ItemsSource as ObservableCollection<ItemType>;
|
||||
if (itemsSource == null)
|
||||
throw new Exception(
|
||||
"A ListView managed by ListViewDragManager must have its ItemsSource set to an ObservableCollection<ItemType>.");
|
||||
|
||||
int oldIndex = itemsSource.IndexOf(data);
|
||||
int newIndex = this.IndexUnderDragCursor;
|
||||
|
||||
if (newIndex < 0)
|
||||
{
|
||||
// The drag started somewhere else, and our ListView is empty
|
||||
// so make the new item the first in the list.
|
||||
if (itemsSource.Count == 0)
|
||||
newIndex = 0;
|
||||
|
||||
// The drag started somewhere else, but our ListView has items
|
||||
// so make the new item the last in the list.
|
||||
else if (oldIndex < 0)
|
||||
newIndex = itemsSource.Count;
|
||||
|
||||
// The user is trying to drop an item from our ListView into
|
||||
// our ListView, but the mouse is not over an item, so don't
|
||||
// let them drop it.
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
// Dropping an item back onto itself is not considered an actual 'drop'.
|
||||
if (oldIndex == newIndex)
|
||||
return;
|
||||
|
||||
if (this.ProcessDrop != null)
|
||||
{
|
||||
// Let the client code process the drop.
|
||||
ProcessDropEventArgs<ItemType> args = new ProcessDropEventArgs<ItemType>(itemsSource, data, oldIndex, newIndex, e.AllowedEffects);
|
||||
this.ProcessDrop(this, args);
|
||||
e.Effects = args.Effects;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Move the dragged data object from it's original index to the
|
||||
// new index (according to where the mouse cursor is). If it was
|
||||
// not previously in the ListBox, then insert the item.
|
||||
if (oldIndex > -1)
|
||||
itemsSource.Move(oldIndex, newIndex);
|
||||
else
|
||||
itemsSource.Insert(newIndex, data);
|
||||
|
||||
// Set the Effects property so that the call to DoDragDrop will return 'Move'.
|
||||
e.Effects = DragDropEffects.Move;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // listView_Drop
|
||||
|
||||
#endregion // Event Handling Methods
|
||||
|
||||
#region Private Helpers
|
||||
|
||||
#region CanStartDragOperation
|
||||
|
||||
bool CanStartDragOperation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Mouse.LeftButton != MouseButtonState.Pressed)
|
||||
return false;
|
||||
|
||||
if (!this.canInitiateDrag)
|
||||
return false;
|
||||
|
||||
if (this.indexToSelect == -1)
|
||||
return false;
|
||||
|
||||
if (!this.HasCursorLeftDragThreshold)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // CanStartDragOperation
|
||||
|
||||
#region FinishDragOperation
|
||||
|
||||
void FinishDragOperation(ListViewItem draggedItem, AdornerLayer adornerLayer)
|
||||
{
|
||||
// Let the ListViewItem know that it is not being dragged anymore.
|
||||
ListViewItemDragState.SetIsBeingDragged(draggedItem, false);
|
||||
|
||||
this.IsDragInProgress = false;
|
||||
|
||||
if (this.ItemUnderDragCursor != null)
|
||||
this.ItemUnderDragCursor = null;
|
||||
|
||||
// Remove the drag adorner from the adorner layer.
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adornerLayer.Remove(this.dragAdorner);
|
||||
this.dragAdorner = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // FinishDragOperation
|
||||
|
||||
#region GetListViewItem
|
||||
|
||||
ListViewItem GetListViewItem(int index)
|
||||
{
|
||||
if (this.listView.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
|
||||
return null;
|
||||
|
||||
return this.listView.ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem;
|
||||
}
|
||||
|
||||
ListViewItem GetListViewItem(ItemType dataItem)
|
||||
{
|
||||
if (this.listView.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
|
||||
return null;
|
||||
|
||||
return this.listView.ItemContainerGenerator.ContainerFromItem(dataItem) as ListViewItem;
|
||||
}
|
||||
|
||||
#endregion // GetListViewItem
|
||||
|
||||
#region HasCursorLeftDragThreshold
|
||||
|
||||
bool HasCursorLeftDragThreshold
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.indexToSelect < 0)
|
||||
return false;
|
||||
|
||||
ListViewItem item = this.GetListViewItem(this.indexToSelect);
|
||||
Rect bounds = VisualTreeHelper.GetDescendantBounds(item);
|
||||
Point ptInItem = this.listView.TranslatePoint(this.ptMouseDown, item);
|
||||
|
||||
// In case the cursor is at the very top or bottom of the ListViewItem
|
||||
// we want to make the vertical threshold very small so that dragging
|
||||
// over an adjacent item does not select it.
|
||||
double topOffset = Math.Abs(ptInItem.Y);
|
||||
double btmOffset = Math.Abs(bounds.Height - ptInItem.Y);
|
||||
double vertOffset = Math.Min(topOffset, btmOffset);
|
||||
|
||||
double width = SystemParameters.MinimumHorizontalDragDistance * 2;
|
||||
double height = Math.Min(SystemParameters.MinimumVerticalDragDistance, vertOffset) * 2;
|
||||
Size szThreshold = new Size(width, height);
|
||||
|
||||
Rect rect = new Rect(this.ptMouseDown, szThreshold);
|
||||
rect.Offset(szThreshold.Width / -2, szThreshold.Height / -2);
|
||||
Point ptInListView = MouseUtilities.GetMousePosition(this.listView);
|
||||
return !rect.Contains(ptInListView);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // HasCursorLeftDragThreshold
|
||||
|
||||
#region IndexUnderDragCursor
|
||||
|
||||
/// <summary>
|
||||
/// Returns the index of the ListViewItem underneath the
|
||||
/// drag cursor, or -1 if the cursor is not over an item.
|
||||
/// </summary>
|
||||
int IndexUnderDragCursor
|
||||
{
|
||||
get
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < this.listView.Items.Count; ++i)
|
||||
{
|
||||
ListViewItem item = this.GetListViewItem(i);
|
||||
if (this.IsMouseOver(item))
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // IndexUnderDragCursor
|
||||
|
||||
#region InitializeAdornerLayer
|
||||
|
||||
AdornerLayer InitializeAdornerLayer(ListViewItem itemToDrag)
|
||||
{
|
||||
// Create a brush which will paint the ListViewItem onto
|
||||
// a visual in the adorner layer.
|
||||
VisualBrush brush = new VisualBrush(itemToDrag);
|
||||
|
||||
// Create an element which displays the source item while it is dragged.
|
||||
this.dragAdorner = new DragAdorner(this.listView, itemToDrag.RenderSize, brush);
|
||||
|
||||
// Set the drag adorner's opacity.
|
||||
this.dragAdorner.Opacity = this.DragAdornerOpacity;
|
||||
|
||||
AdornerLayer layer = AdornerLayer.GetAdornerLayer(this.listView);
|
||||
layer.Add(dragAdorner);
|
||||
|
||||
// Save the location of the cursor when the left mouse button was pressed.
|
||||
this.ptMouseDown = MouseUtilities.GetMousePosition(this.listView);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
#endregion // InitializeAdornerLayer
|
||||
|
||||
#region InitializeDragOperation
|
||||
|
||||
void InitializeDragOperation(ListViewItem itemToDrag)
|
||||
{
|
||||
// Set some flags used during the drag operation.
|
||||
this.IsDragInProgress = true;
|
||||
this.canInitiateDrag = false;
|
||||
|
||||
// Let the ListViewItem know that it is being dragged.
|
||||
ListViewItemDragState.SetIsBeingDragged(itemToDrag, true);
|
||||
}
|
||||
|
||||
#endregion // InitializeDragOperation
|
||||
|
||||
#region IsMouseOver
|
||||
|
||||
bool IsMouseOver(Visual target)
|
||||
{
|
||||
// We need to use MouseUtilities to figure out the cursor
|
||||
// coordinates because, during a drag-drop operation, the WPF
|
||||
// mechanisms for getting the coordinates behave strangely.
|
||||
|
||||
Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
|
||||
Point mousePos = MouseUtilities.GetMousePosition(target);
|
||||
return bounds.Contains(mousePos);
|
||||
}
|
||||
|
||||
#endregion // IsMouseOver
|
||||
|
||||
#region IsMouseOverScrollbar
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the mouse cursor is over a scrollbar in the ListView.
|
||||
/// </summary>
|
||||
bool IsMouseOverScrollbar
|
||||
{
|
||||
get
|
||||
{
|
||||
Point ptMouse = MouseUtilities.GetMousePosition(this.listView);
|
||||
HitTestResult res = VisualTreeHelper.HitTest(this.listView, ptMouse);
|
||||
if (res == null)
|
||||
return false;
|
||||
|
||||
DependencyObject depObj = res.VisualHit;
|
||||
while (depObj != null)
|
||||
{
|
||||
if (depObj is ScrollBar)
|
||||
return true;
|
||||
|
||||
// VisualTreeHelper works with objects of type Visual or Visual3D.
|
||||
// If the current object is not derived from Visual or Visual3D,
|
||||
// then use the LogicalTreeHelper to find the parent element.
|
||||
if (depObj is Visual || depObj is System.Windows.Media.Media3D.Visual3D)
|
||||
depObj = VisualTreeHelper.GetParent(depObj);
|
||||
else
|
||||
depObj = LogicalTreeHelper.GetParent(depObj);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // IsMouseOverScrollbar
|
||||
|
||||
#region ItemUnderDragCursor
|
||||
|
||||
ItemType ItemUnderDragCursor
|
||||
{
|
||||
get { return this.itemUnderDragCursor; }
|
||||
set
|
||||
{
|
||||
if (this.itemUnderDragCursor == value)
|
||||
return;
|
||||
|
||||
// The first pass handles the previous item under the cursor.
|
||||
// The second pass handles the new one.
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (i == 1)
|
||||
this.itemUnderDragCursor = value;
|
||||
|
||||
if (this.itemUnderDragCursor != null)
|
||||
{
|
||||
ListViewItem listViewItem = this.GetListViewItem(this.itemUnderDragCursor);
|
||||
if (listViewItem != null)
|
||||
ListViewItemDragState.SetIsUnderDragCursor(listViewItem, i == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // ItemUnderDragCursor
|
||||
|
||||
#region PerformDragOperation
|
||||
|
||||
void PerformDragOperation()
|
||||
{
|
||||
ItemType selectedItem = this.listView.SelectedItem as ItemType;
|
||||
DragDropEffects allowedEffects = DragDropEffects.Move | DragDropEffects.Move | DragDropEffects.Link;
|
||||
if (DragDrop.DoDragDrop(this.listView, selectedItem, allowedEffects) != DragDropEffects.None)
|
||||
{
|
||||
// The item was dropped into a new location,
|
||||
// so make it the new selected item.
|
||||
this.listView.SelectedItem = selectedItem;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // PerformDragOperation
|
||||
|
||||
#region ShowDragAdornerResolved
|
||||
|
||||
bool ShowDragAdornerResolved
|
||||
{
|
||||
get { return this.ShowDragAdorner && this.DragAdornerOpacity > 0.0; }
|
||||
}
|
||||
|
||||
#endregion // ShowDragAdornerResolved
|
||||
|
||||
#region UpdateDragAdornerLocation
|
||||
|
||||
void UpdateDragAdornerLocation()
|
||||
{
|
||||
if (this.dragAdorner != null)
|
||||
{
|
||||
Point ptCursor = MouseUtilities.GetMousePosition(this.ListView);
|
||||
|
||||
double left = ptCursor.X - this.ptMouseDown.X;
|
||||
|
||||
// 4/13/2007 - Made the top offset relative to the item being dragged.
|
||||
ListViewItem itemBeingDragged = this.GetListViewItem(this.indexToSelect);
|
||||
Point itemLoc = itemBeingDragged.TranslatePoint(new Point(0, 0), this.ListView);
|
||||
double top = itemLoc.Y + ptCursor.Y - this.ptMouseDown.Y;
|
||||
|
||||
this.dragAdorner.SetOffsets(left, top);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // UpdateDragAdornerLocation
|
||||
|
||||
#endregion // Private Helpers
|
||||
}
|
||||
|
||||
#endregion // ListViewDragDropManager
|
||||
|
||||
#region ListViewItemDragState
|
||||
|
||||
/// <summary>
|
||||
/// Exposes attached properties used in conjunction with the ListViewDragDropManager class.
|
||||
/// Those properties can be used to allow triggers to modify the appearance of ListViewItems
|
||||
/// in a ListView during a drag-drop operation.
|
||||
/// </summary>
|
||||
public static class ListViewItemDragState
|
||||
{
|
||||
#region IsBeingDragged
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the ListViewItemDragState's IsBeingDragged attached property.
|
||||
/// This field is read-only.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsBeingDraggedProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"IsBeingDragged",
|
||||
typeof(bool),
|
||||
typeof(ListViewItemDragState),
|
||||
new UIPropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the specified ListViewItem is being dragged, else false.
|
||||
/// </summary>
|
||||
/// <param name="item">The ListViewItem to check.</param>
|
||||
public static bool GetIsBeingDragged(ListViewItem item)
|
||||
{
|
||||
return (bool)item.GetValue(IsBeingDraggedProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the IsBeingDragged attached property for the specified ListViewItem.
|
||||
/// </summary>
|
||||
/// <param name="item">The ListViewItem to set the property on.</param>
|
||||
/// <param name="value">Pass true if the element is being dragged, else false.</param>
|
||||
internal static void SetIsBeingDragged(ListViewItem item, bool value)
|
||||
{
|
||||
item.SetValue(IsBeingDraggedProperty, value);
|
||||
}
|
||||
|
||||
#endregion // IsBeingDragged
|
||||
|
||||
#region IsUnderDragCursor
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the ListViewItemDragState's IsUnderDragCursor attached property.
|
||||
/// This field is read-only.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsUnderDragCursorProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"IsUnderDragCursor",
|
||||
typeof(bool),
|
||||
typeof(ListViewItemDragState),
|
||||
new UIPropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the specified ListViewItem is currently underneath the cursor
|
||||
/// during a drag-drop operation, else false.
|
||||
/// </summary>
|
||||
/// <param name="item">The ListViewItem to check.</param>
|
||||
public static bool GetIsUnderDragCursor(ListViewItem item)
|
||||
{
|
||||
return (bool)item.GetValue(IsUnderDragCursorProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the IsUnderDragCursor attached property for the specified ListViewItem.
|
||||
/// </summary>
|
||||
/// <param name="item">The ListViewItem to set the property on.</param>
|
||||
/// <param name="value">Pass true if the element is underneath the drag cursor, else false.</param>
|
||||
internal static void SetIsUnderDragCursor(ListViewItem item, bool value)
|
||||
{
|
||||
item.SetValue(IsUnderDragCursorProperty, value);
|
||||
}
|
||||
|
||||
#endregion // IsUnderDragCursor
|
||||
}
|
||||
|
||||
#endregion // ListViewItemDragState
|
||||
|
||||
#region ProcessDropEventArgs
|
||||
|
||||
/// <summary>
|
||||
/// Event arguments used by the ListViewDragDropManager.ProcessDrop event.
|
||||
/// </summary>
|
||||
/// <typeparam name="ItemType">The type of data object being dropped.</typeparam>
|
||||
public class ProcessDropEventArgs<ItemType> : EventArgs where ItemType : class
|
||||
{
|
||||
#region Data
|
||||
|
||||
ObservableCollection<ItemType> itemsSource;
|
||||
ItemType dataItem;
|
||||
int oldIndex;
|
||||
int newIndex;
|
||||
DragDropEffects allowedEffects = DragDropEffects.None;
|
||||
DragDropEffects effects = DragDropEffects.None;
|
||||
|
||||
#endregion // Data
|
||||
|
||||
#region Constructor
|
||||
|
||||
internal ProcessDropEventArgs(
|
||||
ObservableCollection<ItemType> itemsSource,
|
||||
ItemType dataItem,
|
||||
int oldIndex,
|
||||
int newIndex,
|
||||
DragDropEffects allowedEffects)
|
||||
{
|
||||
this.itemsSource = itemsSource;
|
||||
this.dataItem = dataItem;
|
||||
this.oldIndex = oldIndex;
|
||||
this.newIndex = newIndex;
|
||||
this.allowedEffects = allowedEffects;
|
||||
}
|
||||
|
||||
#endregion // Constructor
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// The items source of the ListView where the drop occurred.
|
||||
/// </summary>
|
||||
public ObservableCollection<ItemType> ItemsSource
|
||||
{
|
||||
get { return this.itemsSource; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The data object which was dropped.
|
||||
/// </summary>
|
||||
public ItemType DataItem
|
||||
{
|
||||
get { return this.dataItem; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current index of the data item being dropped, in the ItemsSource collection.
|
||||
/// </summary>
|
||||
public int OldIndex
|
||||
{
|
||||
get { return this.oldIndex; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The target index of the data item being dropped, in the ItemsSource collection.
|
||||
/// </summary>
|
||||
public int NewIndex
|
||||
{
|
||||
get { return this.newIndex; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The drag drop effects allowed to be performed.
|
||||
/// </summary>
|
||||
public DragDropEffects AllowedEffects
|
||||
{
|
||||
get { return allowedEffects; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The drag drop effect(s) performed on the dropped item.
|
||||
/// </summary>
|
||||
public DragDropEffects Effects
|
||||
{
|
||||
get { return effects; }
|
||||
set { effects = value; }
|
||||
}
|
||||
|
||||
#endregion // Public Properties
|
||||
}
|
||||
|
||||
#endregion // ProcessDropEventArgs
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -45,30 +48,27 @@ namespace GeekDesk.Util
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
} catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void WriteLog(string msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||
{
|
||||
fs.Seek(0, SeekOrigin.End);
|
||||
byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
{
|
||||
fs.Seek(0, SeekOrigin.End);
|
||||
byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n");
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n" );
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch { }
|
||||
} catch { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.MyThread;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System;
|
||||
|
||||
using System.Windows.Forms;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using GeekDesk.Constant;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -25,29 +23,23 @@ namespace GeekDesk.Util
|
||||
{
|
||||
private static Window window;//定义使用该方法的窗体
|
||||
|
||||
private static readonly int hideTime = 50;
|
||||
private static readonly int showTime = 30;
|
||||
|
||||
private static int animalTime;
|
||||
|
||||
private static readonly int fadeHideTime = 50;
|
||||
private static readonly int fadeShowTime = 50;
|
||||
private static readonly int taskTime = 200;
|
||||
private static readonly int hideTime = 200;
|
||||
private static readonly int fadeHideTime = 180;
|
||||
private static readonly int fadeShowTime = 200;
|
||||
private static readonly int taskTime = 250;
|
||||
|
||||
public static readonly int shadowWidth = 20;
|
||||
|
||||
public static bool ON_HIDE = false;
|
||||
|
||||
|
||||
private static double showMarginWidth = 1;
|
||||
|
||||
public static bool IS_HIDE = false;
|
||||
|
||||
private static System.Windows.Forms.Timer timer = null;
|
||||
private static Timer timer = null;
|
||||
|
||||
public static void ReadyHide(Window window)
|
||||
{
|
||||
MarginHide.window = window;
|
||||
MarginHide.window = window;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +69,7 @@ namespace GeekDesk.Util
|
||||
#region 窗体贴边隐藏功能
|
||||
private static void HideWindow(object o, EventArgs e)
|
||||
{
|
||||
if (window.Visibility != Visibility.Visible
|
||||
|| RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW
|
||||
|| RunTimeStatus.LOCK_APP_PANEL) return;
|
||||
if (window.Visibility != Visibility.Visible) return;
|
||||
|
||||
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||
double screenTop = SystemParameters.VirtualScreenTop;
|
||||
@@ -104,7 +94,7 @@ namespace GeekDesk.Util
|
||||
if (windowTop <= screenTop)
|
||||
{
|
||||
IS_HIDE = true;
|
||||
//FadeAnimation(1, 0);
|
||||
FadeAnimation(1, 0);
|
||||
HideAnimation(windowTop, screenTop - windowHeight + showMarginWidth, Window.TopProperty, HideType.TOP_HIDE);
|
||||
return;
|
||||
}
|
||||
@@ -112,7 +102,7 @@ namespace GeekDesk.Util
|
||||
if (windowLeft <= screenLeft)
|
||||
{
|
||||
IS_HIDE = true;
|
||||
//FadeAnimation(1, 0);
|
||||
FadeAnimation(1, 0);
|
||||
HideAnimation(windowLeft, screenLeft - windowWidth + showMarginWidth, Window.LeftProperty, HideType.LEFT_HIDE);
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +110,7 @@ namespace GeekDesk.Util
|
||||
if (windowLeft + windowWidth + Math.Abs(screenLeft) >= screenWidth)
|
||||
{
|
||||
IS_HIDE = true;
|
||||
//FadeAnimation(1, 0);
|
||||
FadeAnimation(1, 0);
|
||||
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE);
|
||||
return;
|
||||
}
|
||||
@@ -133,7 +123,7 @@ namespace GeekDesk.Util
|
||||
{
|
||||
IS_HIDE = false;
|
||||
HideAnimation(windowTop, screenTop, Window.TopProperty, HideType.TOP_SHOW);
|
||||
//FadeAnimation(0, 1);
|
||||
FadeAnimation(0, 1);
|
||||
return;
|
||||
}
|
||||
//左侧显示
|
||||
@@ -141,7 +131,7 @@ namespace GeekDesk.Util
|
||||
{
|
||||
IS_HIDE = false;
|
||||
HideAnimation(windowLeft, screenLeft, Window.LeftProperty, HideType.LEFT_SHOW);
|
||||
//FadeAnimation(0, 1);
|
||||
FadeAnimation(0, 1);
|
||||
return;
|
||||
}
|
||||
//右侧显示
|
||||
@@ -149,7 +139,7 @@ namespace GeekDesk.Util
|
||||
{
|
||||
IS_HIDE = false;
|
||||
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - windowWidth, Window.LeftProperty, HideType.RIGHT_SHOW);
|
||||
//FadeAnimation(0, 1);
|
||||
FadeAnimation(0, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -160,9 +150,8 @@ namespace GeekDesk.Util
|
||||
|
||||
public static void StartHide()
|
||||
{
|
||||
ON_HIDE = true;
|
||||
if (timer != null) return;
|
||||
timer = new System.Windows.Forms.Timer
|
||||
timer = new Timer
|
||||
{
|
||||
Interval = taskTime
|
||||
};//添加timer计时器,隐藏功能
|
||||
@@ -172,7 +161,6 @@ namespace GeekDesk.Util
|
||||
|
||||
public static void StopHide()
|
||||
{
|
||||
ON_HIDE = false;
|
||||
if (timer == null) return;
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
@@ -193,7 +181,7 @@ namespace GeekDesk.Util
|
||||
if (windowLeft <= screenLeft - showMarginWidth)
|
||||
{
|
||||
IS_HIDE = false;
|
||||
//FadeAnimation(0, 1);
|
||||
FadeAnimation(0, 1);
|
||||
HideAnimation(windowLeft, screenLeft, Window.LeftProperty, HideType.LEFT_SHOW);
|
||||
return;
|
||||
}
|
||||
@@ -202,7 +190,7 @@ namespace GeekDesk.Util
|
||||
if (windowTop <= screenTop - showMarginWidth)
|
||||
{
|
||||
IS_HIDE = false;
|
||||
//FadeAnimation(0, 1);
|
||||
FadeAnimation(0, 1);
|
||||
HideAnimation(windowTop, screenTop, Window.TopProperty, HideType.TOP_SHOW);
|
||||
return;
|
||||
}
|
||||
@@ -211,7 +199,7 @@ namespace GeekDesk.Util
|
||||
if (windowLeft + Math.Abs(screenLeft) == screenWidth - showMarginWidth)
|
||||
{
|
||||
IS_HIDE = false;
|
||||
//FadeAnimation(0, 1);
|
||||
FadeAnimation(0, 1);
|
||||
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - windowWidth, Window.LeftProperty, HideType.RIGHT_SHOW);
|
||||
return;
|
||||
}
|
||||
@@ -222,181 +210,91 @@ namespace GeekDesk.Util
|
||||
private static void HideAnimation(double from, double to, DependencyProperty property, HideType hideType)
|
||||
{
|
||||
|
||||
new Thread(() =>
|
||||
double toTemp = to;
|
||||
double leftT = window.Width / 4 * 3;
|
||||
double topT = window.Height / 4 * 3;
|
||||
switch (hideType)
|
||||
{
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
case HideType.LEFT_HIDE:
|
||||
to += leftT;
|
||||
break;
|
||||
case HideType.LEFT_SHOW:
|
||||
to -= leftT;
|
||||
break;
|
||||
case HideType.RIGHT_HIDE:
|
||||
to -= leftT;
|
||||
break;
|
||||
case HideType.RIGHT_SHOW:
|
||||
to += leftT;
|
||||
break;
|
||||
case HideType.TOP_HIDE:
|
||||
to += topT;
|
||||
break;
|
||||
case HideType.TOP_SHOW:
|
||||
to -= topT;
|
||||
break;
|
||||
}
|
||||
DoubleAnimation da = new DoubleAnimation
|
||||
{
|
||||
From = from,
|
||||
To = to,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(hideTime))
|
||||
};
|
||||
// 如果是显示 则贴屏幕侧不显示阴影
|
||||
bool isShow = false;
|
||||
int shadowWidthTemp = Constants.SHADOW_WIDTH;
|
||||
if (hideType <= HideType.RIGHT_SHOW)
|
||||
{
|
||||
isShow = true;
|
||||
if (hideType == HideType.RIGHT_SHOW)
|
||||
{
|
||||
double abs = Math.Abs(Math.Abs(to) - Math.Abs(from));
|
||||
double subLen = abs / hideTime;
|
||||
shadowWidthTemp = -shadowWidthTemp;
|
||||
}
|
||||
}
|
||||
da.Completed += (s, e) =>
|
||||
{
|
||||
if ("Top".Equals(property.Name))
|
||||
{
|
||||
window.Top = isShow ? toTemp - shadowWidthTemp : toTemp;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Left = isShow ? toTemp - shadowWidthTemp : toTemp;
|
||||
}
|
||||
window.BeginAnimation(property, null);
|
||||
};
|
||||
|
||||
if ((int)hideType <= 3)
|
||||
{
|
||||
animalTime = showTime;
|
||||
} else
|
||||
{
|
||||
animalTime = hideTime;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
while (count < animalTime)
|
||||
{
|
||||
switch (hideType)
|
||||
{
|
||||
case HideType.LEFT_HIDE:
|
||||
window.Left -= subLen;
|
||||
break;
|
||||
case HideType.LEFT_SHOW:
|
||||
window.Left += subLen;
|
||||
break;
|
||||
case HideType.RIGHT_HIDE:
|
||||
window.Left += subLen;
|
||||
break;
|
||||
case HideType.RIGHT_SHOW:
|
||||
window.Left -= subLen;
|
||||
break;
|
||||
case HideType.TOP_HIDE:
|
||||
window.Top -= subLen;
|
||||
break;
|
||||
case HideType.TOP_SHOW:
|
||||
window.Top += subLen;
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
|
||||
switch (hideType)
|
||||
{
|
||||
case HideType.LEFT_HIDE:
|
||||
window.Left = to;
|
||||
break;
|
||||
case HideType.LEFT_SHOW:
|
||||
window.Left = to - 20;
|
||||
break;
|
||||
case HideType.RIGHT_HIDE:
|
||||
window.Left = to;
|
||||
break;
|
||||
case HideType.RIGHT_SHOW:
|
||||
window.Left = to + 20;
|
||||
break;
|
||||
case HideType.TOP_HIDE:
|
||||
window.Top = to;
|
||||
break;
|
||||
case HideType.TOP_SHOW:
|
||||
window.Top = to - 20;
|
||||
break;
|
||||
}
|
||||
//double toTemp = to;
|
||||
//double leftT = 0;
|
||||
//double topT = 0;
|
||||
//switch (hideType)
|
||||
//{
|
||||
// case HideType.LEFT_HIDE:
|
||||
// to += leftT;
|
||||
// break;
|
||||
// case HideType.LEFT_SHOW:
|
||||
// to -= leftT;
|
||||
// break;
|
||||
// case HideType.RIGHT_HIDE:
|
||||
// to -= leftT;
|
||||
// break;
|
||||
// case HideType.RIGHT_SHOW:
|
||||
// to += leftT;
|
||||
// break;
|
||||
// case HideType.TOP_HIDE:
|
||||
// to += topT;
|
||||
// break;
|
||||
// case HideType.TOP_SHOW:
|
||||
// to -= topT;
|
||||
// break;
|
||||
//}
|
||||
//DoubleAnimation da = new DoubleAnimation
|
||||
//{
|
||||
// From = from,
|
||||
// To = to,
|
||||
// Duration = new Duration(TimeSpan.FromMilliseconds(hideTime))
|
||||
//};
|
||||
//// 如果是显示 则贴屏幕侧不显示阴影
|
||||
//bool isShow = false;
|
||||
//int shadowWidthTemp = Constants.SHADOW_WIDTH;
|
||||
//if (hideType <= HideType.RIGHT_SHOW)
|
||||
//{
|
||||
// isShow = true;
|
||||
// if (hideType == HideType.RIGHT_SHOW)
|
||||
// {
|
||||
// shadowWidthTemp = -shadowWidthTemp;
|
||||
// }
|
||||
//}
|
||||
//da.Completed += (s, e) =>
|
||||
//{
|
||||
// if ("Top".Equals(property.Name))
|
||||
// {
|
||||
// window.Top = isShow ? toTemp - shadowWidthTemp : toTemp;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// window.Left = isShow ? toTemp - shadowWidthTemp : toTemp;
|
||||
// }
|
||||
// window.BeginAnimation(property, null);
|
||||
//};
|
||||
|
||||
//Timeline.SetDesiredFrameRate(da, 60);
|
||||
//window.BeginAnimation(property, da);
|
||||
});
|
||||
}).Start();
|
||||
|
||||
|
||||
Timeline.SetDesiredFrameRate(da, 60);
|
||||
window.BeginAnimation(property, da);
|
||||
}
|
||||
|
||||
private static void FadeAnimation(double from, double to)
|
||||
{
|
||||
new Thread(() =>
|
||||
double time;
|
||||
if (to == 0D)
|
||||
{
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
double time;
|
||||
if (to == 0D)
|
||||
{
|
||||
time = fadeHideTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
time = fadeShowTime;
|
||||
}
|
||||
DoubleAnimation opacityAnimation = new DoubleAnimation
|
||||
{
|
||||
From = from,
|
||||
To = to,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(time))
|
||||
};
|
||||
opacityAnimation.Completed += (s, e) =>
|
||||
{
|
||||
//window.Opacity = to;
|
||||
window.BeginAnimation(Window.OpacityProperty, null);
|
||||
};
|
||||
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
|
||||
window.BeginAnimation(Window.OpacityProperty, opacityAnimation);
|
||||
});
|
||||
}).Start();
|
||||
}
|
||||
|
||||
|
||||
public static void WaitHide(int waitTime)
|
||||
{
|
||||
System.Threading.Thread t = new System.Threading.Thread(() =>
|
||||
time = fadeHideTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Threading.Thread.Sleep(waitTime);
|
||||
//修改状态为false 继续执行贴边隐藏
|
||||
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
time = fadeShowTime;
|
||||
}
|
||||
DoubleAnimation opacityAnimation = new DoubleAnimation
|
||||
{
|
||||
From = from,
|
||||
To = to,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(time))
|
||||
};
|
||||
opacityAnimation.Completed += (s, e) =>
|
||||
{
|
||||
//window.Opacity = to;
|
||||
window.BeginAnimation(Window.OpacityProperty, null);
|
||||
};
|
||||
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
|
||||
window.BeginAnimation(Window.OpacityProperty, opacityAnimation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
|
||||
56
Util/MouseUtilities.cs
Normal file
56
Util/MouseUtilities.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace WPF.JoshSmith.Controls.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the mouse location by calling unmanaged code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class was written by Dan Crevier (Microsoft).
|
||||
/// http://blogs.msdn.com/llobo/archive/2006/09/06/Scrolling-Scrollviewer-on-Mouse-Drag-at-the-boundaries.aspx
|
||||
/// </remarks>
|
||||
public class MouseUtilities
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct Win32Point
|
||||
{
|
||||
public Int32 X;
|
||||
public Int32 Y;
|
||||
};
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool GetCursorPos(ref Win32Point pt);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool ScreenToClient(IntPtr hwnd, ref Win32Point pt);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the mouse cursor location. This method is necessary during
|
||||
/// a drag-drop operation because the WPF mechanisms for retrieving the
|
||||
/// cursor coordinates are unreliable.
|
||||
/// </summary>
|
||||
/// <param name="relativeTo">The Visual to which the mouse coordinates will be relative.</param>
|
||||
public static Point GetMousePosition(Visual relativeTo)
|
||||
{
|
||||
Win32Point mouse = new Win32Point();
|
||||
GetCursorPos(ref mouse);
|
||||
|
||||
// Using PointFromScreen instead of Dan Crevier's code (commented out below)
|
||||
// is a bug fix created by William J. Roberts. Read his comments about the fix
|
||||
// here: http://www.codeproject.com/useritems/ListViewDragDropManager.asp?msg=1911611#xx1911611xx
|
||||
return relativeTo.PointFromScreen(new Point((double)mouse.X, (double)mouse.Y));
|
||||
|
||||
#region Commented Out
|
||||
//System.Windows.Interop.HwndSource presentationSource =
|
||||
// (System.Windows.Interop.HwndSource)PresentationSource.FromVisual( relativeTo );
|
||||
//ScreenToClient( presentationSource.Handle, ref mouse );
|
||||
//GeneralTransform transform = relativeTo.TransformToAncestor( presentationSource.RootVisual );
|
||||
//Point offset = transform.Transform( new Point( 0, 0 ) );
|
||||
//return new Point( mouse.X - offset.X, mouse.Y - offset.Y );
|
||||
#endregion // Commented Out
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -1164,7 +1166,7 @@ namespace GeekDesk.Util
|
||||
Int32 ParseDisplayName(
|
||||
IntPtr hwnd,
|
||||
IntPtr pbc,
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
string pszDisplayName,
|
||||
ref uint pchEaten,
|
||||
out IntPtr ppidl,
|
||||
@@ -1259,7 +1261,7 @@ namespace GeekDesk.Util
|
||||
Int32 SetNameOf(
|
||||
IntPtr hwnd,
|
||||
IntPtr pidl,
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
string pszName,
|
||||
SHGNO uFlags,
|
||||
out IntPtr ppidlOut);
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
namespace GeekDesk.Util
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class StringUtil
|
||||
public class StringUtil
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -28,7 +27,6 @@ namespace GeekDesk.ViewModel
|
||||
private int selectedMenuIndex = 0; //上次选中菜单索引
|
||||
private bool followMouse = true; //面板跟随鼠标 默认是
|
||||
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
|
||||
private Visibility titleLogoVisible = Visibility.Visible; // 标题logo是否显示
|
||||
private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后)
|
||||
private bool startedShowPanel = true; //启动时是否显示主面板 默认显示
|
||||
[field: NonSerialized]
|
||||
@@ -48,12 +46,7 @@ namespace GeekDesk.ViewModel
|
||||
|
||||
private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键
|
||||
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
|
||||
private Key toDoHotkey = Key.Q; //待办任务快捷键
|
||||
|
||||
|
||||
private string colorPickerHotkeyStr = ""; //拾色器快捷键
|
||||
private HotkeyModifiers colorPickerHotkeyModifiers; //拾色器快捷键
|
||||
private Key colorPickerHotkey; //拾色器快捷键
|
||||
private Key toDoHotkey = Key.E; //待办任务快捷键
|
||||
|
||||
private string customIconUrl; //自定义图标url
|
||||
private string customIconJsonUrl; //自定义图标json信息url
|
||||
@@ -82,121 +75,8 @@ namespace GeekDesk.ViewModel
|
||||
|
||||
private bool hoverMenu = false; //悬停切换菜单 默认关闭
|
||||
|
||||
private BGStyle bgStyle = BGStyle.ImgBac; //背景风格
|
||||
|
||||
private GradientBGParam gradientBGParam = null; //渐变背景参数
|
||||
|
||||
private bool? enableAppHotKey = true; //可能为null 开启热键
|
||||
private bool? enableTodoHotKey = true; //可能为null 开启待办热键
|
||||
|
||||
private bool enableColorPickerHotKey; //新增 默认为false 不需要考虑null值
|
||||
|
||||
private SearchType searchType;
|
||||
|
||||
|
||||
#region GetSet
|
||||
|
||||
public SearchType SearchType
|
||||
{
|
||||
get
|
||||
{
|
||||
return searchType;
|
||||
}
|
||||
set
|
||||
{
|
||||
searchType = value;
|
||||
OnPropertyChanged("SearchType");
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableColorPickerHotKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return enableColorPickerHotKey;
|
||||
}
|
||||
set
|
||||
{
|
||||
enableColorPickerHotKey = value;
|
||||
OnPropertyChanged("EnableColorPickerHotKey");
|
||||
}
|
||||
}
|
||||
|
||||
public bool? EnableAppHotKey
|
||||
{
|
||||
get
|
||||
{
|
||||
if (enableAppHotKey == null) enableAppHotKey = true;
|
||||
return enableAppHotKey;
|
||||
}
|
||||
set
|
||||
{
|
||||
enableAppHotKey = value;
|
||||
OnPropertyChanged("EnableAppHotKey");
|
||||
}
|
||||
}
|
||||
|
||||
public bool? EnableTodoHotKey
|
||||
{
|
||||
get
|
||||
{
|
||||
if (enableTodoHotKey == null) enableTodoHotKey = true;
|
||||
return enableTodoHotKey;
|
||||
}
|
||||
set
|
||||
{
|
||||
enableTodoHotKey = value;
|
||||
OnPropertyChanged("EnableTodoHotKey");
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility TitleLogoVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return titleLogoVisible;
|
||||
}
|
||||
set
|
||||
{
|
||||
titleLogoVisible = value;
|
||||
OnPropertyChanged("TitleLogoVisible");
|
||||
}
|
||||
}
|
||||
|
||||
public GradientBGParam GradientBGParam
|
||||
{
|
||||
get
|
||||
{
|
||||
if (gradientBGParam == null)
|
||||
{
|
||||
gradientBGParam = GradientBGParamList.GradientBGParams[0];
|
||||
}
|
||||
return gradientBGParam;
|
||||
}
|
||||
set
|
||||
{
|
||||
gradientBGParam = value;
|
||||
OnPropertyChanged("GradientBGParam");
|
||||
}
|
||||
}
|
||||
|
||||
public BGStyle BGStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (bgStyle == 0)
|
||||
{
|
||||
bgStyle = (BGStyle)1;
|
||||
}
|
||||
return bgStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
bgStyle = value;
|
||||
OnPropertyChanged("BGStyle");
|
||||
}
|
||||
}
|
||||
|
||||
public bool HoverMenu
|
||||
{
|
||||
get
|
||||
@@ -441,47 +321,6 @@ namespace GeekDesk.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public Key ColorPickerHotkey
|
||||
{
|
||||
get
|
||||
{
|
||||
return colorPickerHotkey;
|
||||
}
|
||||
set
|
||||
{
|
||||
colorPickerHotkey = value;
|
||||
OnPropertyChanged("ColorPickerHotkey");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HotkeyModifiers ColorPickerHotkeyModifiers
|
||||
{
|
||||
get
|
||||
{
|
||||
return colorPickerHotkeyModifiers;
|
||||
}
|
||||
set
|
||||
{
|
||||
colorPickerHotkeyModifiers = value;
|
||||
OnPropertyChanged("ColorPickerHotkeyModifiers");
|
||||
}
|
||||
}
|
||||
|
||||
public string ColorPickerHotkeyStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return colorPickerHotkeyStr;
|
||||
}
|
||||
set
|
||||
{
|
||||
colorPickerHotkeyStr = value;
|
||||
OnPropertyChanged("ColorPickerHotkeyStr");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Key ToDoHotkey
|
||||
{
|
||||
get
|
||||
@@ -489,7 +328,7 @@ namespace GeekDesk.ViewModel
|
||||
//兼容老版本
|
||||
if (toDoHotkey == Key.None)
|
||||
{
|
||||
toDoHotkey = Key.E;
|
||||
toDoHotkey = Key.Q;
|
||||
}
|
||||
return toDoHotkey;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GeekDesk.ViewModel
|
||||
{
|
||||
|
||||
public class CPDataContext : INotifyPropertyChanged
|
||||
{
|
||||
private BitmapSource pixelIMG;
|
||||
|
||||
private System.Drawing.Color pixelColor_D;
|
||||
|
||||
public Color pixelColor;
|
||||
|
||||
private string colorHtml;
|
||||
|
||||
private string colorRGB;
|
||||
|
||||
private string pixelXY;
|
||||
|
||||
public BitmapSource PixelIMG
|
||||
{
|
||||
set
|
||||
{
|
||||
pixelIMG = value;
|
||||
OnPropertyChanged("PixelIMG");
|
||||
}
|
||||
get { return pixelIMG; }
|
||||
}
|
||||
|
||||
public System.Drawing.Color PixelColor_D
|
||||
{
|
||||
set
|
||||
{
|
||||
pixelColor_D = value;
|
||||
ColorHtml = pixelColor_D.Name.ToUpper().Substring(2);
|
||||
ColorRGB = pixelColor_D.R + "," + pixelColor_D.G + "," + pixelColor_D.B;
|
||||
PixelColor = Color.FromArgb(pixelColor_D.A, pixelColor_D.R, pixelColor_D.G, pixelColor_D.B);
|
||||
}
|
||||
get { return pixelColor_D; }
|
||||
}
|
||||
|
||||
public Color PixelColor
|
||||
{
|
||||
set
|
||||
{
|
||||
pixelColor = value;
|
||||
OnPropertyChanged("PixelColor");
|
||||
}
|
||||
get { return pixelColor; }
|
||||
}
|
||||
|
||||
public string ColorRGB
|
||||
{
|
||||
set
|
||||
{
|
||||
colorRGB = value;
|
||||
OnPropertyChanged("ColorRGB");
|
||||
}
|
||||
get { return colorRGB; }
|
||||
}
|
||||
|
||||
public string ColorHtml
|
||||
{
|
||||
set
|
||||
{
|
||||
colorHtml = value;
|
||||
OnPropertyChanged("ColorHtml");
|
||||
}
|
||||
get { return colorHtml; }
|
||||
}
|
||||
|
||||
|
||||
public string PixelXY
|
||||
{
|
||||
set
|
||||
{
|
||||
pixelXY = value;
|
||||
OnPropertyChanged("PixelXY");
|
||||
}
|
||||
get { return pixelXY; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace GeekDesk.ViewModel
|
||||
{
|
||||
[Serializable]
|
||||
public class GradientBGParam : INotifyPropertyChanged
|
||||
{
|
||||
private string color1;
|
||||
|
||||
private string color2;
|
||||
|
||||
private string name;
|
||||
|
||||
public GradientBGParam() { }
|
||||
|
||||
public GradientBGParam(string name, string color1, string color2)
|
||||
{
|
||||
this.name = name;
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string Color1
|
||||
{
|
||||
get
|
||||
{
|
||||
return color1;
|
||||
}
|
||||
set
|
||||
{
|
||||
color1 = value;
|
||||
OnPropertyChanged("Color1");
|
||||
}
|
||||
}
|
||||
|
||||
public string Color2
|
||||
{
|
||||
get
|
||||
{
|
||||
return color2;
|
||||
}
|
||||
set
|
||||
{
|
||||
color2 = value;
|
||||
OnPropertyChanged("Color2");
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return name;
|
||||
}
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
OnPropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[field: NonSerializedAttribute()]
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user