diff --git a/SQLite.cs b/SQLite.cs index 1c5db36b..12a63b7d 100644 --- a/SQLite.cs +++ b/SQLite.cs @@ -59,11 +59,17 @@ namespace VRCX { var values = new object[reader.FieldCount]; reader.GetValues(values); - callback.ExecuteAsync(null, values); + if (callback.CanExecute == true) + { + callback.ExecuteAsync(null, values); + } } } } - callback.ExecuteAsync(null, null); + if (callback.CanExecute == true) + { + callback.ExecuteAsync(null, null); + } } finally { @@ -72,7 +78,10 @@ namespace VRCX } catch (Exception e) { - callback.ExecuteAsync(e.Message, null); + if (callback.CanExecute == true) + { + callback.ExecuteAsync(e.Message, null); + } } callback.Dispose(); diff --git a/WebApi.cs b/WebApi.cs index a817599d..615c4f65 100644 --- a/WebApi.cs +++ b/WebApi.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Net; using System.Runtime.Serialization.Formatters.Binary; +using System.Windows.Forms; namespace VRCX { @@ -125,11 +126,14 @@ namespace VRCX using (var stream = response.GetResponseStream()) using (var streamReader = new StreamReader(stream)) { - callback.ExecuteAsync(null, new + if (callback.CanExecute == true) { - data = await streamReader.ReadToEndAsync(), - status = response.StatusCode - }); + callback.ExecuteAsync(null, new + { + data = await streamReader.ReadToEndAsync(), + status = response.StatusCode + }); + } } } catch (WebException webException) @@ -139,14 +143,17 @@ namespace VRCX using (var stream = response.GetResponseStream()) using (var streamReader = new StreamReader(stream)) { - callback.ExecuteAsync(null, new + if (callback.CanExecute == true) { - data = await streamReader.ReadToEndAsync(), - status = response.StatusCode - }); + callback.ExecuteAsync(null, new + { + data = await streamReader.ReadToEndAsync(), + status = response.StatusCode + }); + } } } - else + else if (callback.CanExecute == true) { callback.ExecuteAsync(webException.Message, null); } @@ -154,8 +161,11 @@ namespace VRCX } catch (Exception e) { - // FIXME: 브라우저는 종료되었는데 얘는 이후에 실행되면 터짐 - callback.ExecuteAsync(e.Message, null); + if (callback.CanExecute == true) + { + // FIXME: 브라우저는 종료되었는데 얘는 이후에 실행되면 터짐 + callback.ExecuteAsync(e.Message, null); + } } callback.Dispose();