Пример #1
0
 private void CremaHost_CloseRequested(object sender, CloseRequestedEventArgs e)
 {
     e.AddTask(InvokeAsync());
     async Task InvokeAsync()
     {
         await this.Dispatcher.InvokeAsync(() =>
         {
             this.ServiceState = JSSoft.Crema.Services.ServiceState.Closing;
         });
     }
 }
Пример #2
0
 private async void CremaHost_Closed(object sender, ClosedEventArgs e)
 {
     if (sender is ICremaHost)
     {
         if (e.Reason == CloseReason.Restart)
         {
             this.cremaHost.Opened += CremaHost_Opened;
         }
         await this.Dispatcher.InvokeAsync(() =>
         {
             this.ServiceState = JSSoft.Crema.Services.ServiceState.Closed;
             this.OnClosed(e);
         });
     }
 }
Пример #3
0
        private async void CremaHost_Opened(object sender, EventArgs e)
        {
            if (sender is ICremaHost cremaHost)
            {
                this.cremaHost.Opened -= CremaHost_Opened;
                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.ServiceState = JSSoft.Crema.Services.ServiceState.Opening;
                });

                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.ServiceState = JSSoft.Crema.Services.ServiceState.Open;
                });
            }
        }