Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3794d877f2 | ||
|
|
be9dcdb923 | ||
|
|
125cc72499 | ||
|
|
6e5163c23c | ||
|
|
e14faecb19 | ||
|
|
dcb2f24f2f | ||
|
|
f763ba7565 | ||
|
|
e263082f0d | ||
|
|
eec261ca4a | ||
|
|
1457265496 | ||
|
|
bec1b8c6ea | ||
|
|
d9270ff337 | ||
|
|
5bd6af6cc7 | ||
|
|
734b78b327 | ||
|
|
701dc27361 | ||
|
|
b0066939dd | ||
|
|
679a0edbed | ||
|
|
f6624caa82 | ||
|
|
c46f66b54d | ||
|
|
7d48b16900 | ||
|
|
9789e9b02b |
@@ -44,7 +44,7 @@
|
|||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="Version" value="2.4.13" />
|
<add key="Version" value="2.4.14" />
|
||||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
||||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
||||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace GeekDesk.Constant
|
|||||||
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
|
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
|
||||||
|
|
||||||
// 是否为开发模式
|
// 是否为开发模式
|
||||||
public static bool DEV = true;
|
public static bool DEV = false;
|
||||||
|
|
||||||
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
||||||
|
|
||||||
@@ -26,8 +26,7 @@ namespace GeekDesk.Constant
|
|||||||
|
|
||||||
public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
|
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");
|
public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");
|
||||||
|
|||||||
26
Constant/RunTimeStatus.cs
Normal file
26
Constant/RunTimeStatus.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
@@ -21,11 +22,11 @@
|
|||||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
|
|
||||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Star"
|
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
|
||||||
Command="hc:ControlCommands.OpenLink"
|
Command="hc:ControlCommands.OpenLink"
|
||||||
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
||||||
Margin="0,0,10,0" Color="#24292F"/>
|
Margin="0,0,10,0" Color="#24292F"/>
|
||||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Star"
|
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
|
||||||
Command="hc:ControlCommands.OpenLink"
|
Command="hc:ControlCommands.OpenLink"
|
||||||
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
|
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
|
||||||
Margin="0,0,10,0" Color="#C71D23"/>
|
Margin="0,0,10,0" Color="#C71D23"/>
|
||||||
@@ -61,9 +62,17 @@
|
|||||||
</hc:Poptip.Instance>
|
</hc:Poptip.Instance>
|
||||||
</hc:Shield>
|
</hc:Shield>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center"
|
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
|
||||||
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>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid MouseDown="DragMove" Background="Transparent">
|
<Grid MouseDown="DragMove" Background="Transparent">
|
||||||
<StackPanel Margin="20" >
|
<StackPanel Margin="20" >
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
hc:Poptip.HitMode="None"
|
hc:Poptip.HitMode="None"
|
||||||
@@ -25,117 +25,117 @@
|
|||||||
hc:Poptip.Content="{Binding BacImgName}"
|
hc:Poptip.Content="{Binding BacImgName}"
|
||||||
hc:Poptip.Placement="TopLeft"
|
hc:Poptip.Placement="TopLeft"
|
||||||
/>
|
/>
|
||||||
<Button Content="修改" Click="BGButton_Click"/>
|
<Button Content="修改" Click="BGButton_Click"/>
|
||||||
<Button Content="默认" Click="DefaultButton_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>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||||
<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"
|
Maximum="100"
|
||||||
Width="350"
|
Width="350"
|
||||||
>
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
Width="350"
|
Width="350"
|
||||||
>
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||||
Minimum="50"
|
Minimum="50"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
Width="350"
|
Width="350"
|
||||||
>
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
||||||
Maximum="25"
|
Maximum="25"
|
||||||
Width="350"
|
Width="350"
|
||||||
>
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="图标大小" VerticalAlignment="Center"/>
|
<TextBlock Text="图标大小" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"
|
||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
PreviewMouseLeftButtonDown="PreviewSlider_MouseLeftButtonUp"
|
PreviewMouseLeftButtonDown="PreviewSlider_MouseLeftButtonUp"
|
||||||
>
|
>
|
||||||
<hc:PreviewSlider Value="{Binding ImageWidth, Mode=TwoWay}"
|
<hc:PreviewSlider Value="{Binding ImageWidth, Mode=TwoWay}"
|
||||||
Minimum="40"
|
Minimum="40"
|
||||||
Maximum="60"
|
Maximum="60"
|
||||||
Width="350"
|
Width="350"
|
||||||
>
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</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>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
<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>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
||||||
Visibility="Collapsed"
|
Visibility="Collapsed"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
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:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
||||||
<!--<EventSetter Event="Unselected" Handler="ListBoxItem_Unselected"/>-->
|
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<MultiTrigger>
|
<MultiTrigger>
|
||||||
<MultiTrigger.Conditions>
|
<MultiTrigger.Conditions>
|
||||||
@@ -49,11 +50,7 @@
|
|||||||
</MultiTrigger>
|
</MultiTrigger>
|
||||||
|
|
||||||
|
|
||||||
|
<!--移到代码设置-->
|
||||||
<Trigger Property="IsSelected" Value="True">
|
|
||||||
<Setter Property="Background" Value="#ECECEC"/>
|
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
|
||||||
</Trigger>
|
|
||||||
<!--<Trigger Property="IsSelected" Value="False">
|
<!--<Trigger Property="IsSelected" Value="False">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
@@ -67,12 +64,10 @@
|
|||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</Trigger>-->
|
</Trigger>-->
|
||||||
|
<Trigger Property="IsMouseOver" Value="False">
|
||||||
<!--<MultiTrigger>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<MultiTrigger.Conditions>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
<Condition Property=""></Condition>
|
</Trigger>
|
||||||
</MultiTrigger.Conditions>
|
|
||||||
</MultiTrigger>-->
|
|
||||||
|
|
||||||
|
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
@@ -82,10 +77,11 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--左侧栏-->
|
<!--左侧栏-->
|
||||||
<hc:Card x:Name="MyCard"
|
<hc:Card x:Name="MyCard"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,0,5"
|
Margin="5,0,0,5"
|
||||||
>
|
MouseDown="MyCard_MouseDown"
|
||||||
|
>
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||||
|
|
||||||
@@ -135,7 +131,7 @@
|
|||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Tag="{Binding}">
|
<StackPanel Tag="{Binding}" MouseDown="ListBoxItem_MouseDown">
|
||||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DraggAnimatedPanelExample;
|
using DraggAnimatedPanelExample;
|
||||||
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.MyThread;
|
using GeekDesk.MyThread;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
@@ -9,7 +10,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
@@ -23,6 +24,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
private int menuSelectIndexTemp = -1;
|
private int menuSelectIndexTemp = -1;
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
||||||
|
|
||||||
|
|
||||||
//是否正在修改菜单
|
//是否正在修改菜单
|
||||||
private static bool IS_EDIT = false;
|
private static bool IS_EDIT = false;
|
||||||
@@ -30,17 +33,61 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
public LeftCardControl()
|
public LeftCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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)
|
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;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
MenuListBox.SelectedIndex = appData.AppConfig.SelectedMenuIndex;
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateCommand<int[]> _swap;
|
DelegateCommand<int[]> _swap;
|
||||||
|
|
||||||
public DelegateCommand<int[]> SwapCommand
|
public DelegateCommand<int[]> SwapCommand
|
||||||
{
|
{
|
||||||
@@ -65,13 +112,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////菜单点击事件
|
|
||||||
//private void MenuClick(object sender, MouseButtonEventArgs e)
|
|
||||||
//{
|
|
||||||
// //设置对应菜单的图标列表
|
|
||||||
// MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag);
|
|
||||||
// appData.AppConfig.SelectedMenuIcons = mi.IconList;
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中
|
/// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中
|
||||||
@@ -83,12 +123,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
StackPanel sp = sender as StackPanel;
|
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)
|
if (sp.Visibility == Visibility.Collapsed)
|
||||||
{
|
{
|
||||||
//SolidColorBrush scb = new SolidColorBrush(Colors.Red);
|
lbi.MouseEnter += Lbi_MouseEnter;
|
||||||
//lbi.MouseEnter += Lbi_MouseEnter;
|
|
||||||
|
|
||||||
if (MenuListBox.SelectedIndex != -1)
|
if (MenuListBox.SelectedIndex != -1)
|
||||||
{
|
{
|
||||||
menuSelectIndexTemp = MenuListBox.SelectedIndex;
|
menuSelectIndexTemp = MenuListBox.SelectedIndex;
|
||||||
@@ -98,32 +136,51 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
//SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
lbi.MouseEnter += (s, me) =>
|
||||||
//SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
{
|
||||||
|
lbi.Background = bac;
|
||||||
|
};
|
||||||
|
|
||||||
//lbi.MouseEnter += (s, me) =>
|
lbi.MouseLeave += Lbi_MouseLeave;
|
||||||
//{
|
lbi.Selected += Lbi_Selected;
|
||||||
// lbi.Background = bac;
|
|
||||||
//};
|
|
||||||
|
|
||||||
//lbi.MouseLeave += Lbi_MouseLeave;
|
|
||||||
|
|
||||||
//lbi.Selected += (s, me) =>
|
|
||||||
//{
|
|
||||||
// lbi.MouseLeave -= Lbi_MouseLeave;
|
|
||||||
// lbi.Background = bac;
|
|
||||||
// lbi.Foreground = fontColor;
|
|
||||||
//};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void Lbi_MouseEnter(object sender, MouseEventArgs e)
|
#region 设置菜单触发事件
|
||||||
//{
|
private void Lbi_MouseEnter(object sender, MouseEventArgs e)
|
||||||
// ListBoxItem lbi = sender as ListBoxItem;
|
{
|
||||||
// lbi.Background = Brushes.Transparent;
|
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
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新建菜单
|
/// 新建菜单
|
||||||
@@ -134,33 +191,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
MenuInfo info = new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" };
|
MenuInfo info = new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" };
|
||||||
appData.MenuList.Add(info);
|
appData.MenuList.Add(info);
|
||||||
MenuListBox.Items.Refresh();
|
|
||||||
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
|
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
|
||||||
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
||||||
appData.AppConfig.SelectedMenuIcons = info.IconList;
|
appData.AppConfig.SelectedMenuIcons = info.IconList;
|
||||||
|
//首次触发不了Selected事件
|
||||||
//ItemCollection ic = MenuListBox.Items;
|
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||||
//SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
SetListBoxItemEvent((ListBoxItem)obj);
|
||||||
//SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
Lbi_Selected(obj, null);
|
||||||
//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>
|
/// <summary>
|
||||||
/// 重命名菜单 将textbox 设置为可见
|
/// 重命名菜单 将textbox 设置为可见
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -187,12 +227,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
CreateMenu(null, null);
|
CreateMenu(null, null);
|
||||||
}
|
}
|
||||||
int index = appData.MenuList.IndexOf(menuInfo);
|
int index = appData.MenuList.IndexOf(menuInfo);
|
||||||
if(index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
index = index - 1;
|
index--;
|
||||||
}
|
}
|
||||||
|
|
||||||
appData.MenuList.Remove(menuInfo);
|
appData.MenuList.Remove(menuInfo);
|
||||||
@@ -217,11 +258,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
if (eKey.Key == Key.Enter)
|
if (eKey.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
menuBox = ((TextBox)sender);
|
menuBox = ((TextBox)sender);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
} else if (e.GetType() == typeof(RoutedEventArgs))
|
}
|
||||||
|
else if (e.GetType() == typeof(RoutedEventArgs))
|
||||||
{
|
{
|
||||||
menuBox = ((TextBox)sender);
|
menuBox = ((TextBox)sender);
|
||||||
}
|
}
|
||||||
@@ -280,19 +323,6 @@ 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>
|
/// <summary>
|
||||||
/// 鼠标悬停切换菜单
|
/// 鼠标悬停切换菜单
|
||||||
@@ -319,6 +349,29 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,14 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>-->
|
</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">
|
<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="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}"/>
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||||
@@ -69,7 +77,7 @@
|
|||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
>
|
>
|
||||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Padding="0,10,0,0"
|
Padding="0,10,0,0"
|
||||||
>
|
>
|
||||||
@@ -107,26 +115,35 @@
|
|||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<hc:SimpleStackPanel Tag="{Binding}"
|
<hc:SimpleStackPanel Tag="{Binding}"
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
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}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
hc:Poptip.Content="{Binding Content}"
|
hc:Poptip.Content="{Binding Content}"
|
||||||
hc:Poptip.Placement="BottomLeft"
|
hc:Poptip.Placement="BottomLeft"
|
||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
MouseEnter="StackPanel_MouseEnter"
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
>
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
<TextBlock MaxWidth="80"
|
>
|
||||||
Margin="0,5,0,0"
|
<!--<StackPanel Background="#00FFFFFF"
|
||||||
MaxHeight="40"
|
MouseEnter="CursorPanel_MouseEnter"
|
||||||
FontSize="13"
|
MouseLeave="CursorPanel_MouseLeave"
|
||||||
TextWrapping="Wrap"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
||||||
TextTrimming="WordEllipsis"
|
<Image Style="{StaticResource ImageStyle}"
|
||||||
TextAlignment="Center"
|
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
VerticalAlignment="Center"
|
<TextBlock MaxWidth="80"
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
Margin="0,5,0,0"
|
||||||
Text="{Binding Name}"/>
|
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>-->
|
||||||
|
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
@@ -137,14 +154,17 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
|
||||||
<hc:Card
|
<hc:Card x:Name="VerticalCard"
|
||||||
x:Name="VerticalCard"
|
|
||||||
Visibility="Hidden"
|
Visibility="Hidden"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||||
|
MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
|
||||||
|
>
|
||||||
<hc:Card.Background>
|
<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.Background>
|
||||||
<hc:Card.BorderBrush>
|
<hc:Card.BorderBrush>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
@@ -155,36 +175,45 @@
|
|||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
>
|
>
|
||||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom1Transition}">
|
||||||
BorderThickness="0"
|
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||||
Padding="0,10,0,0"
|
BorderThickness="0"
|
||||||
>
|
Padding="0,10,0,0"
|
||||||
<ListBox.Background>
|
>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<ListBox.Background>
|
||||||
</ListBox.Background>
|
<SolidColorBrush Opacity="0"/>
|
||||||
|
</ListBox.Background>
|
||||||
|
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="IconDialog" Width="200">
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemsPanel>
|
||||||
<DataTemplate>
|
<ItemsPanelTemplate>
|
||||||
<WrapPanel Tag="{Binding}"
|
<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}"
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
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}}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
hc:Poptip.HitMode="None"
|
hc:Poptip.HitMode="None"
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
@@ -195,8 +224,8 @@
|
|||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
Margin="25,20,0,0"
|
Margin="25,20,0,0"
|
||||||
>
|
>
|
||||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="10,5,0,0"
|
Margin="10,5,0,0"
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
FontSize="13"
|
FontSize="13"
|
||||||
@@ -206,10 +235,12 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
Text="{Binding Name}"/>
|
Text="{Binding Name}"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
|
if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
|
||||||
{
|
{
|
||||||
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
|
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||||
if (icon.AdminStartUp)
|
if (icon.AdminStartUp)
|
||||||
{
|
{
|
||||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||||
@@ -129,7 +129,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
||||||
{
|
{
|
||||||
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
|
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||||
if (icon.AdminStartUp)
|
if (icon.AdminStartUp)
|
||||||
{
|
{
|
||||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||||
@@ -261,6 +261,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
icon.Count++;
|
icon.Count++;
|
||||||
|
|
||||||
|
//隐藏搜索框
|
||||||
|
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.HidedSearchBox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -577,11 +583,45 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
if (vb == Visibility.Visible)
|
if (vb == Visibility.Visible)
|
||||||
{
|
{
|
||||||
WrapCard.Visibility = Visibility.Collapsed;
|
WrapCard.Visibility = Visibility.Collapsed;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
WrapCard.Visibility = Visibility.Visible;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ namespace GeekDesk.Control.UserControls.SystemItem
|
|||||||
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
||||||
}
|
}
|
||||||
menuInfo.IconList.Add(iconInfo);
|
menuInfo.IconList.Add(iconInfo);
|
||||||
CommonCode.SortIconList();
|
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,16 @@ namespace GeekDesk.Converts
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
double menuLeftWidth = double.Parse(value.ToString());
|
string param = parameter as string;
|
||||||
return MainWindow.mainWindow.Width - menuLeftWidth;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Windows.Data;
|
|||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
{
|
{
|
||||||
public class SortTypeConvert : IValueConverter
|
public class SortTypeConvert : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -130,6 +130,7 @@
|
|||||||
<Compile Include="Constant\IconType.cs" />
|
<Compile Include="Constant\IconType.cs" />
|
||||||
<Compile Include="Constant\CommonEnum.cs" />
|
<Compile Include="Constant\CommonEnum.cs" />
|
||||||
<Compile Include="Constant\IconStartType.cs" />
|
<Compile Include="Constant\IconStartType.cs" />
|
||||||
|
<Compile Include="Constant\RunTimeStatus.cs" />
|
||||||
<Compile Include="Constant\SortType.cs" />
|
<Compile Include="Constant\SortType.cs" />
|
||||||
<Compile Include="Constant\TodoTaskExecType.cs" />
|
<Compile Include="Constant\TodoTaskExecType.cs" />
|
||||||
<Compile Include="Constant\UpdateType.cs" />
|
<Compile Include="Constant\UpdateType.cs" />
|
||||||
@@ -190,10 +191,10 @@
|
|||||||
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
||||||
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Converts\SearchResWidth.cs" />
|
|
||||||
<Compile Include="Converts\DoubleToGridLength.cs" />
|
<Compile Include="Converts\DoubleToGridLength.cs" />
|
||||||
<Compile Include="Converts\SortTypeConvert.cs" />
|
|
||||||
<Compile Include="Converts\MenuInfoConvert.cs" />
|
<Compile Include="Converts\MenuInfoConvert.cs" />
|
||||||
|
<Compile Include="Converts\SearchResWidth.cs" />
|
||||||
|
<Compile Include="Converts\SortTypeConvert.cs" />
|
||||||
<Compile Include="Converts\TodoTaskExecConvert.cs" />
|
<Compile Include="Converts\TodoTaskExecConvert.cs" />
|
||||||
<Compile Include="Converts\IntToCornerRadius.cs" />
|
<Compile Include="Converts\IntToCornerRadius.cs" />
|
||||||
<Compile Include="Converts\OpcityConvert.cs" />
|
<Compile Include="Converts\OpcityConvert.cs" />
|
||||||
@@ -209,18 +210,14 @@
|
|||||||
<Compile Include="Util\AeroGlassHelper.cs" />
|
<Compile Include="Util\AeroGlassHelper.cs" />
|
||||||
<Compile Include="Util\GlobalHotKey.cs" />
|
<Compile Include="Util\GlobalHotKey.cs" />
|
||||||
<Compile Include="Util\CommonCode.cs" />
|
<Compile Include="Util\CommonCode.cs" />
|
||||||
<Compile Include="Util\ConsoleManager.cs" />
|
|
||||||
<Compile Include="Util\DragAdorner.cs" />
|
|
||||||
<Compile Include="Util\FileIcon.cs" />
|
<Compile Include="Util\FileIcon.cs" />
|
||||||
<Compile Include="Util\FileUtil.cs" />
|
<Compile Include="Util\FileUtil.cs" />
|
||||||
<Compile Include="Util\LogUtil.cs" />
|
<Compile Include="Util\LogUtil.cs" />
|
||||||
<Compile Include="Util\MarginHide.cs" />
|
<Compile Include="Util\MarginHide.cs" />
|
||||||
<Compile Include="Util\HttpUtil.cs" />
|
<Compile Include="Util\HttpUtil.cs" />
|
||||||
<Compile Include="Util\ImageUtil.cs" />
|
<Compile Include="Util\ImageUtil.cs" />
|
||||||
<Compile Include="Util\ListViewDragDropManager.cs" />
|
|
||||||
<Compile Include="Converts\MenuWidthConvert.cs" />
|
<Compile Include="Converts\MenuWidthConvert.cs" />
|
||||||
<Compile Include="Util\MouseUtil.cs" />
|
<Compile Include="Util\MouseUtil.cs" />
|
||||||
<Compile Include="Util\MouseUtilities.cs" />
|
|
||||||
<Compile Include="Util\RegisterUtil.cs" />
|
<Compile Include="Util\RegisterUtil.cs" />
|
||||||
<Compile Include="Util\ShellContextMenu.cs" />
|
<Compile Include="Util\ShellContextMenu.cs" />
|
||||||
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||||
@@ -405,6 +402,5 @@
|
|||||||
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
|
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
|
||||||
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
|
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
KeyDown="OnKeyDown"
|
KeyDown="OnKeyDown"
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
MouseDown="MainWindow_MouseDown"
|
MouseDown="MainWindow_MouseDown"
|
||||||
|
MouseEnter="MainWindow_MouseEnter"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
||||||
@@ -137,7 +138,6 @@
|
|||||||
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
|
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
|
||||||
x:Name="SearchBox"
|
x:Name="SearchBox"
|
||||||
Visibility="Collapsed"
|
Visibility="Collapsed"
|
||||||
LostFocus="SearchBox_LostFocus"
|
|
||||||
Margin="-100,5,0,0"
|
Margin="-100,5,0,0"
|
||||||
Height="32"
|
Height="32"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using static GeekDesk.Util.ShowWindowFollowMouse;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using NPinyin;
|
using NPinyin;
|
||||||
using GeekDesk.ViewModel.Temp;
|
using GeekDesk.ViewModel.Temp;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
{
|
{
|
||||||
@@ -58,6 +59,7 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void SearchItem(object sender, CanExecuteRoutedEventArgs e)
|
private void SearchItem(object sender, CanExecuteRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
RunTimeStatus.SEARCH_BOX_SHOW = true;
|
||||||
RightCard.VisibilitySearchCard(Visibility.Visible);
|
RightCard.VisibilitySearchCard(Visibility.Visible);
|
||||||
SearchBox.Visibility = Visibility.Visible;
|
SearchBox.Visibility = Visibility.Visible;
|
||||||
SearchBox.Focus();
|
SearchBox.Focus();
|
||||||
@@ -80,26 +82,25 @@ namespace GeekDesk
|
|||||||
foreach (IconInfo icon in iconList)
|
foreach (IconInfo icon in iconList)
|
||||||
{
|
{
|
||||||
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
|
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);
|
SearchIconList.IconList.Add(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
SearchIconList.IconList.Clear();
|
SearchIconList.IconList.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 隐藏搜索框
|
public void HidedSearchBox()
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void SearchBox_LostFocus(object sender, RoutedEventArgs e)
|
|
||||||
{
|
{
|
||||||
|
RunTimeStatus.SEARCH_BOX_SHOW = false;
|
||||||
|
SearchBox.Visibility = Visibility.Collapsed;
|
||||||
SearchIconList.IconList.Clear();
|
SearchIconList.IconList.Clear();
|
||||||
RightCard.VisibilitySearchCard(Visibility.Collapsed);
|
RightCard.VisibilitySearchCard(Visibility.Collapsed);
|
||||||
SearchBox.Visibility = Visibility.Collapsed;
|
|
||||||
SearchBox.Text = "";
|
SearchBox.Text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +121,7 @@ namespace GeekDesk
|
|||||||
this.Height = appData.AppConfig.WindowHeight;
|
this.Height = appData.AppConfig.WindowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 窗口加载完毕 执行方法
|
/// 窗口加载完毕 执行方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -338,7 +340,7 @@ namespace GeekDesk
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ShowApp(object sender, RoutedEventArgs e)
|
public void ShowApp(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
@@ -349,21 +351,53 @@ namespace GeekDesk
|
|||||||
//{
|
//{
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
//修改贴边隐藏状态为未隐藏
|
|
||||||
mainWindow.Activate();
|
|
||||||
|
|
||||||
MarginHide.IS_HIDE = false;
|
//修改贴边隐藏状态为未隐藏
|
||||||
|
if (MarginHide.ON_HIDE)
|
||||||
|
{
|
||||||
|
MarginHide.IS_HIDE = false;
|
||||||
|
if (!CommonCode.MouseInWindow(mainWindow))
|
||||||
|
{
|
||||||
|
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = true;
|
||||||
|
MarginHide.WaitHide(3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
mainWindow.Focus();
|
|
||||||
|
Keyboard.Focus(mainWindow.EmptyTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void HideApp()
|
public static void HideApp()
|
||||||
{
|
{
|
||||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
if (!MarginHide.IS_HIDE)
|
||||||
|
{
|
||||||
|
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
|
{
|
||||||
|
mainWindow.HidedSearchBox();
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
|
}));
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ShowApp();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -582,5 +616,15 @@ namespace GeekDesk
|
|||||||
EmptyTextBox.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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
MainWindow.xaml.rej
Normal file
9
MainWindow.xaml.rej
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
@@ -26,13 +26,13 @@ namespace GeekDesk.MyThread
|
|||||||
dispatcher = DispatcherBuild.Build();
|
dispatcher = DispatcherBuild.Build();
|
||||||
dispatcher.Invoke((Action)(() =>
|
dispatcher.Invoke((Action)(() =>
|
||||||
{
|
{
|
||||||
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
|
m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Dispose()
|
public static void Dispose()
|
||||||
{
|
{
|
||||||
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
|
m_GlobalHook.MouseUpExt -= M_GlobalHook_MouseUpExt;
|
||||||
m_GlobalHook.Dispose();
|
m_GlobalHook.Dispose();
|
||||||
dispatcher.InvokeShutdown();
|
dispatcher.InvokeShutdown();
|
||||||
}
|
}
|
||||||
@@ -42,13 +42,13 @@ namespace GeekDesk.MyThread
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private static void M_GlobalHook_MouseDownExt(object sender, System.Windows.Forms.MouseEventArgs e)
|
private static void M_GlobalHook_MouseUpExt(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (appConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
|
if (appConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
{
|
{
|
||||||
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
|
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
|
||||||
{
|
{
|
||||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.4.1.3")]
|
[assembly: AssemblyVersion("2.4.1.4")]
|
||||||
[assembly: AssemblyFileVersion("2.4.1.3")]
|
[assembly: AssemblyFileVersion("2.4.1.4")]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title": "GeekDesk版本更新",
|
"title": "GeekDesk版本更新",
|
||||||
"subTitle": "V2.4.12",
|
"subTitle": "V2.4.14",
|
||||||
"msgTitle": "本次更新内容如下",
|
"msgTitle": "本次更新内容如下",
|
||||||
"msg": "['各位兄弟去给我点个免费Star呗','这是个修复版本,主要修复上个版本的bug','修复图标无法拖动','修复界面遮挡任务栏']",
|
"msg": "['这次更新间隔比较久, 一个是工作比较忙, 另一个是因为老毛病颈椎病犯了, 但新版本总归是来了','增加图标排序功能','增加鼠标悬停切换菜单','增加搜索功能,显示界面后按下Ctrl+F','其它已知问题修复','老规矩兄弟萌, 我用爱发电, 你们点免费Star']",
|
||||||
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
||||||
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||||
"version": "2.4.12"
|
"version": "2.4.14"
|
||||||
}
|
}
|
||||||
@@ -222,5 +222,34 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
// 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,862 +0,0 @@
|
|||||||
// 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
|
|
||||||
}
|
|
||||||
@@ -30,6 +30,8 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
public static readonly int shadowWidth = 20;
|
public static readonly int shadowWidth = 20;
|
||||||
|
|
||||||
|
public static bool ON_HIDE = false;
|
||||||
|
|
||||||
|
|
||||||
private static double showMarginWidth = 1;
|
private static double showMarginWidth = 1;
|
||||||
|
|
||||||
@@ -69,7 +71,8 @@ namespace GeekDesk.Util
|
|||||||
#region 窗体贴边隐藏功能
|
#region 窗体贴边隐藏功能
|
||||||
private static void HideWindow(object o, EventArgs e)
|
private static void HideWindow(object o, EventArgs e)
|
||||||
{
|
{
|
||||||
if (window.Visibility != Visibility.Visible) return;
|
if (window.Visibility != Visibility.Visible
|
||||||
|
|| RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW) return;
|
||||||
|
|
||||||
double screenLeft = SystemParameters.VirtualScreenLeft;
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
double screenTop = SystemParameters.VirtualScreenTop;
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
@@ -150,6 +153,7 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
public static void StartHide()
|
public static void StartHide()
|
||||||
{
|
{
|
||||||
|
ON_HIDE = true;
|
||||||
if (timer != null) return;
|
if (timer != null) return;
|
||||||
timer = new Timer
|
timer = new Timer
|
||||||
{
|
{
|
||||||
@@ -161,6 +165,7 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
public static void StopHide()
|
public static void StopHide()
|
||||||
{
|
{
|
||||||
|
ON_HIDE = false;
|
||||||
if (timer == null) return;
|
if (timer == null) return;
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
timer.Dispose();
|
timer.Dispose();
|
||||||
@@ -295,6 +300,20 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void WaitHide(int waitTime)
|
||||||
|
{
|
||||||
|
new System.Threading.Thread(()=>
|
||||||
|
{
|
||||||
|
System.Threading.Thread.Sleep(waitTime);
|
||||||
|
//修改状态为false 继续执行贴边隐藏
|
||||||
|
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
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,8 +1,6 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -19,29 +17,11 @@ namespace GeekDesk.ViewModel
|
|||||||
private string menuId;
|
private string menuId;
|
||||||
private Visibility menuEdit = Visibility.Collapsed;
|
private Visibility menuEdit = Visibility.Collapsed;
|
||||||
private Visibility notMenuEdit = Visibility.Visible;
|
private Visibility notMenuEdit = Visibility.Visible;
|
||||||
private bool isEdit = false;
|
|
||||||
private string menuGeometry; //菜单几何图标
|
private string menuGeometry; //菜单几何图标
|
||||||
private string geometryColor; //几何图标颜色
|
private string geometryColor; //几何图标颜色
|
||||||
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[field: NonSerializedAttribute()]
|
|
||||||
private static string[] NO_WRITE_ARR = new string[] { "IsEdit"};
|
|
||||||
|
|
||||||
|
|
||||||
public bool IsEdit
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return isEdit;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
isEdit = value;
|
|
||||||
OnPropertyChanged("IsEdit");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public string MenuGeometry
|
public string MenuGeometry
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -113,12 +93,9 @@ namespace GeekDesk.ViewModel
|
|||||||
menuEdit = value;
|
menuEdit = value;
|
||||||
if (menuEdit == Visibility.Visible)
|
if (menuEdit == Visibility.Visible)
|
||||||
{
|
{
|
||||||
IsEdit = true;
|
|
||||||
NotMenuEdit = Visibility.Collapsed;
|
NotMenuEdit = Visibility.Collapsed;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
IsEdit = false;
|
|
||||||
NotMenuEdit = Visibility.Visible;
|
NotMenuEdit = Visibility.Visible;
|
||||||
}
|
}
|
||||||
OnPropertyChanged("MenuEdit");
|
OnPropertyChanged("MenuEdit");
|
||||||
@@ -151,23 +128,11 @@ namespace GeekDesk.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override String ToString()
|
|
||||||
{
|
|
||||||
return JsonConvert.SerializeObject(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
[field: NonSerializedAttribute()]
|
[field: NonSerializedAttribute()]
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
foreach (string field in NO_WRITE_ARR)
|
|
||||||
{
|
|
||||||
if (field.Equals(propertyName))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user