diff --git a/Bin/Debug/MyTimeClock/MyTimeClock.exe b/Bin/Debug/MyTimeClock/MyTimeClock.exe
index e3191bd..dbc3249 100644
Binary files a/Bin/Debug/MyTimeClock/MyTimeClock.exe and b/Bin/Debug/MyTimeClock/MyTimeClock.exe differ
diff --git a/Bin/Debug/MyTimeClock/RyLine.exe b/Bin/Debug/MyTimeClock/RyLine.exe
index 60fd735..90fc27d 100644
Binary files a/Bin/Debug/MyTimeClock/RyLine.exe and b/Bin/Debug/MyTimeClock/RyLine.exe differ
diff --git a/Bin/Debug/MyTimeClock/TimeClock.dll b/Bin/Debug/MyTimeClock/TimeClock.dll
index fb54b83..ee9fa09 100644
Binary files a/Bin/Debug/MyTimeClock/TimeClock.dll and b/Bin/Debug/MyTimeClock/TimeClock.dll differ
diff --git a/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat b/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat
index f0778a7..1649468 100644
Binary files a/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat and b/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat differ
diff --git a/Bin/Debug/MyTimeClock/UserDb/Win.dat b/Bin/Debug/MyTimeClock/UserDb/Win.dat
index a8dfe6f..15f785e 100644
--- a/Bin/Debug/MyTimeClock/UserDb/Win.dat
+++ b/Bin/Debug/MyTimeClock/UserDb/Win.dat
@@ -1,2 +1,2 @@
[TimeClock]
-hwnd=1195326
+hwnd=3673532
diff --git a/Bin/Debug/MyTimeClock/UserDb/sound/去接沐沐.mp3 b/Bin/Debug/MyTimeClock/UserDb/sound/去接沐沐.mp3
new file mode 100644
index 0000000..f48b341
Binary files /dev/null and b/Bin/Debug/MyTimeClock/UserDb/sound/去接沐沐.mp3 differ
diff --git a/Bin/Debug/MyTimeClock/cUpdate.dat b/Bin/Debug/MyTimeClock/cUpdate.dat
index 650d75b..7f0f2bd 100644
--- a/Bin/Debug/MyTimeClock/cUpdate.dat
+++ b/Bin/Debug/MyTimeClock/cUpdate.dat
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/Bin/Debug/MyTimeClock/logs/线程错误.log b/Bin/Debug/MyTimeClock/logs/线程错误.log
new file mode 100644
index 0000000..382aa0e
--- /dev/null
+++ b/Bin/Debug/MyTimeClock/logs/线程错误.log
@@ -0,0 +1,14 @@
+错误描述:无法将类型为“System.String”的对象强制转换为类型“SoundInfo”。
+
+异常堆栈: 在 TimeClock.DbOp.FrmTimeAdd.BtnOK_Click(Object sender, EventArgs e) 位置 E:\我的代码\毕方项目\C#\睿元定时提醒专家\Source\MyTimeClock\TimeClock\DbOp\FrmTimeAdd.cs:行号 606
+ 在 System.Windows.Forms.Control.OnClick(EventArgs e)
+ 在 System.Windows.Forms.Button.OnClick(EventArgs e)
+ 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
+ 在 ryControls.ButtonEx.OnMouseUp(MouseEventArgs e)
+ 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
+ 在 System.Windows.Forms.Control.WndProc(Message& m)
+ 在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
+ 在 System.Windows.Forms.Button.WndProc(Message& m)
+ 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
+
+异常方法:Void BtnOK_Click(System.Object, System.EventArgs)
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 196b962..a396637 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
### 2022-03-02更新
------
+#### TimeClock V1.0.2203.0202
+- *.[新增]新增自动加载用户音频文件的功能。
+
+### 2022-03-02更新
+------
#### TimeClock V1.0.2203.0201
- *.[改进]修复启动出错时无法保存log的bug。
diff --git a/Source/MyTimeClock/.vs/TimeClock/v16/.suo b/Source/MyTimeClock/.vs/TimeClock/v16/.suo
index 7a360b4..23dc2e2 100644
Binary files a/Source/MyTimeClock/.vs/TimeClock/v16/.suo and b/Source/MyTimeClock/.vs/TimeClock/v16/.suo differ
diff --git a/Source/MyTimeClock/MyTimeClock/Program.cs b/Source/MyTimeClock/MyTimeClock/Program.cs
index 4392c4a..bea873d 100644
--- a/Source/MyTimeClock/MyTimeClock/Program.cs
+++ b/Source/MyTimeClock/MyTimeClock/Program.cs
@@ -1,76 +1,76 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
-using System.Windows.Forms;
-
-namespace MyTimeClock
-{
- static class Program
- {
-
- ///
- /// 应用程序的主入口点。
- ///
- [STAThread]
- static void Main(string[] args)
- {
- AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
- Application.ThreadException += Application_ThreadException;
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Init.Run(args);
- }
- static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
- {
- try
- {
- AssemblyName assemblyName = new AssemblyName(args.Name);
- if (System.IO.File.Exists(Application.StartupPath + @"\Bin\dlls\" + assemblyName.Name + ".dll"))
- {
- return Assembly.LoadFrom(Application.StartupPath + @"\Bin\dlls\" + assemblyName.Name + ".dll");
- }
- else
- {
- return args.RequestingAssembly;
- }
- }
- catch (Exception ex)
- {
- return args.RequestingAssembly;
- }
- }
- static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
- {
- Exception ex = e.ExceptionObject as Exception;
- if (!System.IO.Directory.Exists(Application.StartupPath + "\\logs"))
- {
- System.IO.Directory.CreateDirectory(Application.StartupPath + "\\logs");
- }
- WriteLogs("错误.log", "错误描述:" + ex.Message + "\r\n\r\n异常堆栈:" + ex.StackTrace + "\r\n\r\n异常方法:" + ex.TargetSite);
- }
- static void WriteLogs(string file_name, string text)
- {
- string log_text = text;
- System.IO.File.WriteAllText(Application.StartupPath + "\\logs\\" + file_name, log_text,System.Text.Encoding.UTF8);
- if (MessageBox.Show("捕获到无法处理的异常!\r\n\r\n已生成错误日志,是否要提交给我们,以帮助我们尽快解决这个BUG?" +
- "\r\n\r\n当前日志包含了当前电脑的系统版本、进程、运行库、错误描述等信息,以帮助我们分析解决问题。\r\n\r\n选“是”自动提交错误日志。\r\n选“否”取消。", "错误", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
- {
- MessageBox.Show("错误日志无法提交!!!建议您将软件目录下的logs文件夹打包后发给我们,以帮助我们尽快解决这个BUG" +
-"\r\n\r\n当前日志包含了当前电脑的系统版本、进程、运行库、错误描述等信息,以帮助我们分析解决问题。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
-
- static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
- {
- Exception ex = e.Exception;
- //MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息:{1}\r\n异常堆栈:{2}", ex.GetType(), ex.Message, ex.StackTrace));
- if (!System.IO.Directory.Exists(Application.StartupPath + "\\logs"))
- {
- System.IO.Directory.CreateDirectory(Application.StartupPath + "\\logs");
- }
- WriteLogs("线程错误.log", "错误描述:" + ex.Message + "\r\n\r\n异常堆栈:" + ex.StackTrace + "\r\n\r\n异常方法:" + ex.TargetSite);
- }
- }
-}
+using System.Windows.Forms;
+
+namespace MyTimeClock
+{
+ static class Program
+ {
+
+ ///
+ /// 应用程序的主入口点。
+ ///
+ [STAThread]
+ static void Main(string[] args)
+ {
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
+ Application.ThreadException += Application_ThreadException;
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Init.Run(args);
+ }
+ static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
+ {
+ try
+ {
+ AssemblyName assemblyName = new AssemblyName(args.Name);
+ if (System.IO.File.Exists(Application.StartupPath + @"\Bin\dlls\" + assemblyName.Name + ".dll"))
+ {
+ return Assembly.LoadFrom(Application.StartupPath + @"\Bin\dlls\" + assemblyName.Name + ".dll");
+ }
+ else
+ {
+ return args.RequestingAssembly;
+ }
+ }
+ catch (Exception ex)
+ {
+ return args.RequestingAssembly;
+ }
+ }
+ static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ Exception ex = e.ExceptionObject as Exception;
+ if (!System.IO.Directory.Exists(Application.StartupPath + "\\logs"))
+ {
+ System.IO.Directory.CreateDirectory(Application.StartupPath + "\\logs");
+ }
+ WriteLogs("错误.log", "错误描述:" + ex.Message + "\r\n\r\n异常堆栈:" + ex.StackTrace + "\r\n\r\n异常方法:" + ex.TargetSite);
+ }
+ static void WriteLogs(string file_name, string text)
+ {
+ string log_text = text;
+ System.IO.File.WriteAllText(Application.StartupPath + "\\logs\\" + file_name, log_text,System.Text.Encoding.UTF8);
+ if (MessageBox.Show("捕获到无法处理的异常!\r\n\r\n已生成错误日志,是否要提交给我们,以帮助我们尽快解决这个BUG?" +
+ "\r\n\r\n当前日志包含了当前电脑的系统版本、进程、运行库、错误描述等信息,以帮助我们分析解决问题。\r\n\r\n选“是”自动提交错误日志。\r\n选“否”取消。", "错误", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
+ {
+ MessageBox.Show("错误日志无法提交!!!建议您将软件目录下的logs文件夹打包后发给我们,以帮助我们尽快解决这个BUG" +
+"\r\n\r\n当前日志包含了当前电脑的系统版本、进程、运行库、错误描述等信息,以帮助我们分析解决问题。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
+ {
+ Exception ex = e.Exception;
+ //MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息:{1}\r\n异常堆栈:{2}", ex.GetType(), ex.Message, ex.StackTrace));
+ if (!System.IO.Directory.Exists(Application.StartupPath + "\\logs"))
+ {
+ System.IO.Directory.CreateDirectory(Application.StartupPath + "\\logs");
+ }
+ WriteLogs("线程错误.log", "错误描述:" + ex.Message + "\r\n\r\n异常堆栈:" + ex.StackTrace + "\r\n\r\n异常方法:" + ex.TargetSite);
+ }
+ }
+}
diff --git a/Source/MyTimeClock/MyTimeClock/Properties/AssemblyInfo.cs b/Source/MyTimeClock/MyTimeClock/Properties/AssemblyInfo.cs
index 1e71903..16b704d 100644
--- a/Source/MyTimeClock/MyTimeClock/Properties/AssemblyInfo.cs
+++ b/Source/MyTimeClock/MyTimeClock/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.2203.0201")]
-[assembly: AssemblyFileVersion("2.0.2203.0201")]
\ No newline at end of file
+[assembly: AssemblyVersion("2.0.2203.0202")]
+[assembly: AssemblyFileVersion("2.0.2203.0202")]
\ No newline at end of file
diff --git a/Source/MyTimeClock/TimeClock/DbOp/FrmTimeAdd.cs b/Source/MyTimeClock/TimeClock/DbOp/FrmTimeAdd.cs
index 60489fa..80124b0 100644
--- a/Source/MyTimeClock/TimeClock/DbOp/FrmTimeAdd.cs
+++ b/Source/MyTimeClock/TimeClock/DbOp/FrmTimeAdd.cs
@@ -283,14 +283,15 @@ namespace TimeClock.DbOp
tStor.SelectNodeBySet();
ChkSound.Checked=tStor.GetAttrValue("sound_on", true);
string sound = tStor.GetAttrValue("sound", @"tip.wav");
- if (CbbSound.Items.Contains(sound))
+ for (int i = 0; i < CbbSound.Items.Count; i++)
{
- CbbSound.Text = sound;
+ var item = (SoundInfo)CbbSound.Items[i];
+ if(item.Path== sound) { CbbSound.SelectedItem = item; break; }
}
- else
+ if (CbbSound.SelectedIndex==-1)
{
- CbbSound.Items.Add(sound);
- CbbSound.Text = sound;
+ CbbSound.Items.Add(new SoundInfo() {Name= sound,Path= sound });
+ CbbSound.SelectedIndex = CbbSound.Items.Count - 1 ;
}
ChkShowPic.Checked = tStor.GetAttrValue("showpic_on", false);
ImgPath= tStor.GetAttrValue("showpic", "");
@@ -603,14 +604,17 @@ namespace TimeClock.DbOp
tStor.SetAttrValue("Pram", CbbPram.Text);
tStor.SetAttrValue("week", week);
tStor.SetAttrValue("sound_on", ChkSound.Checked);
- var sound_item = (SoundInfo)CbbSound.SelectedItem;
- if (sound_item == null)
+ switch(CbbSound.SelectedItem)
{
- tStor.SetAttrValue("sound", CbbSound.Text);
- }
- else
- {
- tStor.SetAttrValue("sound", sound_item.Path);
+ case SoundInfo sound_item:
+ tStor.SetAttrValue("sound", sound_item.Path);
+ break;
+ case string sound_item:
+ tStor.SetAttrValue("sound", sound_item);
+ break;
+ default:
+ tStor.SetAttrValue("sound", "");
+ break;
}
tStor.SetAttrValue("showpic_on", ChkShowPic.Checked);
tStor.SetAttrValue("showpic", pic_path);
diff --git a/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs b/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs
index 00819d0..9963b64 100644
--- a/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs
+++ b/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.2203.0201")]
-[assembly: AssemblyFileVersion("1.0.2203.0201")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.2203.0202")]
+[assembly: AssemblyFileVersion("1.0.2203.0202")]
\ No newline at end of file