待办任务提示,资源管理器菜单功能

This commit is contained in:
liufei
2021-07-28 10:34:37 +08:00
parent 94f32fdb15
commit 1dc77da44e
7 changed files with 1654 additions and 17 deletions

View File

@@ -17,7 +17,7 @@
<hc:SimplePanel Margin="20">
<StackPanel >
<TextBlock Text="程序设置" />
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
@@ -26,8 +26,21 @@
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,20,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<CheckBox Content="性能模式" IsChecked="{Binding PMModel}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="开启性能模式将取消图标动画效果"
hc:Poptip.Placement="TopLeft">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
hc:IconElement.Geometry="{StaticResource Gitee}"

View File

@@ -53,8 +53,8 @@
</ListBox.Background>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="95"
ItemsWidth="95"
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="110"
ItemsWidth="110"
Background="#00FFFFFF"
HorizontalAlignment="Center"
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
@@ -65,7 +65,7 @@
<ContextMenu x:Key="IconDialog" Width="200">
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
<!--<MenuItem Header="资源管理器菜单" Click="MenuItem_Click" Tag="{Binding}"/>-->
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
</ContextMenu>
@@ -80,15 +80,15 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding}"
Height="95"
Width="95"
Height="110"
Width="110"
HorizontalAlignment="Center"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseLeftButtonDown="IconClick"
MouseLeftButtonUp="IconClick"
MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave"
>

View File

@@ -203,13 +203,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Remove((IconInfo)((MenuItem)sender).Tag);
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
private void SystemContextMenu(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
psi.Arguments = "/e,/select," + icon.Path;
System.Diagnostics.Process.Start(psi);
DirectoryInfo[] folders = new DirectoryInfo[1];
folders[0] = new DirectoryInfo(icon.Path);
ShellContextMenu scm = new ShellContextMenu();
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
p.X -= 80;
p.Y -= 80;
scm.ShowContextMenu(folders, p);
}
/// <summary>
@@ -236,6 +239,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void ImgStroyBoard(object sender, int height, int width, int milliseconds)
{
if (appData.AppConfig.PMModel) return;
StackPanel sp = sender as StackPanel;
Image img = sp.Children[0] as Image;
@@ -255,6 +260,5 @@ namespace GeekDesk.Control.UserControls.PannelCard
img.BeginAnimation(HeightProperty, heightAnimation);
img.BeginAnimation(WidthProperty, widthAnimation);
}
}
}

View File

@@ -79,6 +79,8 @@ namespace GeekDesk.Control.Windows
/// <param name="e"></param>
private void Save_Button_Click(object sender, RoutedEventArgs e)
{
DateTime dt;
if (Title.Text.Trim() == "" || ExeTime.Text.Trim() == "")
{
Growl.Warning("任务标题 和 待办时间不能为空!");
@@ -87,7 +89,7 @@ namespace GeekDesk.Control.Windows
{
try
{
Convert.ToDateTime(ExeTime.Text);
dt = Convert.ToDateTime(ExeTime.Text);
} catch (Exception)
{
Growl.Warning("请输入正确的时间!");
@@ -109,9 +111,28 @@ namespace GeekDesk.Control.Windows
info.Title = Title.Text;
info.Msg = Msg.Text;
info.ExeTime = ExeTime.Text;
info.DoneTime = DoneTime.Text;
info.DoneTime = null;
appData.ToDoList.Add(info);
}
DateTime dtNow = DateTime.Now;
TimeSpan ts = dt.Subtract(dtNow);
int minutes = (int)Math.Ceiling(ts.TotalMinutes);
if (minutes < 0)
{
minutes = 0;
}
if (minutes > 60)
{
int m = minutes % 60;
int h = minutes / 60;
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
} else
{
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
}
CommonCode.SaveAppData(MainWindow.appData);
this.Close();
}

View File

@@ -170,6 +170,7 @@
<Compile Include="Util\MouseUtil.cs" />
<Compile Include="Util\MouseUtilities.cs" />
<Compile Include="Util\RegisterUtil.cs" />
<Compile Include="Util\ShellContextMenu.cs" />
<Compile Include="Util\StringUtil.cs" />
<Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="ViewModel\AppConfig.cs" />

1584
Util/ShellContextMenu.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -57,8 +57,22 @@ namespace GeekDesk.ViewModel
private bool selfStartUp = true; //开机自启动设置
private bool selfStartUped = false; //是否已设置
private bool pmModel = false; //性能模式
#region GetSet
public bool PMModel
{
get
{
return pmModel;
}
set
{
pmModel = value;
OnPropertyChanged("PMModel");
}
}
public bool SelfStartUped
{