Skip to content

Commit 95fe3a4

Browse files
committed
1.1.7测试版更新
1 parent a142557 commit 95fe3a4

8 files changed

Lines changed: 682 additions & 67 deletions

File tree

AboutForm.Designer.cs

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MainForm.cs

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Drawing;
44
using System.IO;
55
using System.Net.NetworkInformation;
6+
using System.Threading.Tasks;
67
using System.Windows.Forms;
78

89
namespace Vight_Note
@@ -11,15 +12,15 @@ public partial class MainForm : System.Windows.Forms.Form
1112
{
1213
public static class Define
1314
{
14-
public const string NAME = "Vight Note";
15+
public const string NAME = @"Vight Note";
1516
public static readonly string VERSION = Application.ProductVersion;
16-
public const string DEVELOPER = "Space Time";
17-
public const string RELEASE_URL = "https://spacetime.lanzoui.com/b01666yti";
18-
public const string POLICY_URL = "https://thoughts.teambition.com/share/609fd36543b2b70046b09b06";
19-
public const string RELEASE_PASSWORD = "3a57";
17+
public const string DEVELOPER = @"Space Time";
18+
19+
public const string POLICY_URL = @"https://thoughts.teambition.com/share/609fd36543b2b70046b09b06";
20+
public const string THOUGHT_PING_URL = @"thoughts.teambition.com";
2021

2122
public static bool CHANGEMARK = false;
22-
public static string FILEPATH = "";
23+
public static string FILEPATH = @"";
2324
}
2425

2526
public MainForm(string[] args)
@@ -302,15 +303,8 @@ private void LiteMode_Click(object sender, EventArgs e)
302303
}
303304
private void Update_Click(object sender, EventArgs e)
304305
{
305-
if (!LiteMode.Checked)
306-
{
307-
MessageBox.Show($"即将打开光速下载页面,记住我们的密码暗号:{Define.RELEASE_PASSWORD}");
308-
}
309-
else
310-
{
311-
MessageBox.Show($"密码:{Define.RELEASE_PASSWORD}");
312-
}
313-
Process.Start(Define.RELEASE_URL);
306+
UpdateForm updateForm = new UpdateForm(LiteMode.Checked);
307+
updateForm.ShowDialog();
314308
}
315309
private void About_Click(object sender, EventArgs e)
316310
{
@@ -324,30 +318,22 @@ private void WhatIsLiteMode_Click(object sender, EventArgs e)
324318
{
325319
MessageBox.Show($@"在轻模式下{Define.NAME}会智能优化提示信息,提升办公效率,建议开启");
326320
}
327-
private void PrivacyPolicy_Click(object sender, EventArgs e)
321+
private async void PrivacyPolicy_Click(object sender, EventArgs e)
328322
{
329-
bool viewOnLine = false;
330-
Ping ping = new Ping();
331-
try
323+
bool viewOnline = await CheckConnect();
324+
325+
if (!LiteMode.Checked)
332326
{
333-
PingReply reply = ping.Send("thoughts.teambition.com"); //判断是否能连接到thought
334-
if (reply.Status == IPStatus.Success) //连接成功
335-
{
336-
viewOnLine = true;
337-
if (!LiteMode.Checked && MessageBox.Show("是否选择在线文档(推荐)", "已连接网络", MessageBoxButtons.YesNo) == DialogResult.No)
338-
viewOnLine = false;
339-
}
340-
else
341-
throw new Exception("NetworkError");
327+
if (viewOnline && MessageBox.Show("是否选择在线文档(推荐)", "已成功连接服务器", MessageBoxButtons.YesNo) == DialogResult.No)
328+
viewOnline = false;
329+
else if (!viewOnline && MessageBox.Show("是否选择本地文档", "连接服务器失败", MessageBoxButtons.YesNo) == DialogResult.No)
330+
viewOnline = true;
342331
}
343-
catch //连接失败
332+
333+
if (viewOnline)
344334
{
345-
viewOnLine = false;
346-
if (!LiteMode.Checked && MessageBox.Show("是否选择本地文档", "未连接网络", MessageBoxButtons.YesNo) == DialogResult.No)
347-
viewOnLine = true;
348-
}
349-
if (viewOnLine)
350335
Process.Start(Define.POLICY_URL);
336+
}
351337
else
352338
{
353339
PrivacyForm privacyForm = new PrivacyForm(DarkMode.Checked);
@@ -421,6 +407,36 @@ private void TextMenu_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
421407
Import_Click(Import, new EventArgs()); //导入文件
422408
}
423409
}
410+
//轻模式热键显示
411+
private void LiteShortcut(bool turnOn)
412+
{
413+
if (turnOn)
414+
{
415+
Create.ShortcutKeyDisplayString = "(N)";
416+
Close.ShortcutKeyDisplayString = "(W)";
417+
Save.ShortcutKeyDisplayString = "(S)";
418+
Export.ShortcutKeyDisplayString = "(S)";
419+
Import.ShortcutKeyDisplayString = "(O)";
420+
ImproveOpacity.ShortcutKeyDisplayString = "(U)";
421+
ReduceOpacity.ShortcutKeyDisplayString = "(D)";
422+
AlwaysTop.ShortcutKeyDisplayString = "(T)";
423+
LockTextBox.ShortcutKeyDisplayString = "(L)";
424+
DarkMode.ShortcutKeyDisplayString = "(B)";
425+
}
426+
else
427+
{
428+
Create.ShortcutKeyDisplayString = "(Ctrl+N)";
429+
Close.ShortcutKeyDisplayString = "(Ctrl+W)";
430+
Save.ShortcutKeyDisplayString = "(Ctrl+S)";
431+
Export.ShortcutKeyDisplayString = "(Alt+S)";
432+
Import.ShortcutKeyDisplayString = "(Ctrl+O)";
433+
ImproveOpacity.ShortcutKeyDisplayString = "(Ctrl+Alt+U)";
434+
ReduceOpacity.ShortcutKeyDisplayString = "(Ctrl+Alt+D)";
435+
AlwaysTop.ShortcutKeyDisplayString = "(Ctrl+Alt+T)";
436+
LockTextBox.ShortcutKeyDisplayString = "(Ctrl+Alt+L)";
437+
DarkMode.ShortcutKeyDisplayString = "(Ctrl+Alt+B)";
438+
}
439+
}
424440
//文件未保存标记
425441
private void TextBox_TextChanged(object sender, EventArgs e)
426442
{
@@ -449,9 +465,7 @@ private void ImportFile()
449465
MessageBoxButtons msgButton = MessageBoxButtons.YesNo;
450466

451467
if (MessageBox.Show("呃...已经有东西了,确定要覆盖吗?", $"{Define.NAME} 的提醒", msgButton) == DialogResult.No)
452-
{
453468
return;
454-
}
455469
}
456470

