交互优化, 断网更新弹框删除,图标显示优化,待办任务bug修复

This commit is contained in:
liufei
2021-07-27 16:53:28 +08:00
parent 15a214aad0
commit 94f32fdb15
19 changed files with 916 additions and 253 deletions

View File

@@ -43,9 +43,9 @@
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
<Trigger Property="IsMouseOver" Value="True">
<!--<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFE4DBDB"/>
</Trigger>
</Trigger>-->
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" Value="#FFECECEC"/>
<Setter Property="Foreground" Value="Black"/>
@@ -84,7 +84,7 @@
SelectionChanged="menus_SelectionChanged"
>
<ListBox.Resources>
<ContextMenu x:Key="menuDialog" Width="200">
<ContextMenu x:Key="MenuDialog" Width="200">
<MenuItem Header="新建菜单" Click="CreateMenu"/>
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
@@ -94,7 +94,7 @@
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
<Setter Property="ContextMenu" Value="{StaticResource menuDialog}"/>
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.Background>
@@ -110,9 +110,6 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
<StackPanel.Background>
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
</StackPanel.Background>
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
HorizontalAlignment="Left"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"

View File

@@ -11,33 +11,21 @@
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<!--右侧栏样式动画-->
<Style x:Key="imageStyle" TargetType="Image">
<Setter Property="Width" Value="{Binding ImageWidth}"/>
<Setter Property="Height" Value="{Binding ImageHeight}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Width"/>
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Width"/>
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
</Style.Triggers>
<Style x:Key="ImageStyle" TargetType="Image">
<Setter Property="Width" Value="{Binding ImageWidth}"/>
<Setter Property="Height" Value="{Binding ImageHeight}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
</Style>
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
@@ -47,7 +35,6 @@
<!--右侧栏-->
<hc:Card AllowDrop="True"
Drop="Wrap_Drop"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,5,5" Grid.ColumnSpan="2">
@@ -58,55 +45,62 @@
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
</hc:Card.BorderBrush>
<WrapPanel Orientation="Horizontal">
<ListBox x:Name="icons" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
BorderThickness="0"
SelectionChanged="IconSelectionChanged "
VirtualizingPanel.VirtualizationMode="Recycling"
>
<ListBox.Background>
<SolidColorBrush Opacity="0"/>
</ListBox.Background>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="115" ItemsWidth="100" HorizontalAlignment="Center" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="95"
ItemsWidth="95"
Background="#00FFFFFF"
HorizontalAlignment="Center"
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Resources>
<ContextMenu x:Key="iconDialog" Width="200">
<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="MenuItem_Click" Tag="{Binding}"/>-->
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="ContextMenu" Value="{StaticResource iconDialog}"/>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding}"
MouseLeftButtonUp="IconClick"
Height="95"
Width="95"
HorizontalAlignment="Center"
Margin="5,5,5,5"
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"
MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave"
>
<Image Style="{StaticResource imageStyle}" />
<Image Style="{StaticResource ImageStyle}"/>
<TextBlock MaxWidth="80"
MaxHeight="40"
TextWrapping="Wrap"
TextTrimming="WordEllipsis"
TextAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Name}"/>
Margin="0,5,0,0"
MaxHeight="40"
TextWrapping="Wrap"
TextTrimming="WordEllipsis"
TextAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Name}"/>
</StackPanel>
</DataTemplate>

View File

@@ -18,6 +18,7 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
@@ -154,15 +155,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
/// <summary>
/// data选中事件 设置不可选中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IconSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (icons.SelectedIndex != -1) icons.SelectedIndex = -1;
}
private void Wrap_Drop(object sender, DragEventArgs e)
@@ -175,6 +167,17 @@ namespace GeekDesk.Control.UserControls.PannelCard
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
string ext = System.IO.Path.GetExtension(path).ToLower();
if (".lnk".Equals(ext))
{
string targetPath = FileUtil.GetTargetPathByLnk(path);
if (targetPath!=null)
{
path = targetPath;
}
}
IconInfo iconInfo = new IconInfo
{
Path = path,
@@ -182,6 +185,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
};
iconInfo.DefaultImage = iconInfo.ImageByteArr;
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path);
if (StringUtil.IsEmpty(iconInfo.Name))
{
iconInfo.Name = path;
}
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
}
}
@@ -214,5 +221,40 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
HandyControl.Controls.Dialog.Show(new IconInfoDialog((IconInfo)((MenuItem)sender).Tag));
}
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
{
ImgStroyBoard(sender, (int)MainWindowEnum.IMAGE_HEIGHT_AM, (int)MainWindowEnum.IMAGE_WIDTH_AM, 1);
}
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
{
ImgStroyBoard(sender, (int)MainWindowEnum.IMAGE_HEIGHT, (int)MainWindowEnum.IMAGE_WIDTH, 500);
}
private void ImgStroyBoard(object sender, int height, int width, int milliseconds)
{
StackPanel sp = sender as StackPanel;
Image img = sp.Children[0] as Image;
DoubleAnimation heightAnimation = new DoubleAnimation();
DoubleAnimation widthAnimation = new DoubleAnimation();
heightAnimation.From = img.Height;
widthAnimation.From = img.Width;
heightAnimation.To = height;
widthAnimation.To = width;
heightAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
widthAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
img.BeginAnimation(HeightProperty, heightAnimation);
img.BeginAnimation(WidthProperty, widthAnimation);
}
}
}

View File

@@ -79,8 +79,6 @@ namespace GeekDesk.Control.Windows
/// <param name="e"></param>
private void Save_Button_Click(object sender, RoutedEventArgs e)
{
if (Title.Text.Trim() == "" || ExeTime.Text.Trim() == "")
{
Growl.Warning("任务标题 和 待办时间不能为空!");
@@ -107,13 +105,12 @@ namespace GeekDesk.Control.Windows
appData.ToDoList.Add(info);
} else
{
int index =appData.ToDoList.IndexOf(info);
appData.ToDoList.Remove(info);
appData.HiToDoList.Remove(info);
info.Title = Title.Text;
info.Msg = Msg.Text;
info.ExeTime = ExeTime.Text;
info.DoneTime = DoneTime.Text;
appData.ToDoList.Insert(index, info);
appData.ToDoList.Add(info);
}
CommonCode.SaveAppData(MainWindow.appData);
this.Close();