mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-06-07 22:59:14 +08:00
Fix Activity add issue
This commit is contained in:
parent
5b0cb912e4
commit
dec3b2261f
@ -231,19 +231,21 @@ namespace GrasscutterTools.Forms
|
|||||||
private async void BtnAddOrUpdate_Click(object sender, EventArgs e)
|
private async void BtnAddOrUpdate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var activityId = (int)NUDActivityId.Value;
|
var activityId = (int)NUDActivityId.Value;
|
||||||
|
var isNew = false;
|
||||||
var item = ActivityConfigItems.Find(it => it.ActivityId == activityId);
|
var item = ActivityConfigItems.Find(it => it.ActivityId == activityId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
item = new ActivityConfigItem();
|
item = new ActivityConfigItem();
|
||||||
ActivityConfigItems.Add(item);
|
isNew = true;
|
||||||
ListActivityConfigItems.Items.Add(Convert(item));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item.ActivityType = (int)NUDActivityType.Value;
|
item.ActivityType = (int)NUDActivityType.Value;
|
||||||
item.ScheduleId = (int)NUDScheduleId.Value;
|
item.ScheduleId = (int)NUDScheduleId.Value;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
item.MeetCondList = TxtMeetCondList.Text.Split(',').Select(it => int.Parse(it.Trim())).ToList();
|
item.MeetCondList = !string.IsNullOrEmpty(TxtMeetCondList.Text)
|
||||||
|
? TxtMeetCondList.Text.Split(',').Select(it => int.Parse(it.Trim())).ToList()
|
||||||
|
: new List<int>();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -258,6 +260,12 @@ namespace GrasscutterTools.Forms
|
|||||||
item.BeginTime = DTPBeginTime.Value.Date;
|
item.BeginTime = DTPBeginTime.Value.Date;
|
||||||
item.EndTime = DTPEndTime.Value.Date.AddDays(1).AddSeconds(-1);
|
item.EndTime = DTPEndTime.Value.Date.AddDays(1).AddSeconds(-1);
|
||||||
|
|
||||||
|
if (isNew)
|
||||||
|
{
|
||||||
|
ActivityConfigItems.Add(item);
|
||||||
|
ListActivityConfigItems.Items.Add(Convert(item));
|
||||||
|
}
|
||||||
|
|
||||||
BtnDelete.Enabled = true;
|
BtnDelete.Enabled = true;
|
||||||
await UIUtil.ButtonComplete(BtnAddOrUpdate);
|
await UIUtil.ButtonComplete(BtnAddOrUpdate);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user