diff --git a/TimeControl/Lang/Lang.cs b/TimeControl/Lang/Lang.cs new file mode 100644 index 0000000..0f6c4e6 --- /dev/null +++ b/TimeControl/Lang/Lang.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.ApplicationModel.Store; + +namespace TimeControl.Lang +{ + internal static class App + { + private static LangModel[] src = + { + new LangModel(), + + new LangModel + { + Info = new LangInfo { + Contributer = "GreatHuang2007"}, + Name = new LangName{ + InternalName = "en", + DisplayName = "English"}, + TimeControl = "Computer Time Control", + planner = "Schedule Editor", + taskstart = "Start selected task", + taskend = "Mark selected as completed", + plan = "Schedule", + focus = "Focus", + startlock = "Unlock in minutes", + whitelistapps = "Path of the programs wished to use (Line by line)", + deepFocus = "Deep focus", + dfWarning = "ONCE you click the Unlock button, your device will IMMEDIATELY SHUTDOWN. And during the time you set, you computer will automatically shutdown if this program is included in Windows scheduled tasks list." + } + }; + + private static LangModel Current = src[1]; + + public static List getLangList() + { + List res = new List(); + foreach (LangModel i in src) + res.Add(i.Name); + return res; + } + + public static LangModel getCurrent() { return Current; } + + public static void setCurrent(LangModel i) { Current = i; } + } +} diff --git a/TimeControl/Lang/LangModel.cs b/TimeControl/Lang/LangModel.cs new file mode 100644 index 0000000..76083ed --- /dev/null +++ b/TimeControl/Lang/LangModel.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TimeControl.Lang +{ + internal class LangName + { + public string InternalName; + public string DisplayName; + }; + + internal class LangInfo + { + public string Contributer; + } + internal class LangModel + { + public LangInfo Info = new LangInfo + { + Contributer = "SamHou0" + }; + public LangName Name = new LangName + { + InternalName = "zh-cn", + DisplayName = "中文(简体)" + }; + public string TimeControl = "时间管理"; + public string planner = "打开日程编辑器"; + public string taskstart = "开始日程"; + public string taskend = "标记完成日程"; + public string plan = "日程计划"; + public string focus = "专注屏保"; + public string startlock = "启动屏保(分)"; + public string whitelistapps = "白名单应用路径(一行一个)"; + public string deepFocus = "深度专注"; + public string dfWarning = "启动屏保后,计算机将立刻关机,并在持续时间内开机时自动关闭。(必须设置开机启动)"; + }; +} diff --git a/TimeControl/Windows/ControlPanel.Designer.cs b/TimeControl/Windows/ControlPanel.Designer.cs index c100f09..448873f 100644 --- a/TimeControl/Windows/ControlPanel.Designer.cs +++ b/TimeControl/Windows/ControlPanel.Designer.cs @@ -35,6 +35,7 @@ private void InitializeComponent() timeBox = new System.Windows.Forms.NumericUpDown(); controlTab = new System.Windows.Forms.TabControl(); plan = new System.Windows.Forms.TabPage(); + taskStartButton = new System.Windows.Forms.Button(); endTaskButton = new System.Windows.Forms.Button(); plannerButton = new System.Windows.Forms.Button(); taskListBox = new System.Windows.Forms.ListBox(); @@ -108,7 +109,6 @@ private void InitializeComponent() ExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); processMonitorTimer = new System.Windows.Forms.Timer(components); fileSaveTimer = new System.Windows.Forms.Timer(components); - taskStartButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)timeBox).BeginInit(); controlTab.SuspendLayout(); plan.SuspendLayout(); @@ -185,6 +185,16 @@ private void InitializeComponent() plan.Text = "日程计划"; plan.UseVisualStyleBackColor = true; // + // taskStartButton + // + taskStartButton.Location = new System.Drawing.Point(411, 138); + taskStartButton.Name = "taskStartButton"; + taskStartButton.Size = new System.Drawing.Size(172, 75); + taskStartButton.TabIndex = 3; + taskStartButton.Text = "开始日程"; + taskStartButton.UseVisualStyleBackColor = true; + taskStartButton.Click += TaskStartButton_Click; + // // endTaskButton // endTaskButton.Location = new System.Drawing.Point(411, 269); @@ -231,12 +241,13 @@ private void InitializeComponent() // // label5 // - label5.AutoSize = true; - label5.Location = new System.Drawing.Point(230, 29); + label5.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + label5.Location = new System.Drawing.Point(8, 16); label5.Name = "label5"; - label5.Size = new System.Drawing.Size(164, 17); + label5.Size = new System.Drawing.Size(598, 30); label5.TabIndex = 3; label5.Text = "白名单应用路径(一行一个)"; + label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // whiteProcessBox // @@ -262,13 +273,14 @@ private void InitializeComponent() // // label9 // - label9.AutoSize = true; + label9.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; label9.ForeColor = System.Drawing.Color.Red; - label9.Location = new System.Drawing.Point(64, 126); + label9.Location = new System.Drawing.Point(3, 108); label9.Name = "label9"; - label9.Size = new System.Drawing.Size(488, 17); + label9.Size = new System.Drawing.Size(603, 35); label9.TabIndex = 3; label9.Text = "启动屏保后,计算机将立刻关机,并在持续时间内开机时自动关闭。(必须设置开机启动)"; + label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // deepTimeInput // @@ -283,6 +295,7 @@ private void InitializeComponent() // // deepStartButton // + deepStartButton.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; deepStartButton.Location = new System.Drawing.Point(229, 218); deepStartButton.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); deepStartButton.Name = "deepStartButton"; @@ -945,16 +958,6 @@ private void InitializeComponent() fileSaveTimer.Interval = 300000; fileSaveTimer.Tick += FileSaveTimer_Tick; // - // taskStartButton - // - taskStartButton.Location = new System.Drawing.Point(411, 138); - taskStartButton.Name = "taskStartButton"; - taskStartButton.Size = new System.Drawing.Size(172, 75); - taskStartButton.TabIndex = 3; - taskStartButton.Text = "开启日程"; - taskStartButton.UseVisualStyleBackColor = true; - taskStartButton.Click += TaskStartButton_Click; - // // ControlPanel // AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -976,7 +979,6 @@ private void InitializeComponent() focus.ResumeLayout(false); focus.PerformLayout(); deepFocus.ResumeLayout(false); - deepFocus.PerformLayout(); ((System.ComponentModel.ISupportInitialize)deepTimeInput).EndInit(); title.ResumeLayout(false); title.PerformLayout(); diff --git a/TimeControl/Windows/ControlPanel.cs b/TimeControl/Windows/ControlPanel.cs index 6fc2768..4ac1aa5 100644 --- a/TimeControl/Windows/ControlPanel.cs +++ b/TimeControl/Windows/ControlPanel.cs @@ -144,7 +144,8 @@ private void ReadTasks() { tasks = TCFile.ReadTasks(); } - else { tasks = null; } + else + { tasks = null; } RefreshTasks(); } @@ -352,7 +353,8 @@ private void ProcessMonitorTimer_Tick(object sender, EventArgs e) { foreach (string str in titleListBox.Items) { - if (process.MainWindowTitle.Contains(str)) process.Kill(); + if (process.MainWindowTitle.Contains(str)) + process.Kill(); } } } @@ -489,9 +491,11 @@ private bool CheckStop() { return true; } - else return false; + else + return false; } - else return true; + else + return true; } private void StopCheckBox_CheckedChanged(object sender, EventArgs e)