开始开发更新功能

This commit is contained in:
liufei
2021-07-16 17:34:16 +08:00
parent d5442540ca
commit 3a72bc6e65
16 changed files with 103 additions and 46 deletions

View File

@@ -11,4 +11,11 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="version" value="1.0 beta"/>
<add key="GitHubUrl" value="1.0 beta"/>
<add key="MYUrl" value="1.0 beta"/>
<add key="GitHubUpdateUrl" value="1.0 beta"/>
<add key="MYUpdateUrl" value="1.0 beta"/>
</appSettings>
</configuration>

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
/// </summary>
namespace GeekDesk.Constant
{
public enum DefaultConstant
public enum MainWindowEnum
{
WINDOW_WIDTH = 666, //默认窗体宽度
WINDOW_HEIGHT = 500, //默认窗体高度

View File

@@ -15,47 +15,63 @@
<hc:SimplePanel Margin="20,50,20,20">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
<TextBlock TextAlignment="Center" Text="Copyright © 2021 GeekDesk 1.0 beta"/>
<WrapPanel Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
<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="公众号" Status="抓几个娃" Margin="0,0,10,0" Color="#04913B">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image Source="/Resource/Image/公众号.jpg" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
<hc:Shield Subject="GitHub" Status="Demo-liu"
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
<hc:Shield Subject="GitHub" Status="Demo-liu"
Command="hc:ControlCommands.OpenLink"
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
Margin="0,0,10,0" Color="#24292F"/>
<hc:Shield Subject="码云" Status="Demo-liu"
<hc:Shield Subject="码云" Status="Demo-liu"
Command="hc:ControlCommands.OpenLink"
CommandParameter=""
Margin="0,5,10,0" Color="#C71D23"/>
<hc:Shield Subject="赞赏" Status="支付宝" Margin="0,5,10,0" Color="#1577FE">
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
<hc:Shield Subject="公众号" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image Source="/Resource/Image/ZFBCode.jpg" Width="150" Height="150" />
<Image x:Name="PublicWeChat" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
<hc:Shield Subject="赞赏" Status="微信" Margin="0,5,10,0" Color="#07C160">
<hc:Shield Subject="赞赏" Status="支付宝" Margin="0,0,10,0" Color="#1577FE">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image Source="/Resource/Image/WeChatCode.jpg" Width="150" Height="150" />
<Image x:Name="ZFBCode" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
</WrapPanel>
<hc:Shield Subject="赞赏" Status="微信" Margin="0,0,10,0" Color="#04913B">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image x:Name="WeChatCode" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
</hc:UniformSpacingPanel>
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
<hc:UniformSpacingPanel Spacing="10" 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 AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>
</UserControl>

View File

@@ -1,4 +1,5 @@
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,6 +13,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GeekDesk.Util;
using GeekDesk.Constant;
namespace GeekDesk.Control.UserControls.Config
{
@@ -23,6 +26,10 @@ namespace GeekDesk.Control.UserControls.Config
public AboutControl()
{
InitializeComponent();
AppInfo.Text += ConfigurationManager.AppSettings["version"];
PublicWeChat.Source = ImageUtil.Base64ToBitmapImage(Constants.PUBLIC_WE_CHAT_IMG_BASE64);
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
}
}
}

View File

@@ -161,6 +161,7 @@ namespace GeekDesk.Control.UserControls.Config
}
if (allKeyUp && !hotkeyFinished)
{
keysTemp.Clear();
hotkeyFinished = true;
if (MainWindow.hotKeyId != -1)
{

View File

@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
@@ -172,7 +173,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
string path = (string)obj;
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png);
IconInfo iconInfo = new IconInfo
{

View File

@@ -82,6 +82,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -113,7 +114,7 @@
<Compile Include="Command\DelegateCommandBase.cs" />
<Compile Include="Constant\AppHideType.cs" />
<Compile Include="Constant\Constants.cs" />
<Compile Include="Constant\DefaultConstant.cs" />
<Compile Include="Constant\MainWindowEnum.cs" />
<Compile Include="Constant\IconStartType.cs" />
<Compile Include="Constant\SortType.cs" />
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
@@ -168,6 +169,7 @@
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Task\BacklogTask.cs" />
<Compile Include="Thread\UpdateThread.cs" />
<Compile Include="Util\AeroGlassHelper.cs" />
<Compile Include="Util\CommonCode.cs" />
<Compile Include="Util\ConsoleManager.cs" />
@@ -302,9 +304,6 @@
<ItemGroup>
<Resource Include="Resource\Iconfont\iconfont.js" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\公众号.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\BacklogImg.png" />
</ItemGroup>
@@ -314,12 +313,6 @@
<ItemGroup>
<Resource Include="Resource\Image\About.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\WeChatCode.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\ZFBCode.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Taskbar.ico" />
</ItemGroup>

View File

@@ -95,7 +95,7 @@ namespace GeekDesk
}
catch (Exception)
{
HandyControl.Controls.Growl.WarningGlobal("启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!");
HandyControl.Controls.Growl.WarningGlobal("GeekDesk启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!");
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

24
Thread/UpdateThread.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Thread
{
public class UpdateThread
{
public static void Update()
{
System.Threading.Thread t = new System.Threading.Thread(new ThreadStart(updateApp));
t.IsBackground = true;
t.Start();
}
private static void updateApp()
{
}
}
}

View File

@@ -32,12 +32,11 @@ namespace GeekDesk.Util
/// <param name="callBack">回调函数</param>
public static int Regist(IntPtr windowHandle, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
{
var _hwndSource = HwndSource.FromHwnd(windowHandle);
_hwndSource.AddHook(WndProc);
HwndSource hs = HwndSource.FromHwnd(windowHandle);
hs.AddHook(WndProc);
int id = keyid++;
var vk = KeyInterop.VirtualKeyFromKey(key);
int vk = KeyInterop.VirtualKeyFromKey(key);
keymap.Add(id, callBack);
if (!RegisterHotKey(windowHandle, id, fsModifiers, (uint)vk)) throw new Exception("RegisterHotKey Failed");
return id;
@@ -46,7 +45,7 @@ namespace GeekDesk.Util
/// <summary>
/// 快捷键消息处理
/// </summary>
static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
static IntPtr WndProc(IntPtr windowHandle, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_HOTKEY)
{
@@ -64,21 +63,21 @@ namespace GeekDesk.Util
/// </summary>
/// <param name="hWnd">持有快捷键窗口的句柄</param>
/// <param name="callBack">回调函数</param>
public static void UnRegist(IntPtr hWnd, HotKeyCallBackHanlder callBack)
public static void UnRegist(IntPtr windowHandle, HotKeyCallBackHanlder callBack)
{
List<int> list = new List<int>(keymap.Keys);
for (int i=0; i < list.Count; i++)
{
if (keymap[list[i]] == callBack)
{
UnregisterHotKey(hWnd, list[i]);
HwndSource hs = HwndSource.FromHwnd(windowHandle);
hs.RemoveHook(WndProc);
UnregisterHotKey(windowHandle, list[i]);
keymap.Remove(list[i]);
}
}
}
const int WM_HOTKEY = 0x312;
static int keyid = 10;
public static Dictionary<int, HotKeyCallBackHanlder> keymap = new Dictionary<int, HotKeyCallBackHanlder>();

View File

@@ -19,9 +19,9 @@ namespace GeekDesk.ViewModel
{
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
private double windowWidth = (double)DefaultConstant.WINDOW_WIDTH; //窗口宽度
private double windowHeight = (double)DefaultConstant.WINDOW_HEIGHT; //窗口高度
private double menuCardWidth = (double)DefaultConstant.MENU_CARD_WIDHT;//菜单栏宽度
private double windowWidth = (double)MainWindowEnum.WINDOW_WIDTH; //窗口宽度
private double windowHeight = (double)MainWindowEnum.WINDOW_HEIGHT; //窗口高度
private double menuCardWidth = (double)MainWindowEnum.MENU_CARD_WIDHT;//菜单栏宽度
private int selectedMenuIndex = 0; //上次选中菜单索引
private bool followMouse = true; //面板跟随鼠标 默认是
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示

View File

@@ -20,8 +20,8 @@ namespace GeekDesk.ViewModel
private BitmapImage bitmapImage; //位图
private byte[] imageByteArr; //图片 byte数组
private string content; //显示信息
private int imageWidth = (int)DefaultConstant.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)DefaultConstant.IMAGE_HEIGHT; //图片高度
private int imageWidth = (int)MainWindowEnum.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)MainWindowEnum.IMAGE_HEIGHT; //图片高度
private bool adminStartUp = false; //始终管理员方式启动 默认否
private byte[] defaultImage; //默认图标