🚑 修复可能导致输入法特定场景卡顿的问题
This commit is contained in:
@@ -47,7 +47,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
|
||||
if (!CheckIsEnable(hkType)) return;
|
||||
|
||||
|
||||
|
||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||
{
|
||||
if (hotkeyFinished)
|
||||
@@ -315,14 +315,17 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
/// <param name="e"></param>
|
||||
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (appConfig.MouseMiddleShow)
|
||||
{
|
||||
MouseHookThread.MiddleHook();
|
||||
}
|
||||
else
|
||||
{
|
||||
MouseHookThread.Dispose();
|
||||
}
|
||||
//if (appConfig.MouseMiddleShow)
|
||||
//{
|
||||
// MouseHookThread.MiddleHook();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MouseHookThread.DisposeMiddle();
|
||||
//}
|
||||
|
||||
MouseHookThread.Dispose();
|
||||
MouseHookThread.Hook();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -339,7 +342,8 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
if (true == appConfig.EnableAppHotKey)
|
||||
{
|
||||
MainWindow.RegisterHotKey(false);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||
mc:Ignorable="d"
|
||||
Background="Transparent"
|
||||
d:DesignHeight="400" d:DesignWidth="500"
|
||||
@@ -41,6 +41,20 @@
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="插件" Margin="0,20,0,0"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
||||
<CheckBox Content="时钟显秒" Click="ShowSeconds_Click" IsChecked="{Binding SecondsWindow}"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="仅Win11有效"
|
||||
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">
|
||||
@@ -93,7 +107,7 @@
|
||||
Foreground="Black"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<TextBlock Text="其它" Margin="0,25,0,0"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||
<Button Content="备份数据"
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
//using ShowSeconds;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@@ -112,5 +118,80 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
CommonCode.BakAppData();
|
||||
}
|
||||
|
||||
private void ShowSeconds_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//if (MainWindow.appData.AppConfig.SecondsWindow == true)
|
||||
//{
|
||||
// //StartSecondsWindow();
|
||||
// //SecondsWindow.ShowWindow();
|
||||
// MouseHookThread.Dispose();
|
||||
// MouseHookThread.Hook();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MouseHookThread.Dispose();
|
||||
// MouseHookThread.Hook();
|
||||
//}
|
||||
|
||||
MouseHookThread.Dispose();
|
||||
MouseHookThread.Hook();
|
||||
}
|
||||
|
||||
public static void StopSecondsWindow()
|
||||
{
|
||||
if (MessageUtil.CheckWindowIsRuning("ShowSeconds_Main_" + Constants.MY_UUID))
|
||||
{
|
||||
MessageUtil.SendMsgByWName(
|
||||
"ShowSeconds_Main_" + Constants.MY_UUID,
|
||||
"Shutdown"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//public static void StartSecondsWindow()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (var objOS = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
|
||||
// {
|
||||
// foreach (ManagementObject objMgmt in objOS.Get())
|
||||
// {
|
||||
// if (objMgmt.Properties["Caption"].Value != null)
|
||||
// {
|
||||
// string caption = objMgmt.Properties["Caption"].Value.ToString(); ;
|
||||
// LogUtil.WriteLog("获取的系统版本号为:" + caption);
|
||||
// if (caption.Contains("Windows 11"))
|
||||
// {
|
||||
// //找到ShowSeconds插件
|
||||
// FileInfo fi = FileUtil.GetFileByNameWithDir("ShowSeconds.exe", Constants.PLUGINS_PATH);
|
||||
// if (fi == null)
|
||||
// {
|
||||
// HandyControl.Controls.MessageBox.Show("未安装程序插件:ShowSeconds");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //检查是否在运行
|
||||
// if (!MessageUtil.CheckWindowIsRuning("ShowSeconds_Main_" + Constants.MY_UUID))
|
||||
// {
|
||||
// using (Process p = new Process())
|
||||
// {
|
||||
// p.StartInfo.FileName = fi.FullName;
|
||||
// p.StartInfo.WorkingDirectory = fi.FullName.Substring(0, fi.FullName.LastIndexOf("\\"));
|
||||
// p.Start();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex) { }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,13 +161,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
private void Lbi_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
try
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
|
||||
SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||
SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||
|
||||
lbi.MouseLeave -= Lbi_MouseLeave;
|
||||
lbi.Background = bac;
|
||||
lbi.Foreground = fontColor;
|
||||
}
|
||||
catch { }
|
||||
|
||||
lbi.MouseLeave -= Lbi_MouseLeave;
|
||||
lbi.Background = bac;
|
||||
lbi.Foreground = fontColor;
|
||||
}
|
||||
|
||||
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
|
||||
@@ -338,6 +343,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
}
|
||||
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
||||
//App.DoEvents();
|
||||
}
|
||||
|
||||
|
||||
@@ -420,32 +426,47 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
private void Menu_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (RunTimeStatus.IS_MENU_EDIT) return;
|
||||
|
||||
ScrollViewer scrollViewer = ScrollUtil.FindSimpleVisualChild<ScrollViewer>(MenuListBox);
|
||||
if (e.Delta < 0)
|
||||
{
|
||||
int index = MenuListBox.SelectedIndex;
|
||||
if (index < MenuListBox.Items.Count - 1)
|
||||
//判断是否到了最底部
|
||||
if (ScrollUtil.IsBootomScrollView(scrollViewer))
|
||||
{
|
||||
index ++;
|
||||
} else
|
||||
{
|
||||
index = 0;
|
||||
int index = MenuListBox.SelectedIndex;
|
||||
if (index < MenuListBox.Items.Count - 1)
|
||||
{
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
MenuListBox.SelectedIndex = index;
|
||||
}
|
||||
MenuListBox.SelectedIndex = index;
|
||||
} else if (e.Delta > 0)
|
||||
{
|
||||
int index = MenuListBox.SelectedIndex;
|
||||
if (index > 0)
|
||||
{
|
||||
index --;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = MenuListBox.Items.Count - 1;
|
||||
}
|
||||
MenuListBox.SelectedIndex = index;
|
||||
}
|
||||
else if (e.Delta > 0)
|
||||
{
|
||||
if (ScrollUtil.IsTopScrollView(scrollViewer))
|
||||
{
|
||||
int index = MenuListBox.SelectedIndex;
|
||||
if (index > 0)
|
||||
{
|
||||
index--;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = MenuListBox.Items.Count - 1;
|
||||
}
|
||||
MenuListBox.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
//滚动到选中项
|
||||
MenuListBox.ScrollIntoView(MenuListBox.SelectedItem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Menu_PreviewDragLeave(object sender, DragEventArgs e)
|
||||
{
|
||||
@@ -488,14 +509,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||
//单独设置焦点
|
||||
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||
{
|
||||
MainWindow.mainWindow.RightCard.PDDialog.menuInfo = menuInfo;
|
||||
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "设置新密码";
|
||||
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.CREATE;
|
||||
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
@@ -533,7 +555,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||
{
|
||||
AlterPW1.Visibility = Visibility.Collapsed;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
AlterPW1.Visibility = Visibility.Visible;
|
||||
}
|
||||
@@ -544,7 +567,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
MenuInfo info = lbi.DataContext as MenuInfo;
|
||||
|
||||
ItemCollection ics = lbi.ContextMenu.Items;
|
||||
ItemCollection ics = lbi.ContextMenu.Items;
|
||||
|
||||
foreach (object obj in ics)
|
||||
{
|
||||
@@ -566,7 +589,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (info.IsEncrypt)
|
||||
{
|
||||
mi.Header = "取消加密此列表";
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
mi.Header = "加密此列表";
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
|
||||
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
|
||||
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
>
|
||||
@@ -58,6 +60,25 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MyPoptipStyle" TargetType="Border">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<!--<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:Poptip">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>-->
|
||||
</Style>
|
||||
|
||||
<Storyboard x:Key="Custom1Transition1" x:Shared="False">
|
||||
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
@@ -82,11 +103,23 @@
|
||||
</Storyboard>
|
||||
|
||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||
<cvt:SearchResWidth x:Key="SearchResWidth"/>
|
||||
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
||||
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||
</UserControl.Resources>
|
||||
<!--右侧栏-->
|
||||
<Grid>
|
||||
<Popup Name="MyPoptip" FlowDirection="LeftToRight"
|
||||
PopupAnimation="None" Placement="Mouse"
|
||||
IsOpen="False"
|
||||
AllowsTransparency="True"
|
||||
>
|
||||
<Grid Background="Transparent">
|
||||
<Border Style="{StaticResource MyPoptipStyle}">
|
||||
<TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Left" Text="Test" FontSize="13"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Popup>
|
||||
|
||||
<hc:Card AllowDrop="True"
|
||||
x:Name="WrapCard"
|
||||
Visibility="Visible"
|
||||
@@ -96,6 +129,7 @@
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
|
||||
hc:Dialog.Token="RightWrapCardDialog"
|
||||
MouseWheel="IconListBox_MouseWheel"
|
||||
>
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
@@ -118,6 +152,7 @@
|
||||
IsVisibleChanged="PDDialog_IsVisibleChanged"
|
||||
Margin="0,-100,0,0"/>
|
||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
|
||||
|
||||
<WrapPanel Orientation="Horizontal"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
@@ -126,12 +161,30 @@
|
||||
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
|
||||
<ListBox x:Name="IconListBox"
|
||||
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
>
|
||||
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
ScrollViewer.CanContentScroll ="False"
|
||||
>
|
||||
<ListBox.Template>
|
||||
<ControlTemplate TargetType="ListBox">
|
||||
<hc:ScrollViewer x:Name="WrapScroll"
|
||||
Orientation="Vertical"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
IsInertiaEnabled="True"
|
||||
CanContentScroll="True"
|
||||
PreviewMouseWheel="IconListBox_MouseWheel"
|
||||
>
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
|
||||
<ItemsPresenter/>
|
||||
|
||||
</Border>
|
||||
</hc:ScrollViewer>
|
||||
</ControlTemplate>
|
||||
</ListBox.Template>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
<SolidColorBrush Color="#00FFFFFF" />
|
||||
</ListBox.Background>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@@ -140,7 +193,12 @@
|
||||
ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
|
||||
<WrapPanel />
|
||||
|
||||
<WrapPanel Background="#00FFFFFF"
|
||||
Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
|
||||
/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
@@ -166,17 +224,16 @@
|
||||
<DataTemplate>
|
||||
|
||||
<hc:SimpleStackPanel Tag="{Binding}"
|
||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
hc:Poptip.Content="{Binding Content}"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
Background="#00FFFFFF"
|
||||
MouseEnter="StackPanel_MouseEnter"
|
||||
MouseLeave="StackPanel_MouseLeave"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
>
|
||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
Background="#00FFFFFF"
|
||||
MouseEnter="MenuIcon_MouseEnter"
|
||||
MouseLeave="MenuIcon_MouseLeave"
|
||||
MouseMove="MenuIcon_MouseMove"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
>
|
||||
<!--<StackPanel Background="#00FFFFFF"
|
||||
MouseEnter="CursorPanel_MouseEnter"
|
||||
MouseLeave="CursorPanel_MouseLeave"
|
||||
@@ -202,6 +259,7 @@
|
||||
<!--</hc:TransitioningContentControl>-->
|
||||
</UniformGrid>
|
||||
</WrapPanel>
|
||||
|
||||
</Grid>
|
||||
</hc:DialogContainer>
|
||||
</hc:Card>
|
||||
@@ -228,44 +286,62 @@
|
||||
>
|
||||
<UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
|
||||
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
x:Name="SearchListBox"
|
||||
SelectionChanged="SearchListBox_SelectionChanged"
|
||||
>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
<ListBox.Template>
|
||||
<ControlTemplate TargetType="ListBox">
|
||||
<hc:ScrollViewer Orientation="Vertical"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
IsInertiaEnabled="True"
|
||||
CanContentScroll="True"
|
||||
PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
|
||||
>
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
|
||||
<ItemsPresenter/>
|
||||
</Border>
|
||||
</hc:ScrollViewer>
|
||||
</ControlTemplate>
|
||||
</ListBox.Template>
|
||||
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="IconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="IconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Background="#00FFFFFF"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Background="#00FFFFFF"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
|
||||
/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="8">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="8">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
@@ -283,16 +359,19 @@
|
||||
</Border.Style>
|
||||
<WrapPanel Tag="{Binding}"
|
||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="{Binding Content}"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
Background="#00FFFFFF"
|
||||
MouseEnter="SearchIcon_MouseEnter"
|
||||
MouseLeave="SearchIcon_MouseLeave"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
MouseMove="SearchIcon_MouseMove"
|
||||
Margin="25,10,0,10"
|
||||
>
|
||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
@@ -308,9 +387,9 @@
|
||||
Text="{Binding Name}"/>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<!--</hc:TransitioningContentControl>-->
|
||||
</UniformGrid>
|
||||
|
||||
@@ -9,6 +9,7 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -34,7 +35,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += RightCardControl_Loaded;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
|
||||
@@ -174,123 +175,130 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (Process p = new Process())
|
||||
Process p = new Process();
|
||||
//using ()
|
||||
//{
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardInput = true;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.RedirectStandardError = true;
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
|
||||
string startArg = icon.StartArg;
|
||||
|
||||
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
||||
{
|
||||
string startArg = icon.StartArg;
|
||||
|
||||
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
||||
StartSystemApp(startArg, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path;
|
||||
if (useRelativePath)
|
||||
{
|
||||
StartSystemApp(startArg, type);
|
||||
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
|
||||
path = Path.GetFullPath(fullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path;
|
||||
if (useRelativePath)
|
||||
path = icon.Path;
|
||||
}
|
||||
p.StartInfo.FileName = path;
|
||||
if (!StringUtil.IsEmpty(startArg))
|
||||
{
|
||||
p.StartInfo.Arguments = startArg;
|
||||
}
|
||||
if (icon.IconType == IconType.OTHER)
|
||||
{
|
||||
if (!File.Exists(path) && !Directory.Exists(path))
|
||||
{
|
||||
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
|
||||
path = Path.GetFullPath(fullPath);
|
||||
} else
|
||||
{
|
||||
path = icon.Path;
|
||||
}
|
||||
p.StartInfo.FileName = path;
|
||||
if (!StringUtil.IsEmpty(startArg))
|
||||
{
|
||||
p.StartInfo.Arguments = startArg;
|
||||
}
|
||||
if (icon.IconType == IconType.OTHER)
|
||||
{
|
||||
if (!File.Exists(path) && !Directory.Exists(path))
|
||||
//如果没有使用相对路径 那么使用相对路径启动一次
|
||||
if (!useRelativePath)
|
||||
{
|
||||
//如果没有使用相对路径 那么使用相对路径启动一次
|
||||
if (!useRelativePath)
|
||||
{
|
||||
StartIconApp(icon, type, true);
|
||||
return;
|
||||
} else
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||
return;
|
||||
}
|
||||
StartIconApp(icon, type, true);
|
||||
return;
|
||||
}
|
||||
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
|
||||
switch (type)
|
||||
else
|
||||
{
|
||||
case IconStartType.ADMIN_STARTUP:
|
||||
//p.StartInfo.Arguments = "1";//启动参数
|
||||
p.StartInfo.Verb = "runas";
|
||||
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
||||
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
|
||||
//p.StartInfo.ErrorDialog = false;
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
|
||||
switch (type)
|
||||
{
|
||||
case IconStartType.ADMIN_STARTUP:
|
||||
p.StartInfo.Verb = "runas";
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
if (!MarginHide.IsMargin())
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!MarginHide.IsMargin())
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
|
||||
}
|
||||
break;// c#好像不能case穿透
|
||||
case IconStartType.DEFAULT_STARTUP:
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
}
|
||||
break;// c#好像不能case穿透
|
||||
case IconStartType.DEFAULT_STARTUP:
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
if (!MarginHide.IsMargin())
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!MarginHide.IsMargin())
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IconStartType.SHOW_IN_EXPLORE:
|
||||
p.StartInfo.FileName = "Explorer.exe";
|
||||
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
if (!MarginHide.IS_HIDE)
|
||||
else
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
case IconStartType.SHOW_IN_EXPLORE:
|
||||
p.StartInfo.FileName = "Explorer.exe";
|
||||
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||
{
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
{
|
||||
if (!MarginHide.IS_HIDE)
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.Start();
|
||||
if (useRelativePath)
|
||||
{
|
||||
//如果使用相对路径启动成功 那么重新设置程序绝对路径
|
||||
icon.Path = path;
|
||||
else
|
||||
{
|
||||
MainWindow.HideApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.Start();
|
||||
p.Close();
|
||||
p.Dispose();
|
||||
if (useRelativePath)
|
||||
{
|
||||
//如果使用相对路径启动成功 那么重新设置程序绝对路径
|
||||
icon.Path = path;
|
||||
}
|
||||
}
|
||||
//}
|
||||
icon.Count++;
|
||||
|
||||
//隐藏搜索框
|
||||
@@ -453,38 +461,55 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
}
|
||||
|
||||
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||
private void MenuIcon_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = true;
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MyPoptipContent.Text = info.Content;
|
||||
MyPoptip.VerticalOffset = 30;
|
||||
Thread.Sleep(50);
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
MyPoptip.IsOpen = true;
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
double width = appData.AppConfig.ImageWidth;
|
||||
double height = appData.AppConfig.ImageHeight;
|
||||
width += width * 0.15;
|
||||
height += height * 0.15;
|
||||
Thread t = new Thread(() =>
|
||||
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
||||
}));
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
|
||||
}
|
||||
|
||||
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||
private void MenuIcon_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = false;
|
||||
MyPoptip.IsOpen = false;
|
||||
|
||||
Thread t = new Thread(() =>
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
|
||||
}));
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
|
||||
}));
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -750,7 +775,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (RunTimeStatus.LOCK_APP_PANEL)
|
||||
{
|
||||
CardLockCM.Header = "解锁主面板";
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
CardLockCM.Header = "锁定主面板";
|
||||
}
|
||||
@@ -758,6 +784,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
public void SearchListBoxIndexAdd()
|
||||
{
|
||||
//控制移动后 鼠标即使在图标上也不显示popup
|
||||
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
|
||||
MyPoptip.IsOpen = false;
|
||||
|
||||
if (SearchListBox.Items.Count > 0)
|
||||
{
|
||||
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
|
||||
@@ -769,6 +799,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
public void SearchListBoxIndexSub()
|
||||
{
|
||||
//控制移动后 鼠标即使在图标上也不显示popup
|
||||
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
|
||||
MyPoptip.IsOpen = false;
|
||||
|
||||
if (SearchListBox.Items.Count > 0)
|
||||
{
|
||||
if (SearchListBox.SelectedIndex > 0)
|
||||
@@ -818,5 +852,205 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
MainWindow.mainWindow.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单结果icon 列表鼠标滚轮预处理时间
|
||||
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
|
||||
/// 以及滚动条收尾切换菜单
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void IconListBox_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
|
||||
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
|
||||
MyPoptip.IsOpen = false;
|
||||
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
|
||||
}
|
||||
if (RunTimeStatus.MOUSE_ENTER_ICON)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MyPoptip.IsOpen = true;
|
||||
}));
|
||||
}
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
|
||||
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
|
||||
}).Start();
|
||||
}
|
||||
|
||||
//修改菜单时不切换菜单
|
||||
if (RunTimeStatus.IS_MENU_EDIT) return;
|
||||
|
||||
|
||||
//切换菜单
|
||||
System.Windows.Controls.ScrollViewer scrollViewer = sender as System.Windows.Controls.ScrollViewer;
|
||||
if (scrollViewer == null)
|
||||
{
|
||||
//在card 上获取的事件
|
||||
scrollViewer = ScrollUtil.FindSimpleVisualChild<System.Windows.Controls.ScrollViewer>(IconListBox);
|
||||
}
|
||||
if (e.Delta < 0)
|
||||
{
|
||||
int index = MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex;
|
||||
if (ScrollUtil.IsBootomScrollView(scrollViewer))
|
||||
{
|
||||
if (index < MainWindow.mainWindow.LeftCard.MenuListBox.Items.Count - 1)
|
||||
{
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex = index;
|
||||
scrollViewer.ScrollToVerticalOffset(0);
|
||||
}
|
||||
}
|
||||
else if (e.Delta > 0)
|
||||
{
|
||||
if (ScrollUtil.IsTopScrollView(scrollViewer))
|
||||
{
|
||||
int index = MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex;
|
||||
if (index > 0)
|
||||
{
|
||||
index--;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = MainWindow.mainWindow.LeftCard.MenuListBox.Items.Count - 1;
|
||||
}
|
||||
MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex = index;
|
||||
scrollViewer.ScrollToVerticalOffset(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索结果icon 列表鼠标滚轮预处理时间
|
||||
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void VerticalIconList_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
|
||||
MyPoptip.IsOpen = false;
|
||||
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
|
||||
}
|
||||
if (RunTimeStatus.MOUSE_ENTER_ICON)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MyPoptip.IsOpen = true;
|
||||
}));
|
||||
}
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
|
||||
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询结果 ICON 鼠标进入事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchIcon_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
//显示popup
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = true;
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MyPoptipContent.Text = info.Content;
|
||||
MyPoptip.VerticalOffset = 30;
|
||||
Thread.Sleep(100);
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL && RunTimeStatus.MOUSE_MOVE_COUNT > 1)
|
||||
{
|
||||
MyPoptip.IsOpen = true;
|
||||
}
|
||||
}));
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询结果ICON鼠标离开事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchIcon_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = false;
|
||||
MyPoptip.IsOpen = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询结果ICON鼠标移动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchIcon_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
//控制首次刷新搜索结果后, 鼠标首次移动后显示popup
|
||||
RunTimeStatus.MOUSE_MOVE_COUNT++;
|
||||
|
||||
//防止移动后不刷新popup content
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MyPoptipContent.Text = info.Content;
|
||||
MyPoptip.VerticalOffset = 30;
|
||||
|
||||
if (RunTimeStatus.MOUSE_MOVE_COUNT > 1 && !RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
MyPoptip.IsOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// menu结果ICON鼠标移动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MenuIcon_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
//防止移动后不刷新popup content
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MyPoptipContent.Text = info.Content;
|
||||
MyPoptip.VerticalOffset = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
Background="Black"
|
||||
PreviewMouseMove="Window_PreviewMouseMove"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
MouseRightButtonDown="Window_MouseRightButtonDown"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
>
|
||||
<Window.Resources>
|
||||
@@ -21,7 +22,7 @@
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Image x:Name="DesktopBG" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
|
||||
|
||||
<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent">
|
||||
<Canvas x:Name="ColorCanvas"
|
||||
Width="185"
|
||||
|
||||
@@ -7,10 +7,14 @@ using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Cursors = System.Windows.Input.Cursors;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
@@ -28,10 +32,18 @@ namespace GeekDesk.Control.Windows
|
||||
|
||||
private readonly ColorPicker colorPicker;
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||
private static extern bool SetProcessDPIAware();
|
||||
|
||||
public PixelColorPickerWindow(ColorPicker colorPicker)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.colorPicker = colorPicker;
|
||||
//try
|
||||
//{
|
||||
// SetProcessDPIAware();
|
||||
//}
|
||||
//catch (Exception e) { }
|
||||
ColorPickerWindow_Init();
|
||||
}
|
||||
|
||||
@@ -50,9 +62,12 @@ namespace GeekDesk.Control.Windows
|
||||
DesktopBG.Height = this.Height;
|
||||
this.Topmost = true;
|
||||
|
||||
//获取缩放比例
|
||||
double scale = ScreenUtil.GetScreenScalingFactor();
|
||||
|
||||
bgBitmap = new System.Drawing.Bitmap(
|
||||
(int)SystemParameters.VirtualScreenWidth,
|
||||
(int)SystemParameters.VirtualScreenHeight,
|
||||
(int)(Width * scale),
|
||||
(int)(Height * scale),
|
||||
System.Drawing.Imaging.PixelFormat.Format32bppArgb
|
||||
);
|
||||
|
||||
@@ -114,7 +129,7 @@ namespace GeekDesk.Control.Windows
|
||||
mi.Invoke(colorPicker, new object[] { null, null });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Window_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
SetPixelAbout(e);
|
||||
@@ -191,5 +206,16 @@ namespace GeekDesk.Control.Windows
|
||||
SetPixelAbout(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键按下
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
GlobalColorPickerWindow.ShowOrHide();
|
||||
//关闭
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace GeekDesk.Control.Windows
|
||||
InitializeComponent();
|
||||
RightCard.Content = backlog;
|
||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||
backlog.type = ToDoType.NEW;
|
||||
this.Topmost = true;
|
||||
if (backlog.BacklogList.Items.Count > 0)
|
||||
{
|
||||
@@ -68,7 +69,8 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Visible;
|
||||
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||
|
||||
Reference in New Issue
Block a user