DemoClock
BIN
README.assets/image-20230411134850372.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
README.assets/image-20230411134857271.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
README.assets/image-20230411134921770.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
README.assets/image-20230411134933108.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
README.assets/image-20230411134959369.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
README.assets/image-20230411135128676.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
README.assets/image-20230411135345438.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
README.assets/image-20230411135459116.png
Normal file
After Width: | Height: | Size: 34 KiB |
44
README.md
@ -1,2 +1,46 @@
|
||||
# VPet.Plugin.DemoClock
|
||||
给桌宠添加一个时钟显示的功能,这算是代码嵌入类型MOD的DEMO
|
||||
|
||||
![democlock](democlock.png)
|
||||
|
||||
参考本软件即可编写自己的代码MOD
|
||||
|
||||
### 功能
|
||||
|
||||
给桌宠添加一个可以显示时间的钟表
|
||||
|
||||
* 支持倒计时
|
||||
* 支持正计时
|
||||
* 支持番茄钟 (工作/休息)
|
||||
|
||||
每次使用番茄钟完成工作,还可以获得相应时间的 [金钱] 奖励
|
||||
|
||||
### 相关截图
|
||||
|
||||
菜单栏设置
|
||||
|
||||
![image-20230411135459116](README.assets/image-20230411135459116.png)
|
||||
|
||||
鼠标移近时突出显示状态
|
||||
|
||||
![image-20230411134850372](README.assets/image-20230411134850372.png)
|
||||
|
||||
待机时状态
|
||||
|
||||
![image-20230411134857271](README.assets/image-20230411134857271.png)
|
||||
|
||||
倒计时状态
|
||||
|
||||
![image-20230411135128676](README.assets/image-20230411135128676.png)
|
||||
|
||||
番茄钟:工作状态
|
||||
|
||||
![image-20230411134933108](README.assets/image-20230411134933108.png)
|
||||
|
||||
时间到
|
||||
|
||||
![image-20230411135345438](README.assets/image-20230411135345438.png)
|
||||
|
||||
游戏设置窗口
|
||||
|
||||
![image-20230411134959369](README.assets/image-20230411134959369.png)
|
||||
|
25
VPet.Plugin.DemoClock.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33213.308
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet.Plugin.DemoClock", "VPet.Plugin.DemoClock\VPet.Plugin.DemoClock.csproj", "{D23F1150-999F-4698-800C-4E60FF853A3E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D23F1150-999F-4698-800C-4E60FF853A3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D23F1150-999F-4698-800C-4E60FF853A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D23F1150-999F-4698-800C-4E60FF853A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D23F1150-999F-4698-800C-4E60FF853A3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DE04C712-253C-491A-B3F6-AC3E3C3569E9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
VPet.Plugin.DemoClock/1100_DemoClock/icon.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
2
VPet.Plugin.DemoClock/1100_DemoClock/info.lps
Normal file
@ -0,0 +1,2 @@
|
||||
vupmod#DemoClock:|author#lorisyounger:|gamever#100:|ver#100:|
|
||||
intro#给桌宠添加一个时钟显示的功能,这算是代码嵌入类型MOD的DEMO:|
|
BIN
VPet.Plugin.DemoClock/1100_DemoClock/plugin/LinePutScript.dll
Normal file
4168
VPet.Plugin.DemoClock/1100_DemoClock/plugin/LinePutScript.xml
Normal file
BIN
VPet.Plugin.DemoClock/1100_DemoClock/plugin/Panuon.WPF.UI.dll
Normal file
BIN
VPet.Plugin.DemoClock/1100_DemoClock/plugin/Panuon.WPF.dll
Normal file
1388
VPet.Plugin.DemoClock/1100_DemoClock/plugin/VPet-Simulator.Core.xml
Normal file
@ -0,0 +1,225 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>VPet-Simulator.Windows.Interface</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.IsSteamUser">
|
||||
<summary>
|
||||
是否为Steam用户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Set">
|
||||
<summary>
|
||||
游戏设置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Pets">
|
||||
<summary>
|
||||
宠物加载器列表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Core">
|
||||
<summary>
|
||||
桌宠数据核心
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Main">
|
||||
<summary>
|
||||
桌宠主要部件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.verison">
|
||||
<summary>
|
||||
版本号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Verison">
|
||||
<summary>
|
||||
版本号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.lastclicktime">
|
||||
<summary>
|
||||
上次点击时间 (Tick)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Plugins">
|
||||
<summary>
|
||||
所有三方插件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.SetZoomLevel(System.Double)">
|
||||
<summary>
|
||||
设置游戏缩放倍率
|
||||
</summary>
|
||||
<param name="zl">缩放倍率 范围0.1-10</param>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.Save">
|
||||
<summary>
|
||||
保存设置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.LoadDIY">
|
||||
<summary>
|
||||
加载DIY内容
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.RunAction(System.String)">
|
||||
<summary>
|
||||
运行动作
|
||||
</summary>
|
||||
<param name="action">动作名称</param>
|
||||
</member>
|
||||
<member name="T:VPet_Simulator.Windows.Interface.MainPlugin">
|
||||
<summary>
|
||||
这是插件的主体内容 请继承这个类
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.MainPlugin.PluginName">
|
||||
<summary>
|
||||
通过插件名称定位插件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:VPet_Simulator.Windows.Interface.MainPlugin.MW">
|
||||
<summary>
|
||||
主窗体, 主程序提供的各种功能和设置等 大部分参数和调用均在这里
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.#ctor(VPet_Simulator.Windows.Interface.IMainWindow)">
|
||||
<summary>
|
||||
MOD插件初始化
|
||||
</summary>
|
||||
<param name="mainwin">主窗体</param>
|
||||
请不要加载游戏和玩家数据,仅用作初始化
|
||||
加载数据(CORE)/游戏(SAVE),请使用 LoadPlugin
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.LoadPlugin">
|
||||
<summary>
|
||||
初始化程序+读取存档
|
||||
</summary>
|
||||
例:添加自己的Tick到 mw.Main.EventTimer
|
||||
例:创建使用UI的桌面控件
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.EndGame">
|
||||
<summary>
|
||||
游戏结束 (可以保存或清空等,不过保存有专门的Save())
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.Save">
|
||||
<summary>
|
||||
储存游戏 (可以写 Save.Other 储存设置和数据等)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.Setting">
|
||||
<summary>
|
||||
打开代码插件设置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.LoadDIY">
|
||||
<summary>
|
||||
重载DIY按钮, 如需添加自定义按钮可在此处添加
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.ZoomLevel">
|
||||
<summary>
|
||||
缩放倍率
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.IsBiggerScreen">
|
||||
<summary>
|
||||
是否为更大的屏幕
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.Diagnosis">
|
||||
<summary>
|
||||
是否启用数据收集 //TODO:判断游戏是否是原版的
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.DiagnosisInterval">
|
||||
<summary>
|
||||
数据收集频率
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.AutoSaveInterval">
|
||||
<summary>
|
||||
自动保存频率 (min)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.TopMost">
|
||||
<summary>
|
||||
是否置于顶层
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:VPet_Simulator.Windows.Interface.Setting.DiagnosisDayEnable">
|
||||
<summary>
|
||||
数据收集是否被禁止(当日)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.PressLength">
|
||||
<summary>
|
||||
按多久视为长按 单位毫秒
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.InteractionCycle">
|
||||
<summary>
|
||||
互动周期
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.LogicInterval">
|
||||
<summary>
|
||||
计算间隔
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.AllowMove">
|
||||
<summary>
|
||||
允许移动事件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.SmartMove">
|
||||
<summary>
|
||||
智能移动
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.EnableFunction">
|
||||
<summary>
|
||||
启用计算等数据功能
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.SmartMoveInterval">
|
||||
<summary>
|
||||
智能移动周期 (秒)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartUPBoot">
|
||||
<summary>
|
||||
开机启动
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartUPBootSteam">
|
||||
<summary>
|
||||
开机启动 Steam
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.PetGraph">
|
||||
<summary>
|
||||
桌宠选择内容
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartRecordLast">
|
||||
<summary>
|
||||
是否记录游戏退出位置 (默认:是)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartRecordLastPoint">
|
||||
<summary>
|
||||
记录上次退出位置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartRecordPoint">
|
||||
<summary>
|
||||
设置中桌宠启动的位置
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
43
VPet.Plugin.DemoClock/CountDownInput.xaml
Normal file
@ -0,0 +1,43 @@
|
||||
<Window x:Class="VPet.Plugin.DemoClock.CountDownInput" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" xmlns:local="clr-namespace:VPet.Plugin.DemoClock" mc:Ignorable="d" Title="倒计时时间设定" Height="150" Width="400" FontSize="18">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height=".5*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="3*" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height=".5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=".5*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width=".5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<pu:NumberInput x:Name="hh" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,0,0"
|
||||
Minimum="0" Maximum="40"/>
|
||||
<TextBlock Text="小时" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2" />
|
||||
<pu:NumberInput x:Name="mm" Grid.Row="2" Grid.Column="3" VerticalAlignment="Center" Margin="5,0,0,0" Minimum="0"
|
||||
Maximum="2400" />
|
||||
<TextBlock Text="分钟" VerticalAlignment="Center" Grid.Row="2" Grid.Column="4" />
|
||||
<pu:NumberInput x:Name="ss" Grid.Row="2" Grid.Column="5" VerticalAlignment="Center" Margin="5,0,0,0" Minimum="0"
|
||||
Maximum="2400" />
|
||||
<TextBlock Text="秒" VerticalAlignment="Center" Grid.Row="2" Grid.Column="6" Margin="0,0,10,0" />
|
||||
<TextBlock Text="请输入倒计时时间" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" VerticalAlignment="Top"
|
||||
Grid.RowSpan="2" />
|
||||
<Button pu:ButtonHelper.CornerRadius="4" Content="确定" Grid.Column="5"
|
||||
Background="{DynamicResource SecondaryLight}" VerticalAlignment="Bottom"
|
||||
Height="30" BorderBrush="{DynamicResource SecondaryDark}" BorderThickness="2" Grid.Row="2"
|
||||
Grid.ColumnSpan="2" Grid.RowSpan="3" Margin="0,0,0,10" Click="OK_Click" IsDefault="True" />
|
||||
</Grid>
|
||||
</Window>
|
42
VPet.Plugin.DemoClock/CountDownInput.xaml.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Plugin.DemoClock
|
||||
{
|
||||
/// <summary>
|
||||
/// CountDownInput.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CountDownInput : Window
|
||||
{
|
||||
public TimeSpan Return = TimeSpan.Zero;
|
||||
|
||||
public CountDownInput(TimeSpan ret)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (ret < TimeSpan.Zero)
|
||||
{
|
||||
ret = -ret;
|
||||
}
|
||||
hh.Value = Math.Min(40, (int)ret.TotalHours);
|
||||
mm.Value = ret.Minutes;
|
||||
ss.Value = ret.Seconds;
|
||||
}
|
||||
|
||||
private void OK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Return = TimeSpan.FromHours(hh.Value) + TimeSpan.FromSeconds(ss.Value) + TimeSpan.FromMinutes(mm.Value);
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
146
VPet.Plugin.DemoClock/DemoClock.cs
Normal file
@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace VPet.Plugin.DemoClock
|
||||
{
|
||||
/// <summary>
|
||||
/// Demo 时钟
|
||||
/// </summary>
|
||||
public class DemoClock : MainPlugin
|
||||
{
|
||||
|
||||
public enum Mode
|
||||
{
|
||||
/// <summary>
|
||||
/// 正常显示时间
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// 倒计时
|
||||
/// </summary>
|
||||
CountDown,
|
||||
/// <summary>
|
||||
/// 正计时
|
||||
/// </summary>
|
||||
Timing,
|
||||
/// <summary>
|
||||
/// 番茄钟:工作
|
||||
/// </summary>
|
||||
Tomato_Work,
|
||||
/// <summary>
|
||||
/// 番茄钟:休息
|
||||
/// </summary>
|
||||
Tomato_Rest,
|
||||
/// <summary>
|
||||
/// 番茄钟:长休息
|
||||
/// </summary>
|
||||
Tomato_Rest_Long,
|
||||
/// <summary>
|
||||
/// 时间到 暂停状态
|
||||
/// </summary>
|
||||
CountDown_End
|
||||
}
|
||||
/// <summary>
|
||||
/// 当前时钟模式
|
||||
/// </summary>
|
||||
public Mode mode = Mode.None;
|
||||
MenuItem menuItem;
|
||||
public TimeClock WPFTimeClock;
|
||||
public Setting Set;
|
||||
|
||||
public MenuItem mTotmatoWork;
|
||||
public MenuItem mTotmatoRest;
|
||||
public MenuItem mCountDown;
|
||||
public MenuItem mTiming;
|
||||
|
||||
public long CountDownLength;
|
||||
public DemoClock(IMainWindow mainwin) : base(mainwin)
|
||||
{
|
||||
}
|
||||
|
||||
public override void LoadPlugin()
|
||||
{
|
||||
var line = MW.Set.FindLine("DemoClock");
|
||||
if (line == null)
|
||||
{
|
||||
Set = new Setting();
|
||||
}
|
||||
else
|
||||
{
|
||||
Set = new Setting(line);
|
||||
MW.Set.Remove(line);
|
||||
}
|
||||
MW.Set.Add(Set);
|
||||
|
||||
WPFTimeClock = new TimeClock(this);
|
||||
|
||||
menuItem = new MenuItem()
|
||||
{
|
||||
Header = "DM时钟",
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center
|
||||
};
|
||||
//foreach (MenuItem mi in WPFTimeClock.CM.Items)
|
||||
// menuItem.Items.Add(mi);
|
||||
|
||||
var mi = new MenuItem()
|
||||
{
|
||||
Header = "设置",
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
||||
};
|
||||
mi.Click += (s, e) => { Setting(); };
|
||||
menuItem.Items.Add(mi);
|
||||
menuItem.Items.Add(new Separator());
|
||||
mCountDown = new MenuItem()
|
||||
{
|
||||
Header = "开始倒计时",
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
||||
};
|
||||
mCountDown.Click += WPFTimeClock.CountDownMenuItem_Click;
|
||||
menuItem.Items.Add(mCountDown);
|
||||
|
||||
mTiming = new MenuItem()
|
||||
{
|
||||
Header = "开始正计时",
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
||||
};
|
||||
mTiming.Click += WPFTimeClock.TimingMenuItem_Click;
|
||||
menuItem.Items.Add(mTiming);
|
||||
|
||||
mTotmatoWork = new MenuItem()
|
||||
{
|
||||
Header = "开始工作",
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
||||
};
|
||||
mTotmatoWork.Click += WPFTimeClock.WorkMenuItem_Click;
|
||||
menuItem.Items.Add(mTotmatoWork);
|
||||
|
||||
mTotmatoRest = new MenuItem()
|
||||
{
|
||||
Header = "开始休息",
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
||||
};
|
||||
mTotmatoRest.Click += WPFTimeClock.RestMenuItem_Click;
|
||||
menuItem.Items.Add(mTotmatoRest);
|
||||
|
||||
}
|
||||
public override void LoadDIY()
|
||||
{
|
||||
MW.Main.ToolBar.MenuDIY.Items.Add(menuItem);
|
||||
}
|
||||
|
||||
public override string PluginName => "DemoClock";
|
||||
|
||||
public override void Setting()
|
||||
{
|
||||
new winSetting(this).Show();
|
||||
}
|
||||
}
|
||||
}
|
55
VPet.Plugin.DemoClock/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("VPet.Plugin.DemoClock")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("VPet.Plugin.DemoClock")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//若要开始生成可本地化的应用程序,请设置
|
||||
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
|
||||
//例如,如果您在源文件中使用的是美国英语,
|
||||
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
|
||||
//对以下 NeutralResourceLanguage 特性的注释。 更新
|
||||
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly:ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||
//(未在页面中找到资源时使用,
|
||||
//或应用程序资源字典中找到时使用)
|
||||
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||
//(未在页面中找到资源时使用,
|
||||
//、应用程序或任何主题专用资源字典中找到时使用)
|
||||
)]
|
||||
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
62
VPet.Plugin.DemoClock/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace VPet.Plugin.DemoClock.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if ((resourceMan == null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VPet.Plugin.DemoClock.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
VPet.Plugin.DemoClock/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
VPet.Plugin.DemoClock/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace VPet.Plugin.DemoClock.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
VPet.Plugin.DemoClock/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
174
VPet.Plugin.DemoClock/Setting.cs
Normal file
@ -0,0 +1,174 @@
|
||||
using LinePutScript;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VPet.Plugin.DemoClock
|
||||
{
|
||||
public class Setting : Line
|
||||
{
|
||||
public Setting() : base("DemoClock", "")
|
||||
{
|
||||
timeshifting = 0;
|
||||
hour24 = false;
|
||||
tomato_worktime = 45;
|
||||
tomato_resttime = 15;
|
||||
tomato_resttimelong = 45;
|
||||
}
|
||||
public Setting(Line line) : base(line)
|
||||
{
|
||||
timeshifting = GetFloat("timeshifting", 0);
|
||||
hour24 = GetBool("hour24");
|
||||
tomato_worktime = GetDouble("tomato_worktime", 45);
|
||||
tomato_resttime = GetDouble("tomato_resttime", 15);
|
||||
tomato_resttimelong = GetDouble("tomato_resttimelong", 45);
|
||||
}
|
||||
double timeshifting;
|
||||
/// <summary>
|
||||
/// 时间偏移
|
||||
/// </summary>
|
||||
public double TimeShifting
|
||||
{
|
||||
get => timeshifting;
|
||||
set
|
||||
{
|
||||
timeshifting = value;
|
||||
SetFloat("timeshifting", value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否自动放置到桌宠后方
|
||||
/// </summary>
|
||||
public bool PlaceAutoBack
|
||||
{
|
||||
get => !GetBool("placeautofront");
|
||||
set => SetBool("placeautofront", !value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 放置距离设置
|
||||
/// </summary>
|
||||
public double PlaceBotton
|
||||
{
|
||||
get => GetDouble("placebotton", 100);
|
||||
set => SetDouble("placebotton", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 默认倒计时
|
||||
/// </summary>
|
||||
public double DefaultCountDown
|
||||
{
|
||||
get => GetDouble("defaultcountdown", 5);
|
||||
set => SetDouble("defaultcountdown", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 闲置透明度 (0-1.0)
|
||||
/// </summary>
|
||||
public double Opacity
|
||||
{
|
||||
get => GetDouble("opacity", 0.6);
|
||||
set => SetDouble("opacity", value);
|
||||
}
|
||||
bool hour24;
|
||||
/// <summary>
|
||||
/// 是否使用24小时制
|
||||
/// </summary>
|
||||
public bool Hour24
|
||||
{
|
||||
get => hour24;
|
||||
set
|
||||
{
|
||||
hour24 = value;
|
||||
SetBool("hour24", value);
|
||||
}
|
||||
}
|
||||
double tomato_worktime;
|
||||
/// <summary>
|
||||
/// 番茄钟工作时长
|
||||
/// </summary>
|
||||
public double Tomato_WorkTime
|
||||
{
|
||||
get => tomato_worktime;
|
||||
set
|
||||
{
|
||||
tomato_worktime = value;
|
||||
SetDouble("tomato_worktime", value);
|
||||
}
|
||||
}
|
||||
double tomato_resttime;
|
||||
/// <summary>
|
||||
/// 番茄钟休息时长
|
||||
/// </summary>
|
||||
public double Tomato_RestTime
|
||||
{
|
||||
get => tomato_resttime;
|
||||
set { tomato_resttime = value; SetDouble("tomato_resttime", value); }
|
||||
}
|
||||
public double tomato_resttimelong;
|
||||
/// <summary>
|
||||
/// 番茄钟长休息时长
|
||||
/// </summary>
|
||||
public double Tomato_RestTimeLong
|
||||
{
|
||||
get => tomato_resttimelong;
|
||||
set { SetDouble("tomato_resttimelong", value); tomato_resttimelong = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 番茄钟工作语音
|
||||
/// </summary>
|
||||
public string Tomato_WorkVoice
|
||||
{
|
||||
get => GetString("tomato_workvoice", "pack://application:,,,/Res/Work.mp3");
|
||||
set => SetString("tomato_workvoice", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 番茄钟休息语音
|
||||
/// </summary>
|
||||
public string Tomato_RestVoice
|
||||
{
|
||||
get => GetString("tomato_restvoice", "pack://application:,,,/Res/Rest.mp3");
|
||||
set => SetString("tomato_restvoice", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 番茄钟结束语音
|
||||
/// </summary>
|
||||
public string Tomato_EndVoice
|
||||
{
|
||||
get => GetString("tomato_endvoice", "pack://application:,,,/Res/End.mp3");
|
||||
set => SetString("tomato_endvoice", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 番茄钟工作语音
|
||||
/// </summary>
|
||||
public string CountDownVoice
|
||||
{
|
||||
get => GetString("countdownvoice", "pack://application:,,,/Res/CountDown.mp3");
|
||||
set => SetString("countdownvoice", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 拥有番茄数量
|
||||
/// </summary>
|
||||
public int Tomato_Count
|
||||
{
|
||||
get => GetInt("tomato_count");
|
||||
set => SetInt("tomato_count", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 拥有番茄总数量
|
||||
/// </summary>
|
||||
public int Tomato_Count_Total
|
||||
{
|
||||
get => GetInt("tomato_count_total");
|
||||
set => SetInt("tomato_count_total", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加番茄数量
|
||||
/// </summary>
|
||||
public void AddTomato(int count)
|
||||
{
|
||||
Tomato_Count += count;
|
||||
Tomato_Count_Total += count;
|
||||
}
|
||||
}
|
||||
}
|
56
VPet.Plugin.DemoClock/TimeClock.xaml
Normal file
@ -0,0 +1,56 @@
|
||||
<UserControl x:Class="VPet.Plugin.DemoClock.TimeClock" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VPet.Plugin.DemoClock"
|
||||
mc:Ignorable="d" xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" MinHeight="100" Height="Auto"
|
||||
Width="450" VerticalAlignment="Bottom" HorizontalAlignment="Center">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />
|
||||
</UserControl.Resources>
|
||||
<UserControl.ContextMenu>
|
||||
<ContextMenu x:Name="CM" x:FieldModifier="public">
|
||||
<MenuItem x:Name="CountDownMenuItem" Header="开始倒计时" Click="CountDownMenuItem_Click" />
|
||||
<MenuItem x:Name="TimingMenuItem" Header="开始正计时" Click="TimingMenuItem_Click" />
|
||||
<MenuItem x:Name="WorkMenuItem" Header="开始工作" Click="WorkMenuItem_Click" />
|
||||
<MenuItem x:Name="RestMenuItem" Header="开始休息" Click="RestMenuItem_Click" />
|
||||
<Separator />
|
||||
<MenuItem x:Name="SettingMenuItem" Header="设置" Click="SettingMenuItem_Click" />
|
||||
</ContextMenu>
|
||||
</UserControl.ContextMenu>
|
||||
<Border Background="{DynamicResource DARKPrimaryLighter}" BorderBrush="{DynamicResource DARKPrimaryDark}"
|
||||
BorderThickness="4" CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="8*" />
|
||||
<ColumnDefinition Width=".5*" />
|
||||
<ColumnDefinition Width="8*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="8*" />
|
||||
<RowDefinition Height="8*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="5" />
|
||||
</Grid.RowDefinitions>
|
||||
<ProgressBar x:Name="PBTimeLeft" Value="80" Foreground="{DynamicResource ProgressBarForeground}"
|
||||
Background="Transparent" BorderBrush="{DynamicResource ProgressBarForeground}" BorderThickness="5"
|
||||
Grid.ColumnSpan="5" Grid.RowSpan="5" Visibility="Collapsed" />
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.RowSpan="2" x:Name="TTimes" Text="96.5m" FontSize="60"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource DARKPrimaryText}" Grid.ColumnSpan="1" Grid.Column="1" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="TDayofWeek" Text="下午 星期五" FontSize="30"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource DARKPrimaryText}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="3" x:Name="TDates" Text="工作: 60.0 分钟" FontSize="25"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource DARKPrimaryText}" FontWeight="Bold" />
|
||||
<TextBlock Text="点击此处退回正常时间" Grid.Row="3" Grid.Column="1" x:Name="TOthers" FontSize="20"
|
||||
VerticalAlignment="Center" Foreground="{DynamicResource DARKPrimaryText}" Grid.ColumnSpan="3"
|
||||
HorizontalAlignment="Center" Visibility="Collapsed"
|
||||
MouseLeftButtonDown="UserControl_MouseLeftButtonDown" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
529
VPet.Plugin.DemoClock/TimeClock.xaml.cs
Normal file
@ -0,0 +1,529 @@
|
||||
using Panuon.WPF.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using static VPet.Plugin.DemoClock.DemoClock;
|
||||
using System.Timers;
|
||||
|
||||
namespace VPet.Plugin.DemoClock
|
||||
{
|
||||
/// <summary>
|
||||
/// TimeClock.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TimeClock : UserControl
|
||||
{
|
||||
DemoClock Master;
|
||||
public DispatcherTimer TimeTimer;
|
||||
public DispatcherTimer CountTimer;
|
||||
public DateTime StartTime;
|
||||
public TimeSpan PauseTime;
|
||||
public bool IsPause = false;
|
||||
Timer CloseTimer;
|
||||
|
||||
public TimeClock(DemoClock master)
|
||||
{
|
||||
InitializeComponent();
|
||||
Master = master;
|
||||
Master.MW.Main.UIGrid.Children.Insert(0, this);
|
||||
|
||||
TimeTimer = new DispatcherTimer();
|
||||
TimeTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
TimeTimer.Tick += TimeTimer_Tick;
|
||||
TimeTimer.Start();
|
||||
|
||||
CountTimer = new DispatcherTimer();
|
||||
//CountTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
CountTimer.Tick += CountTimer_Tick;
|
||||
|
||||
CloseTimer = new Timer()
|
||||
{
|
||||
Interval = 4000,
|
||||
AutoReset = false,
|
||||
Enabled = false
|
||||
};
|
||||
CloseTimer.Elapsed += CloseTimer_Elapsed;
|
||||
|
||||
Opacity = master.Set.Opacity;
|
||||
Margin = new Thickness(0, 0, 0, master.Set.PlaceBotton);
|
||||
Master.MW.Main.MouseEnter += UserControl_MouseEnter;
|
||||
Master.MW.Main.MouseLeave += UserControl_MouseLeave;
|
||||
TimeTimer_Tick();
|
||||
|
||||
}
|
||||
|
||||
private void CloseTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
Opacity = Master.Set.Opacity;
|
||||
if (Master.Set.PlaceAutoBack && Master.MW.Main.UIGrid.Children.Contains(this))
|
||||
{
|
||||
Master.MW.Main.UIGrid.Children.Remove(this);
|
||||
Master.MW.Main.UIGrid_Back.Children.Add(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
private void UserControl_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (Master.Set.PlaceAutoBack && Master.MW.Main.UIGrid_Back.Children.Contains(this))
|
||||
{
|
||||
Master.MW.Main.UIGrid_Back.Children.Remove(this);
|
||||
Master.MW.Main.UIGrid.Children.Insert(0, this);
|
||||
}
|
||||
Opacity = 0.95;
|
||||
CloseTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private void UserControl_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
CloseTimer.Start();
|
||||
}
|
||||
|
||||
bool TimeSpanChanged = false;
|
||||
private void CountTimer_Tick(object sender = null, EventArgs e = null)
|
||||
{
|
||||
if (IsPause)
|
||||
return;
|
||||
switch (Master.mode)
|
||||
{
|
||||
default:
|
||||
case Mode.None:
|
||||
CountTimer.Stop();
|
||||
break;
|
||||
case Mode.Timing:
|
||||
var diff = DateTime.Now - StartTime + PauseTime;
|
||||
if (diff.TotalMinutes > 1)
|
||||
{
|
||||
TTimes.Text = diff.ToString(@"mm\:ss");
|
||||
if (TimeSpanChanged)
|
||||
{
|
||||
CountTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
TimeSpanChanged = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
TTimes.Text = diff.ToString(@"ss\:ff");
|
||||
|
||||
if (diff.TotalMinutes < 1.5)
|
||||
{
|
||||
TDates.Text = $"计时: {diff.TotalSeconds:f1} 秒";
|
||||
}
|
||||
else if (diff.TotalHours < 1.5)
|
||||
{
|
||||
TDates.Text = $"计时: {diff.TotalMinutes:f1} 分钟";
|
||||
}
|
||||
else
|
||||
{
|
||||
TDates.Text = $"计时: {diff.Hours:f1} 小时";
|
||||
}
|
||||
break;
|
||||
case Mode.CountDown:
|
||||
diff = StartTime - DateTime.Now;
|
||||
if (diff <= TimeSpan.Zero)
|
||||
{
|
||||
TTimes.Text = "时间到";
|
||||
TDates.Text = "计时结束";
|
||||
TOthers.Text = "点击此处回到时间显示";
|
||||
TOthers.Visibility = Visibility.Visible;
|
||||
Master.mode = Mode.CountDown_End;
|
||||
CountTimer.Stop();
|
||||
return;
|
||||
}
|
||||
PBTimeLeft.Value = PBTimeLeft.Maximum - diff.TotalMinutes;
|
||||
if (diff.TotalMinutes < 1)
|
||||
{
|
||||
TTimes.Text = diff.ToString(@"ss\:ff");
|
||||
if (TimeSpanChanged)
|
||||
{
|
||||
CountTimer.Interval = TimeSpan.FromMilliseconds(10);
|
||||
TimeSpanChanged = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TTimes.Text = diff.ToString(@"mm\:ss");
|
||||
}
|
||||
if (diff.TotalMinutes < 1.5)
|
||||
{
|
||||
TDates.Text = $"剩余: {diff.TotalSeconds:f1} 秒";
|
||||
}
|
||||
else if (diff.TotalHours < 1.5)
|
||||
{
|
||||
TDates.Text = $"剩余: {diff.TotalMinutes:f1} 分钟";
|
||||
}
|
||||
else
|
||||
{
|
||||
TDates.Text = $"剩余: {diff.Hours:f1} 小时";
|
||||
}
|
||||
break;
|
||||
case Mode.Tomato_Work:
|
||||
diff = DateTime.Now - StartTime;
|
||||
var diffleft = TimeSpan.FromMinutes(Master.Set.Tomato_WorkTime) - diff;
|
||||
if (diffleft <= TimeSpan.Zero)
|
||||
{
|
||||
Master.Set.AddTomato((int)Master.Set.Tomato_WorkTime / 10);
|
||||
Master.MW.Core.Save.Money += (int)Master.Set.Tomato_WorkTime / 10;
|
||||
TTimes.Text = "时间到";
|
||||
TDates.Text = "工作结束";
|
||||
TOthers.Text = "点击此处开始休息";
|
||||
Master.mode = Mode.CountDown_End;
|
||||
CountTimer.Stop();
|
||||
return;
|
||||
}
|
||||
TTimes.Text = diff.TotalMinutes.ToString("f1") + 'm';
|
||||
PBTimeLeft.Value = diff.TotalMinutes;
|
||||
if (diffleft.TotalMinutes < 1.5)
|
||||
{
|
||||
TDates.Text = $"工作剩{diffleft.TotalSeconds:f1}秒";
|
||||
}
|
||||
else if (diffleft.TotalHours < 1.5)
|
||||
{
|
||||
TDates.Text = $"工作剩{diffleft.TotalMinutes:f1}分钟";
|
||||
}
|
||||
else
|
||||
{
|
||||
TDates.Text = $"工作剩{diffleft.Hours:f1}小时";
|
||||
}
|
||||
break;
|
||||
case Mode.Tomato_Rest:
|
||||
diff = DateTime.Now - StartTime;
|
||||
diffleft = TimeSpan.FromMinutes(Master.Set.Tomato_RestTime) - diff;
|
||||
if (diffleft <= TimeSpan.Zero)
|
||||
{
|
||||
TTimes.Text = "时间到";
|
||||
TDates.Text = "休息结束";
|
||||
TOthers.Text = "点击此处开始工作";
|
||||
Master.mode = Mode.CountDown_End;
|
||||
CountTimer.Stop();
|
||||
return;
|
||||
}
|
||||
TTimes.Text = diff.TotalMinutes.ToString("f1") + 'm';
|
||||
PBTimeLeft.Value = diff.TotalMinutes;
|
||||
|
||||
if (diffleft.TotalMinutes < 1.5)
|
||||
{
|
||||
TDates.Text = $"休息剩{diffleft.TotalSeconds:f1}秒";
|
||||
}
|
||||
else if (diffleft.TotalHours < 1.5)
|
||||
{
|
||||
TDates.Text = $"休息剩{diffleft.TotalMinutes:f1}分钟";
|
||||
}
|
||||
else
|
||||
{
|
||||
TDates.Text = $"休息剩{diffleft.Hours:f1}小时";
|
||||
}
|
||||
break;
|
||||
case Mode.Tomato_Rest_Long:
|
||||
diff = DateTime.Now - StartTime;
|
||||
diffleft = TimeSpan.FromMinutes(Master.Set.Tomato_RestTimeLong) - diff;
|
||||
if (diffleft <= TimeSpan.Zero)
|
||||
{
|
||||
TTimes.Text = "时间到";
|
||||
TDates.Text = "长休息结束";
|
||||
TOthers.Text = "点击此处开始工作";
|
||||
Master.mode = Mode.CountDown_End;
|
||||
CountTimer.Stop();
|
||||
return;
|
||||
}
|
||||
TTimes.Text = diff.TotalMinutes.ToString("f1") + 'm';
|
||||
PBTimeLeft.Value = diff.TotalMinutes;
|
||||
|
||||
if (diffleft.TotalMinutes < 1.5)
|
||||
{
|
||||
TDates.Text = $"休息剩{diffleft.TotalSeconds:f1}秒";
|
||||
}
|
||||
else if (diffleft.TotalHours < 1.5)
|
||||
{
|
||||
TDates.Text = $"休息剩{diffleft.TotalMinutes:f1}分钟";
|
||||
}
|
||||
else
|
||||
{
|
||||
TDates.Text = $"休息剩{diffleft.Hours:f1}小时";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void StartTiming()
|
||||
{
|
||||
StartTime = DateTime.Now;
|
||||
TimeSpanChanged = true;
|
||||
TOthers.Visibility = Visibility.Collapsed;
|
||||
IsPause = false;
|
||||
PauseTime = TimeSpan.Zero;
|
||||
CountTimer.Interval = TimeSpan.FromMilliseconds(10);
|
||||
CountTimer.Start();
|
||||
Master.mode = Mode.Timing;
|
||||
}
|
||||
public void PauseTiming()
|
||||
{
|
||||
IsPause = true;
|
||||
CountTimer.IsEnabled = false;
|
||||
PauseTime += DateTime.Now - StartTime;
|
||||
TDates.Text = "计时暂停" + TDates.Text.Substring(3);
|
||||
}
|
||||
public void ContinueTiming()
|
||||
{
|
||||
StartTime = DateTime.Now;
|
||||
IsPause = false;
|
||||
CountTimer.Start();
|
||||
CountTimer_Tick();
|
||||
}
|
||||
public void StartCountDown(TimeSpan time)
|
||||
{
|
||||
Master.mode = Mode.CountDown;
|
||||
StartTime = DateTime.Now + time;
|
||||
TimeSpanChanged = true;
|
||||
IsPause = false;
|
||||
TOthers.Visibility = Visibility.Collapsed;
|
||||
PauseTime = TimeSpan.Zero;
|
||||
PBTimeLeft.Value = 0;
|
||||
PBTimeLeft.Maximum = time.TotalMinutes;
|
||||
PBTimeLeft.Visibility = Visibility.Visible;
|
||||
CountTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
CountTimer.Start();
|
||||
}
|
||||
public void ContinueCountDown()
|
||||
{
|
||||
StartTime = DateTime.Now + PauseTime;
|
||||
IsPause = false;
|
||||
CountTimer.Start();
|
||||
CountTimer_Tick();
|
||||
}
|
||||
public void PauseCountDown()
|
||||
{
|
||||
IsPause = true;
|
||||
CountTimer.IsEnabled = false;
|
||||
PauseTime = StartTime - DateTime.Now;
|
||||
}
|
||||
public void StartWork()
|
||||
{
|
||||
Master.mode = Mode.Tomato_Work;
|
||||
StartTime = DateTime.Now;
|
||||
IsPause = false;
|
||||
TOthers.Visibility = Visibility.Visible;
|
||||
TOthers.Text = $"番茄点数 {Master.Set.Tomato_Count} 累计点数 {Master.Set.Tomato_Count_Total}";
|
||||
PauseTime = TimeSpan.Zero;
|
||||
PBTimeLeft.Value = 0;
|
||||
PBTimeLeft.Visibility = Visibility.Visible;
|
||||
PBTimeLeft.Maximum = Master.Set.Tomato_WorkTime;
|
||||
CountTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
CountTimer.Start();
|
||||
}
|
||||
public void StartRest()
|
||||
{
|
||||
Master.mode = Mode.Tomato_Rest;
|
||||
StartTime = DateTime.Now;
|
||||
IsPause = false;
|
||||
TOthers.Visibility = Visibility.Visible;
|
||||
TOthers.Text = $"番茄点数 {Master.Set.Tomato_Count} 累计点数 {Master.Set.Tomato_Count_Total}";
|
||||
PauseTime = TimeSpan.Zero;
|
||||
PBTimeLeft.Value = 0;
|
||||
PBTimeLeft.Visibility = Visibility.Visible;
|
||||
PBTimeLeft.Maximum = Master.Set.Tomato_RestTime;
|
||||
CountTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
CountTimer.Start();
|
||||
}
|
||||
public void StartRestLong()
|
||||
{
|
||||
Master.mode = Mode.Tomato_Rest_Long;
|
||||
StartTime = DateTime.Now;
|
||||
IsPause = false;
|
||||
TOthers.Visibility = Visibility.Visible;
|
||||
TOthers.Text = $"番茄点数 {Master.Set.Tomato_Count} 累计点数 {Master.Set.Tomato_Count_Total}";
|
||||
PauseTime = TimeSpan.Zero;
|
||||
PBTimeLeft.Value = 0;
|
||||
PBTimeLeft.Visibility = Visibility.Visible;
|
||||
PBTimeLeft.Maximum = Master.Set.Tomato_RestTimeLong;
|
||||
CountTimer.Interval = TimeSpan.FromSeconds(1);
|
||||
CountTimer.Start();
|
||||
}
|
||||
|
||||
private void TimeTimer_Tick(object sender = null, EventArgs e = null)
|
||||
{
|
||||
//相关UI更新
|
||||
if (Master.mode == Mode.None)
|
||||
{
|
||||
if (Master.Set.Hour24)
|
||||
{
|
||||
TTimes.Text = DateTime.Now.ToString("HH:mm");
|
||||
}
|
||||
else
|
||||
{
|
||||
TTimes.Text = DateTime.Now.ToString("hh:mm");
|
||||
}
|
||||
TDayofWeek.Text = DateTime.Now.ToString("tt dddd");
|
||||
TDates.Text = DateTime.Now.ToString("yyyy/MM/dd");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Master.Set.Hour24)
|
||||
{
|
||||
TDayofWeek.Text = DateTime.Now.ToString("tt HH:mm");
|
||||
}
|
||||
else
|
||||
{
|
||||
TDayofWeek.Text = DateTime.Now.ToString("tt hh:mm");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CountDownMenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Master.mode == Mode.CountDown)
|
||||
{
|
||||
if (IsPause)
|
||||
{
|
||||
ContinueCountDown();
|
||||
CountDownMenuItem.Header = "暂停倒计时";
|
||||
Master.mCountDown.Header = "暂停倒计时";
|
||||
}
|
||||
else
|
||||
{
|
||||
PauseCountDown();
|
||||
CountDownMenuItem.Header = "继续倒计时";
|
||||
Master.mCountDown.Header = "继续倒计时";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CountDownInput input = new CountDownInput(TimeSpan.FromMinutes(Master.Set.DefaultCountDown));
|
||||
if (input.ShowDialog() == true && input.Return != TimeSpan.Zero)
|
||||
{
|
||||
StartCountDown(input.Return);
|
||||
CountDownMenuItem.Header = "暂停倒计时";
|
||||
Master.mCountDown.Header = "暂停倒计时";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingMenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Master.Setting();
|
||||
}
|
||||
|
||||
public void TimingMenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Master.mode == Mode.Timing)
|
||||
{
|
||||
if (IsPause)
|
||||
{
|
||||
ContinueTiming();
|
||||
TimingMenuItem.Header = "暂停计时";
|
||||
Master.mTiming.Header = "暂停计时";
|
||||
}
|
||||
else
|
||||
{
|
||||
PauseTiming();
|
||||
TimingMenuItem.Header = "继续计时";
|
||||
Master.mTiming.Header = "继续计时";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StartTiming();
|
||||
TimingMenuItem.Header = "暂停计时";
|
||||
Master.mTiming.Header = "暂停计时";
|
||||
}
|
||||
}
|
||||
|
||||
public void WorkMenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Master.mode == Mode.Tomato_Work)
|
||||
{
|
||||
if (MessageBoxX.Show("是否停止当前工作?", "停止工作", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
Master.mode = Mode.None;
|
||||
CountTimer.IsEnabled = false;
|
||||
TOthers.Visibility = Visibility.Collapsed;
|
||||
PBTimeLeft.Visibility = Visibility.Collapsed;
|
||||
WorkMenuItem.Header = "开始工作";
|
||||
Master.mTotmatoWork.Header = "开始工作";
|
||||
}
|
||||
}
|
||||
else if (Master.mode == Mode.Tomato_Rest)
|
||||
{
|
||||
if (MessageBoxX.Show("是否停止当前休息?", "停止休息", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
Master.mode = Mode.None;
|
||||
CountTimer.IsEnabled = false;
|
||||
TOthers.Visibility = Visibility.Collapsed;
|
||||
PBTimeLeft.Visibility = Visibility.Collapsed;
|
||||
WorkMenuItem.Header = "开始工作";
|
||||
Master.mTotmatoWork.Header = "开始工作";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StartWork();
|
||||
WorkMenuItem.Header = "停止工作";
|
||||
Master.mTotmatoWork.Header = "停止工作";
|
||||
}
|
||||
}
|
||||
|
||||
public void RestMenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Master.mode == Mode.Tomato_Rest || Master.mode == Mode.Tomato_Rest_Long)
|
||||
{
|
||||
if (MessageBoxX.Show("是否停止当前休息?\n扣除的番茄不会被退还", "停止休息", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
Master.mode = Mode.None;
|
||||
CountTimer.IsEnabled = false;
|
||||
TOthers.Visibility = Visibility.Collapsed;
|
||||
PBTimeLeft.Visibility = Visibility.Collapsed;
|
||||
WorkMenuItem.Header = "开始休息";
|
||||
Master.mTotmatoWork.Header = "开始休息";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int need = (int)Math.Round(Master.Set.Tomato_RestTimeLong / 2);
|
||||
if (Master.Set.Tomato_Count <= Master.Set.Tomato_RestTimeLong / 2 && MessageBoxResult.Yes ==
|
||||
MessageBoxX.Show($"是否开始休息?\n休息所需番茄 {need}\n当前拥有番茄 {Master.Set.Tomato_Count}", "开始休息", MessageBoxButton.YesNo))
|
||||
{
|
||||
Master.Set.Tomato_Count -= need;
|
||||
StartRestLong();
|
||||
WorkMenuItem.Header = "停止休息";
|
||||
Master.mTotmatoWork.Header = "停止休息";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxX.Show($"当前番茄不足,不能开始长休息\n休息所需番茄 {need}\n当前拥有番茄 {Master.Set.Tomato_Count}", "休息失败,请好好工作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
switch (TDates.Text)
|
||||
{
|
||||
case "计时结束":
|
||||
Master.mode = Mode.None;
|
||||
CountTimer.IsEnabled = false;
|
||||
TOthers.Visibility = Visibility.Collapsed;
|
||||
PBTimeLeft.Visibility = Visibility.Collapsed;
|
||||
CountDownMenuItem.Header = "开始倒计时";
|
||||
Master.mCountDown.Header = "开始倒计时";
|
||||
break;
|
||||
case "工作结束":
|
||||
StartRest();
|
||||
break;
|
||||
case "休息结束":
|
||||
case "长休息结束":
|
||||
StartWork();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
115
VPet.Plugin.DemoClock/VPet.Plugin.DemoClock.csproj
Normal file
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D23F1150-999F-4698-800C-4E60FF853A3E}</ProjectGuid>
|
||||
<OutputType>library</OutputType>
|
||||
<RootNamespace>VPet.Plugin.DemoClock</RootNamespace>
|
||||
<AssemblyName>VPet.Plugin.DemoClock</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\LinePutScript.1.6.1\lib\net462\LinePutScript.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Panuon.WPF.UI, Version=1.1.8.5, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.UI.1.1.8.5\lib\net462\Panuon.WPF.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Core.0.1.1\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.0.1.2\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CountDownInput.xaml.cs">
|
||||
<DependentUpon>CountDownInput.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DemoClock.cs" />
|
||||
<Compile Include="Setting.cs" />
|
||||
<Compile Include="winSetting.xaml.cs">
|
||||
<DependentUpon>winSetting.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TimeClock.xaml.cs">
|
||||
<DependentUpon>TimeClock.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="CountDownInput.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="winSetting.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="TimeClock.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
8
VPet.Plugin.DemoClock/packages.config
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="LinePutScript" version="1.6.1" targetFramework="net462" />
|
||||
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
|
||||
<package id="Panuon.WPF.UI" version="1.1.8.5" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="0.1.1" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="0.1.2" targetFramework="net462" />
|
||||
</packages>
|
153
VPet.Plugin.DemoClock/winSetting.xaml
Normal file
@ -0,0 +1,153 @@
|
||||
<Window x:Class="VPet.Plugin.DemoClock.winSetting" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:VPet.Plugin.DemoClock" mc:Ignorable="d"
|
||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Title="Demo Clock 设置" Width="450" FontSize="16"
|
||||
Height="Auto" ResizeMode="NoResize" WindowState="Normal" SizeToContent="Height"
|
||||
Background="{DynamicResource PrimaryLighter}">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />
|
||||
</Window.Resources>
|
||||
<TabControl Background="{DynamicResource PrimaryLight}"
|
||||
pu:TabControlHelper.HeaderPanelBackground="{DynamicResource PrimaryLighter}"
|
||||
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryLight}">
|
||||
<TabItem Header="基本时间设置">
|
||||
<Grid Margin="8" Background="{DynamicResource PrimaryLighter}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="24小时制" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="时钟位置" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="2" Text="闲置透明度" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="3" Text="显示层次" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="4" Text="时间偏移" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="5" Text="默认倒计时" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="6" Text="倒计时语音" VerticalAlignment="Center" />
|
||||
|
||||
<pu:Switch x:Name="Switch24h" BorderBrush="{DynamicResource DARKPrimaryDark}"
|
||||
CheckedBackground="{DynamicResource DARKPrimary}"
|
||||
CheckedBorderBrush="{DynamicResource DARKPrimary}" Background="Transparent" BoxWidth="35"
|
||||
BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
|
||||
ToggleBrush="{DynamicResource DARKPrimaryDark}" Content="显示时间时启用24小时制"
|
||||
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Grid.Column="2"
|
||||
Checked="Switch24h_Checked" Unchecked="Switch24h_Checked" />
|
||||
<pu:NumberInput Grid.Row="1" Grid.Column="3" Minimum="0" MaxHeight="350" Margin="5"
|
||||
Value="{Binding ElementName=PlaceSilder, Path=Value}" CornerRadius="3" />
|
||||
<Slider Grid.Row="1" Grid.Column="2" x:Name="PlaceSilder" Minimum="0" Maximum="350" Value="100"
|
||||
VerticalAlignment="Center" Background="{DynamicResource DARKPrimaryLighter}"
|
||||
pu:SliderHelper.CoveredBackground="{DynamicResource DARKPrimaryDarker}"
|
||||
ValueChanged="PlaceSilder_ValueChanged" />
|
||||
<pu:NumberInput Grid.Row="2" Grid.Column="3" Minimum="0.1" MaxHeight="94" Margin="5"
|
||||
Value="{Binding ElementName=OpacitySilder, Path=Value}" CornerRadius="3" />
|
||||
<Slider Grid.Row="2" Grid.Column="2" x:Name="OpacitySilder" Minimum="0.1" Maximum="94" Value="60"
|
||||
VerticalAlignment="Center" Background="{DynamicResource DARKPrimaryLighter}"
|
||||
pu:SliderHelper.CoveredBackground="{DynamicResource DARKPrimaryDarker}"
|
||||
ValueChanged="OpacitySilder_ValueChanged" />
|
||||
<pu:Switch x:Name="SwitchAutoLayer" BorderBrush="{DynamicResource DARKPrimaryDark}"
|
||||
CheckedBackground="{DynamicResource DARKPrimary}" IsChecked="True"
|
||||
CheckedBorderBrush="{DynamicResource DARKPrimary}" Background="Transparent" BoxWidth="35"
|
||||
BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
|
||||
ToggleBrush="{DynamicResource DARKPrimaryDark}" Content="闲置时置于桌宠后方"
|
||||
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Grid.Column="2" Grid.Row="3"
|
||||
Checked="SwitchAutoLayer_Checked" Unchecked="SwitchAutoLayer_Checked" />
|
||||
<pu:NumberInput x:Name="NumTimeDiff" Minimum="-2400" Maximum="2400" Margin="5,5,5,5" Value="0"
|
||||
CornerRadius="3" Grid.Row="4" Grid.Column="2" ValueChanged="NumTimeDiff_ValueChanged" />
|
||||
<TextBlock Text="分钟" VerticalAlignment="Center" Margin="5,0,0,0" Grid.Row="4" Grid.Column="3" />
|
||||
<pu:NumberInput x:Name="NumDefCountDown" Minimum="0" Maximum="2400" Margin="5,5,5,5" Value="5"
|
||||
CornerRadius="3" Grid.Row="5" Grid.Column="2" ValueChanged="NumDefCountDown_ValueChanged" />
|
||||
<TextBlock Text="分钟" VerticalAlignment="Center" Margin="5,0,0,0" Grid.Row="5" Grid.Column="3" />
|
||||
<TextBox x:Name="TextCountDown" Grid.Row="6" Grid.Column="2"
|
||||
Style="{DynamicResource StandardTextBoxStyle}" FontSize="16" Margin="5"
|
||||
Text="pack://application:,,,/Res/CountDown.mp3" TextChanged="TextCountDown_TextChanged"
|
||||
IsEnabled="False" />
|
||||
<Button pu:ButtonHelper.CornerRadius="4" Content="选择位置" Grid.Column="3" Tag="CountDown"
|
||||
Background="{DynamicResource SecondaryLight}" HorizontalAlignment="Center" IsEnabled="False"
|
||||
VerticalAlignment="Center" Height="30" BorderBrush="{DynamicResource SecondaryDark}"
|
||||
BorderThickness="2" Grid.Row="6" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="番茄钟相关设置">
|
||||
<Grid Margin="8" Background="{DynamicResource PrimaryLighter}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="工作时长" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="休息时长" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="2" Text="长休息时长" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="3" Text="工作语音" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="4" Text="休息语音" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="5" Text="结束语音" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="6" Text="语音预设" VerticalAlignment="Center" />
|
||||
|
||||
<TextBlock Text="分钟" VerticalAlignment="Center" Grid.Column="3" HorizontalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="分钟" VerticalAlignment="Center" Grid.Column="3"
|
||||
HorizontalAlignment="Center" />
|
||||
<TextBlock Grid.Row="2" Text="分钟" VerticalAlignment="Center" Grid.Column="3"
|
||||
HorizontalAlignment="Center" />
|
||||
<Button pu:ButtonHelper.CornerRadius="4" Content="选择位置" Grid.Column="3" Tag="TomatoWork"
|
||||
IsEnabled="False" Background="{DynamicResource SecondaryLight}" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Height="30" BorderBrush="{DynamicResource SecondaryDark}"
|
||||
BorderThickness="2" Grid.Row="3" Click="btn_path_Click" />
|
||||
<Button pu:ButtonHelper.CornerRadius="4" Content="选择位置" Grid.Column="3" Tag="TomatoRest"
|
||||
Background="{DynamicResource SecondaryLight}" HorizontalAlignment="Center" IsEnabled="False"
|
||||
VerticalAlignment="Center" Height="30" BorderBrush="{DynamicResource SecondaryDark}"
|
||||
BorderThickness="2" Grid.Row="4" />
|
||||
<Button pu:ButtonHelper.CornerRadius="4" Content="选择位置" Grid.Column="3" Tag="TomatoEnd"
|
||||
Background="{DynamicResource SecondaryLight}" HorizontalAlignment="Center" IsEnabled="False"
|
||||
VerticalAlignment="Center" Height="30" BorderBrush="{DynamicResource SecondaryDark}"
|
||||
BorderThickness="2" Grid.Row="5" />
|
||||
|
||||
<pu:NumberInput x:Name="NumTomatoWork" Minimum="5" Maximum="480" Margin="5" Value="45"
|
||||
CornerRadius="3" Grid.Column="2" ValueChanged="NumTomatoWork_ValueChanged" />
|
||||
<pu:NumberInput x:Name="NumTomatoRest" Minimum="5" Maximum="480" Margin="5" Value="15"
|
||||
CornerRadius="3" Grid.Column="2" Grid.Row="1" ValueChanged="NumTomatoRest_ValueChanged" />
|
||||
<pu:NumberInput x:Name="NumTomatoRestLong" Minimum="5" Maximum="480" Margin="5" Value="45"
|
||||
CornerRadius="3" Grid.Column="2" Grid.Row="2" ValueChanged="NumTomatoRestLong_ValueChanged" />
|
||||
<TextBox x:Name="TextTomatoWork" Grid.Row="3" Grid.Column="2"
|
||||
Style="{DynamicResource StandardTextBoxStyle}" FontSize="16" IsEnabled="False" Margin="5"
|
||||
Text="pack://application:,,,/Res/Work.mp3" TextChanged="TextTomatoWork_TextChanged" />
|
||||
<TextBox x:Name="TextTomatoRest" Grid.Row="4" Grid.Column="2"
|
||||
Style="{DynamicResource StandardTextBoxStyle}" FontSize="16" Margin="5"
|
||||
Text="pack://application:,,,/Res/Rest.mp3" TextChanged="TextTomatoRest_TextChanged"
|
||||
IsEnabled="False" />
|
||||
<TextBox x:Name="TextTomatoEnd" Grid.Row="5" Grid.Column="2"
|
||||
Style="{DynamicResource StandardTextBoxStyle}" FontSize="16" Margin="5"
|
||||
Text="pack://application:,,,/Res/End.mp3" TextChanged="TextTomatoEnd_TextChanged"
|
||||
IsEnabled="False" />
|
||||
|
||||
<ComboBox x:Name="PetBox" Grid.Column="2" Style="{DynamicResource StandardComboBoxStyle}" Margin="5"
|
||||
FontSize="16" Grid.Row="6" Grid.ColumnSpan="2" IsEnabled="False">
|
||||
<ComboBoxItem>默认系统声音 - Win10</ComboBoxItem>
|
||||
<ComboBoxItem>少女 - NyaSwarm</ComboBoxItem>
|
||||
<ComboBoxItem>秘书 - 杨远</ComboBoxItem>
|
||||
<ComboBoxItem>萝莉 - 喵霸霸</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Window>
|
173
VPet.Plugin.DemoClock/winSetting.xaml.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Plugin.DemoClock
|
||||
{
|
||||
/// <summary>
|
||||
/// winSetting.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class winSetting : Window
|
||||
{
|
||||
private bool AllowChange = false;
|
||||
DemoClock Master;
|
||||
Setting Set;
|
||||
public winSetting(DemoClock master)
|
||||
{
|
||||
InitializeComponent();
|
||||
Master = master;
|
||||
Set = Master.Set;
|
||||
Switch24h.IsChecked = Set.Hour24;
|
||||
PlaceSilder.Value = Set.PlaceBotton;
|
||||
OpacitySilder.Value = Set.Opacity * 100;
|
||||
SwitchAutoLayer.IsChecked = Set.PlaceAutoBack;
|
||||
NumTimeDiff.Value = Set.TimeShifting;
|
||||
NumDefCountDown.Value = Set.DefaultCountDown;
|
||||
NumTomatoWork.Value = Set.Tomato_WorkTime;
|
||||
NumTomatoRest.Value = Set.Tomato_RestTime;
|
||||
NumTomatoRestLong.Value = Set.Tomato_RestTimeLong;
|
||||
TextCountDown.Text = Set.CountDownVoice;
|
||||
TextTomatoWork.Text = Set.Tomato_WorkVoice;
|
||||
TextTomatoRest.Text = Set.Tomato_RestVoice;
|
||||
TextTomatoEnd.Text = Set.Tomato_EndVoice;
|
||||
|
||||
AllowChange = true;
|
||||
}
|
||||
|
||||
private void Switch24h_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Hour24 = Switch24h.IsChecked.Value;
|
||||
}
|
||||
|
||||
private void PlaceSilder_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.PlaceBotton = PlaceSilder.Value;
|
||||
Master.WPFTimeClock.Margin = new Thickness(0, 0, 0, Set.PlaceBotton);
|
||||
}
|
||||
|
||||
private void OpacitySilder_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Opacity = OpacitySilder.Value / 100;
|
||||
if(Master.WPFTimeClock.Opacity != 0.95)
|
||||
Master.WPFTimeClock.Opacity = Set.Opacity;
|
||||
}
|
||||
|
||||
private void SwitchAutoLayer_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.PlaceAutoBack = SwitchAutoLayer.IsChecked.Value;
|
||||
if (Master.Set.PlaceAutoBack && Master.MW.Main.UIGrid_Back.Children.Contains(Master.WPFTimeClock))
|
||||
{
|
||||
Master.MW.Main.UIGrid_Back.Children.Remove(Master.WPFTimeClock);
|
||||
Master.MW.Main.UIGrid.Children.Insert(0, Master.WPFTimeClock);
|
||||
}
|
||||
}
|
||||
|
||||
private void NumTimeDiff_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.TimeShifting = NumTimeDiff.Value;
|
||||
}
|
||||
|
||||
private void NumDefCountDown_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.DefaultCountDown = NumDefCountDown.Value;
|
||||
}
|
||||
|
||||
private void TextCountDown_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.CountDownVoice = TextCountDown.Text;
|
||||
}
|
||||
|
||||
private void NumTomatoWork_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Tomato_WorkTime = NumTomatoWork.Value;
|
||||
}
|
||||
|
||||
private void NumTomatoRest_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Tomato_RestTime = NumTomatoRest.Value;
|
||||
}
|
||||
|
||||
private void NumTomatoRestLong_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double> e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Tomato_RestTimeLong = NumTomatoRestLong.Value;
|
||||
}
|
||||
private void TextTomatoWork_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Tomato_WorkVoice = TextTomatoWork.Text;
|
||||
}
|
||||
|
||||
private void TextTomatoRest_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Tomato_RestVoice = TextTomatoRest.Text;
|
||||
}
|
||||
|
||||
private void TextTomatoEnd_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!AllowChange)
|
||||
return;
|
||||
Set.Tomato_EndVoice = TextTomatoEnd.Text;
|
||||
}
|
||||
|
||||
private void btn_path_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "音频文件|*.wav;*.mp3";
|
||||
|
||||
if (openFileDialog.ShowDialog() != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Button button = sender as Button;
|
||||
switch (button.Tag)
|
||||
{
|
||||
case "CountDown":
|
||||
TextCountDown.Text = openFileDialog.FileName;
|
||||
break;
|
||||
case "TomatoWork":
|
||||
TextTomatoWork.Text = openFileDialog.FileName;
|
||||
break;
|
||||
case "TomatoRest":
|
||||
TextTomatoRest.Text = openFileDialog.FileName;
|
||||
break;
|
||||
case "TomatoEnd":
|
||||
TextTomatoEnd.Text = openFileDialog.FileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
democlock.aseprite
Normal file
BIN
democlock.png
Normal file
After Width: | Height: | Size: 2.1 KiB |