457471
//读文件
@@ -462,34 +476,21 @@ private void ImportFile()
462476
Text = Path.GetFileName(Define.FILEPATH);
463477
Define.CHANGEMARK = false;
464478
}
465-
//轻模式热键显示
466-
private void LiteShortcut(bool turnOn)
479+
//Ping检查连接
480+
private async Task<bool> CheckConnect()
467481
{
468-
if (turnOn)
482+
Ping ping = new Ping();
483+
try
469484
{
470-
Create.ShortcutKeyDisplayString = "(N)";
471-
Close.ShortcutKeyDisplayString = "(W)";
472-
Save.ShortcutKeyDisplayString = "(S)";
473-
Export.ShortcutKeyDisplayString = "(S)";
474-
Import.ShortcutKeyDisplayString = "(O)";
475-
ImproveOpacity.ShortcutKeyDisplayString = "(U)";
476-
ReduceOpacity.ShortcutKeyDisplayString = "(D)";
477-
AlwaysTop.ShortcutKeyDisplayString = "(T)";
478-
LockTextBox.ShortcutKeyDisplayString = "(L)";
479-
DarkMode.ShortcutKeyDisplayString = "(B)";
485+
PingReply reply = await ping.SendPingAsync(Define.THOUGHT_PING_URL); //Ping Thought服务器
486+
if (reply.Status == IPStatus.Success) //连接成功
487+
return true;
488+
else
489+
throw new Exception("NetworkError");
480490
}
481-
else
491+
catch //连接失败
482492
{
483-
Create.ShortcutKeyDisplayString = "(Ctrl+N)";
484-
Close.ShortcutKeyDisplayString = "(Ctrl+W)";
485-
Save.ShortcutKeyDisplayString = "(Ctrl+S)";
486-
Export.ShortcutKeyDisplayString = "(Alt+S)";
487-
Import.ShortcutKeyDisplayString = "(Ctrl+O)";
488-
ImproveOpacity.ShortcutKeyDisplayString = "(Ctrl+Alt+U)";
489-
ReduceOpacity.ShortcutKeyDisplayString = "(Ctrl+Alt+D)";
490-
AlwaysTop.ShortcutKeyDisplayString = "(Ctrl+Alt+T)";
491-
LockTextBox.ShortcutKeyDisplayString = "(Ctrl+Alt+L)";
492-
DarkMode.ShortcutKeyDisplayString = "(Ctrl+Alt+B)";
493+
return false;
493494
}
494495
}
495496
//项目信息

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
//
3131
//可以指定所有这些值,也可以通过 “*” 使用“生成号”和“修订号”的默认值,如:
3232
// [assembly: AssemblyVersion("1.0.*")]
33-
[assembly: AssemblyVersion("1.1.6")]
34-
[assembly: AssemblyFileVersion("1.1.6")]
33+
[assembly: AssemblyVersion("1.1.7")]
34+
[assembly: AssemblyFileVersion("1.1.7")]

0 commit comments

Comments
 (0)