### 2022-03-02更新

------
#### TimeClock    V1.0.2203.0202
- *.[新增]新增自动加载用户音频文件的功能。
This commit is contained in:
紫林软件 2022-03-02 23:07:54 +08:00
parent 3fb4fa4be9
commit 13159fc2d1
14 changed files with 116 additions and 93 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
[TimeClock]
hwnd=1195326
hwnd=3673532

Binary file not shown.

View File

@ -1,3 +1,3 @@
<root>
<list id="LastUpdateTime" Value="2022/3/2 20:28:06" />
<list id="LastUpdateTime" Value="2022/3/2 20:51:09" />
</root>

View File

@ -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)

View File

@ -1,5 +1,10 @@
### 2022-03-02更新
------
#### TimeClock V1.0.2203.0202
- *.[新增]新增自动加载用户音频文件的功能。
### 2022-03-02更新
------
#### TimeClock V1.0.2203.0201
- *.[改进]修复启动出错时无法保存log的bug。

View File

@ -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
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[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
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[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);
}
}
}

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2203.0201")]
[assembly: AssemblyFileVersion("2.0.2203.0201")]
[assembly: AssemblyVersion("2.0.2203.0202")]
[assembly: AssemblyFileVersion("2.0.2203.0202")]

View File

@ -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);

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2203.0201")]
[assembly: AssemblyFileVersion("1.0.2203.0201")]
[assembly: AssemblyVersion("1.0.2203.0202")]
[assembly: AssemblyFileVersion("1.0.2203.0202")]