重命名方法

This commit is contained in:
Falcon 2024-08-01 09:28:12 +08:00
parent 5841d6807e
commit 19d498cdd5

View File

@ -13,7 +13,7 @@ namespace CalendarNotepad
public WorkMain() { public WorkMain() {
InitializeComponent(); InitializeComponent();
this.rtbMsg.EnableAutoDragDrop = true; this.rtbMsg.EnableAutoDragDrop = true;
this.DataReset(); this.OnDataReset();
this.rtbMsg.TextChanged += RtbMsg_TextChanged; this.rtbMsg.TextChanged += RtbMsg_TextChanged;
foreach(var c in this.C_WorkTypes.Controls) { foreach(var c in this.C_WorkTypes.Controls) {
var rab = c as RadioButton; var rab = c as RadioButton;
@ -79,7 +79,7 @@ namespace CalendarNotepad
} }
} }
} }
this.DataReset(); this.OnDataReset();
Task.Factory.StartNew(() => { Task.Factory.StartNew(() => {
this.Invoke(() => { this.Invoke(() => {
this.mcWorkDay.BoldedDates = GetBoldDays().ToArray(); this.mcWorkDay.BoldedDates = GetBoldDays().ToArray();
@ -157,7 +157,7 @@ namespace CalendarNotepad
var qu = this.Db.Queryable<WorkUnit>().Where(exp).ToList(); var qu = this.Db.Queryable<WorkUnit>().Where(exp).ToList();
if(qu.Any() && msg.IsNullOrEmpty()) { if(qu.Any() && msg.IsNullOrEmpty()) {
this.Db.Deleteable<WorkUnit>().Where(exp).ExecuteCommand(); this.Db.Deleteable<WorkUnit>().Where(exp).ExecuteCommand();
this.DataReset(); this.OnDataReset();
return; return;
} }
if(qu.Any() && msg.IsNotNullOrEmpty()) { if(qu.Any() && msg.IsNotNullOrEmpty()) {
@ -166,7 +166,7 @@ namespace CalendarNotepad
.SetColumns(a => a.WorkType == wt) .SetColumns(a => a.WorkType == wt)
.SetColumns(a => a.Workout == wo) .SetColumns(a => a.Workout == wo)
.ExecuteCommand(); .ExecuteCommand();
this.DataReset(); this.OnDataReset();
return; return;
} }
if(!qu.Any() && msg.IsNotNullOrEmpty()) { if(!qu.Any() && msg.IsNotNullOrEmpty()) {
@ -174,21 +174,21 @@ namespace CalendarNotepad
WorkDay = wd, WorkDay = wd,
WorkMessage = msg,WorkType = wt,Workout = wo, WorkMessage = msg,WorkType = wt,Workout = wo,
}).ExecuteCommand(); }).ExecuteCommand();
this.DataReset(); this.OnDataReset();
return; return;
} }
} }
private void btReset_Click(object sender,EventArgs e) { private void btReset_Click(object sender,EventArgs e) {
mcWorkDay_DateChanged(sender,new DateRangeEventArgs(this.mcWorkDay.SelectionStart,this.mcWorkDay.SelectionEnd)); mcWorkDay_DateChanged(sender,new DateRangeEventArgs(this.mcWorkDay.SelectionStart,this.mcWorkDay.SelectionEnd));
this.DataReset(); this.OnDataReset();
} }
private void DataChanged() { private void DataChanged() {
this.btSave.Enabled = true; this.btSave.Enabled = true;
this.btReset.Enabled = true; this.btReset.Enabled = true;
} }
private void DataReset() { private void OnDataReset() {
this.btSave.Enabled = false; this.btSave.Enabled = false;
this.btReset.Enabled = false; this.btReset.Enabled = false;
} }