示例#1
0
 /// <summary>
 /// Saves graph in stream async
 /// </summary>
 /// <param name="graph"></param>
 /// <param name="stream"></param>
 public async Task SaveGraphAsync(IGraph graph, Stream stream)
 {
     await Task.Run(() =>
     {
         try
         {
             SaveGraph(graph, stream);
         }
         catch (CantSerializeGraphException ex)
         {
             OnExceptionCaught?.Invoke(ex, string.Empty);
         }
     });
 }
 public void LoadClasses()
 {
     if (!isStarted)
     {
         token     = tokenSource.Token;
         isStarted = true;
         Task.Run(() =>
         {
             while (!token.IsCancellationRequested)
             {
                 try
                 {
                     assembleClasses.LoadClasses();
                     ClassesNames = assembleClasses.ClassesNames;
                 }
                 catch (Exception ex)
                 {
                     OnExceptionCaught?.Invoke(ex, string.Empty);
                 }
             }
         }, token);
     }
 }
 public override void OnException(HttpActionExecutedContext actionExecutedContext)
 {
     OnExceptionCaught?.Invoke(actionExecutedContext.Exception);
     base.OnException(actionExecutedContext);
 }