20210521 周五下班不带电脑了
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -12,7 +12,10 @@
|
|||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
>
|
>
|
||||||
<Border CornerRadius="8" BorderThickness="0" Background="White" Opacity="0.9">
|
<Border CornerRadius="8" BorderThickness="0">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
||||||
|
</Border.Background>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@@ -53,12 +56,13 @@
|
|||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
<hc:Card x:Name="RightCard" Grid.Row="0" Grid.Column="1" MouseDown="DragMove">
|
||||||
<hc:Card x:Name="LeftCard" Grid.Row="0" Grid.Column="1">
|
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</hc:Window>
|
</hc:Window>
|
||||||
@@ -5,6 +5,8 @@ using GeekDesk.ViewModel;
|
|||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace GeekDesk.Control
|
namespace GeekDesk.Control
|
||||||
{
|
{
|
||||||
@@ -17,9 +19,32 @@ namespace GeekDesk.Control
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = appConfig;
|
this.DataContext = appConfig;
|
||||||
LeftCard.Content = new SettingControl();
|
RightCard.Content = new SettingControl();
|
||||||
this.Topmost = true;
|
this.Topmost = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移动窗口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点击关闭按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Close_Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,24 @@
|
|||||||
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:util="clr-namespace:GeekDesk.Util"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="AliceBlue"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<hc:SimplePanel Margin="10" DataContextChanged="SimplePanel_DataContextChanged">
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<util:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<hc:SimplePanel Margin="10">
|
||||||
|
<hc:SimplePanel.Background>
|
||||||
|
<SolidColorBrush Opacity="0.9"/>
|
||||||
|
</hc:SimplePanel.Background>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板设置" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" Margin="30,22,450,119" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
@@ -34,13 +43,29 @@
|
|||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,89.49,-30,-79.49" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="30,89.49,-30,-79.49" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="40,115.004,-10,-102.337" Grid.ColumnSpan="4">
|
<hc:Divider LineStrokeDashArray="3,3" Margin="30,109,450,26.208" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="运行项目后" IsChecked="True"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="40,115,-10,-102.337" Grid.ColumnSpan="4">
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"/>
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="手动关闭"/>
|
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
||||||
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
||||||
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
Style="{StaticResource RadioButtonIcon}" Content="运行项目后"
|
||||||
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
|
||||||
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
Style="{StaticResource RadioButtonIcon}" Content="手动关闭"
|
||||||
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="30,160.5,-30,-150.5" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="40,199.5,-40,-189.5" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="图片路径:" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding BacImgName}" Width="200" VerticalAlignment="Center"/>
|
||||||
|
<Button Content="修改" Click="Button_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" Margin="30,22,450,119" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
|
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="10,242.735,-10,-91.735" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<!--<hc:Divider LineStrokeDashArray="3,3" Margin="10,242.735,-10,-91.735" LineStroke="Black" Grid.ColumnSpan="4"/>-->
|
||||||
|
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -35,5 +35,10 @@ namespace GeekDesk.Control.UserControls
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||||
<Compile Include="EditTextBlock\EditableTextBlock.cs" />
|
<Compile Include="EditTextBlock\EditableTextBlock.cs" />
|
||||||
<Compile Include="EditTextBlock\EditableTextBlockAdorner.cs" />
|
<Compile Include="EditTextBlock\EditableTextBlockAdorner.cs" />
|
||||||
|
<Compile Include="Util\HideTypeConvert.cs" />
|
||||||
<Compile Include="Util\CommonCode.cs" />
|
<Compile Include="Util\CommonCode.cs" />
|
||||||
<Compile Include="Util\ConsoleManager.cs" />
|
<Compile Include="Util\ConsoleManager.cs" />
|
||||||
<Compile Include="Util\DragAdorner.cs" />
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
OpacityMask ="White"
|
OpacityMask ="White"
|
||||||
|
Deactivated="window_Deactivated"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
|
||||||
@@ -101,15 +102,9 @@
|
|||||||
<Border CornerRadius="5" BorderThickness="0">
|
<Border CornerRadius="5" BorderThickness="0">
|
||||||
<!--背景图片-->
|
<!--背景图片-->
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<ImageBrush ImageSource="D:\壁纸\wallhaven-nrd85w.jpg" Opacity="1"></ImageBrush>
|
<ImageBrush ImageSource="{Binding AppConfig.BitmapImage}" Opacity="1"></ImageBrush>
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
<Grid>
|
<Grid>
|
||||||
<!--<Grid.Background>
|
|
||||||
<VisualBrush Stretch="Uniform" Visual="{Binding ElementName=test}"/>
|
|
||||||
</Grid.Background>-->
|
|
||||||
<!--<Grid.Background>
|
|
||||||
<SolidColorBrush Color="Black" Opacity="0.5"/>
|
|
||||||
</Grid.Background>-->
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using GeekDesk.ViewModel;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@@ -110,6 +111,8 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
string path = (string)obj;
|
string path = (string)obj;
|
||||||
|
|
||||||
|
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
|
||||||
|
|
||||||
IconInfo iconInfo = new IconInfo
|
IconInfo iconInfo = new IconInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
@@ -500,6 +503,7 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
this.Visibility = Visibility.Visible;
|
this.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
Keyboard.Focus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -577,6 +581,14 @@ namespace GeekDesk
|
|||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void window_Deactivated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
||||||
|
{
|
||||||
|
this.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
29
Util/HideTypeConvert.cs
Normal file
29
Util/HideTypeConvert.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class HideTypeConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return (AppHideType)value == (AppHideType)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
bool isChecked = (bool)value;
|
||||||
|
if (!isChecked)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (AppHideType)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,12 +28,25 @@ namespace GeekDesk.ViewModel
|
|||||||
[field: NonSerialized]
|
[field: NonSerialized]
|
||||||
private BitmapImage bitmapImage; //位图
|
private BitmapImage bitmapImage; //位图
|
||||||
private byte[] imageByteArr; //背景图片 byte数组
|
private byte[] imageByteArr; //背景图片 byte数组
|
||||||
private byte[] defaultImage; //默认背景图片
|
private string bacImgName = "系统默认";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
|
||||||
|
public string BacImgName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bacImgName;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
bacImgName = value;
|
||||||
|
OnPropertyChanged("BacImgName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] ImageByteArr
|
public byte[] ImageByteArr
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -47,28 +60,23 @@ namespace GeekDesk.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] DefaultImage
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return defaultImage;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
defaultImage = value;
|
|
||||||
OnPropertyChanged("DefaultImage");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BitmapImage BitmapImage
|
public BitmapImage BitmapImage
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return bitmapImage;
|
if (imageByteArr == null || imageByteArr.Length == 0)
|
||||||
|
{
|
||||||
|
return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return ImageUtil.ByteArrToImage(ImageByteArr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
bitmapImage = value;
|
bitmapImage = value;
|
||||||
|
imageByteArr = ImageUtil.BitmapImageToByte(bitmapImage);
|
||||||
OnPropertyChanged("BitmapImage");
|
OnPropertyChanged("BitmapImage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user