minor bug fixes

This commit is contained in:
Genteure 2021-01-29 20:31:25 +08:00
parent 37bc1e8558
commit dc2531bd10
4 changed files with 45 additions and 24 deletions

View File

@ -87,8 +87,9 @@ namespace BililiveRecorder.WPF
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
{ {
e.Cancel = true; if (e != null)
(Current.MainWindow as NewMainWindow).CloseWithoutConfirmAction(); e.Cancel = true;
(Current.MainWindow as NewMainWindow)?.CloseWithoutConfirmAction();
} }
} }
} }

View File

@ -18,12 +18,12 @@
<attribute name='pid' layout='${processid}'/> <attribute name='pid' layout='${processid}'/>
<attribute name='logger' layout='${logger}'/> <attribute name='logger' layout='${logger}'/>
<attribute name='roomid' layout='${event-properties:item=roomid}'/> <attribute name='roomid' layout='${event-properties:item=roomid}'/>
<attribute name='message' layout='${message}'/> <attribute name='message' escapeUnicode="false" layout='${message}'/>
<attribute name='exception' encode='false'> <attribute name='exception' escapeUnicode="false" encode='false'>
<layout xsi:type='JsonLayout'> <layout xsi:type='JsonLayout'>
<attribute name='type' layout='${exception:format=Type}'/> <attribute name='type' escapeUnicode="false" layout='${exception:format=Type}'/>
<attribute name='message' layout='${exception:format=Message}'/> <attribute name='message' escapeUnicode="false" layout='${exception:format=Message}'/>
<attribute name='tostring' layout='${exception:format=ToString}'/> <attribute name='tostring' escapeUnicode="false" layout='${exception:format=ToString}'/>
</layout> </layout>
</attribute> </attribute>
</layout> </layout>

View File

@ -18,12 +18,12 @@
<attribute name='pid' layout='${processid}'/> <attribute name='pid' layout='${processid}'/>
<attribute name='logger' layout='${logger}'/> <attribute name='logger' layout='${logger}'/>
<attribute name='roomid' layout='${event-properties:item=roomid}'/> <attribute name='roomid' layout='${event-properties:item=roomid}'/>
<attribute name='message' layout='${message}'/> <attribute name='message' escapeUnicode="false" layout='${message}'/>
<attribute name='exception' encode='false'> <attribute name='exception' escapeUnicode="false" encode='false'>
<layout xsi:type='JsonLayout'> <layout xsi:type='JsonLayout'>
<attribute name='type' layout='${exception:format=Type}'/> <attribute name='type' escapeUnicode="false" layout='${exception:format=Type}'/>
<attribute name='message' layout='${exception:format=Message}'/> <attribute name='message' escapeUnicode="false" layout='${exception:format=Message}'/>
<attribute name='tostring' layout='${exception:format=ToString}'/> <attribute name='tostring' escapeUnicode="false" layout='${exception:format=ToString}'/>
</layout> </layout>
</attribute> </attribute>
</layout> </layout>

View File

@ -111,18 +111,22 @@ namespace BililiveRecorder.WPF.Pages
{ {
if (this.DataContext is IRecorder rec && sender is IRecordedRoom room) if (this.DataContext is IRecorder rec && sender is IRecordedRoom room)
{ {
var dialog = new DeleteRoomConfirmDialog try
{ {
DataContext = room var dialog = new DeleteRoomConfirmDialog
}; {
DataContext = room
};
var result = await dialog.ShowAsync(); var result = await dialog.ShowAsync();
if (result == ContentDialogResult.Primary) if (result == ContentDialogResult.Primary)
{ {
rec.RemoveRoom(room); rec.RemoveRoom(room);
rec.SaveConfigToFile(); rec.SaveConfigToFile();
}
} }
catch (Exception) { }
} }
} }
@ -149,25 +153,41 @@ namespace BililiveRecorder.WPF.Pages
} }
else else
{ {
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.InvalidInput }.ShowAsync(); try
{
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.InvalidInput }.ShowAsync();
}
catch (Exception) { }
return; return;
} }
} }
if (roomid < 0) if (roomid < 0)
{ {
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.RoomIdNegative }.ShowAsync(); try
{
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.RoomIdNegative }.ShowAsync();
}
catch (Exception) { }
return; return;
} }
else if (roomid == 0) else if (roomid == 0)
{ {
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.RoomIdZero }.ShowAsync(); try
{
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.RoomIdZero }.ShowAsync();
}
catch (Exception) { }
return; return;
} }
if (rec.Any(x => x.RoomId == roomid || x.ShortRoomId == roomid)) if (rec.Any(x => x.RoomId == roomid || x.ShortRoomId == roomid))
{ {
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.Duplicate }.ShowAsync(); try
{
await new AddRoomFailedDialog { DataContext = AddRoomFailedDialog.AddRoomFailedErrorText.Duplicate }.ShowAsync();
}
catch (Exception) { }
return; return;
} }