private void InstallCompleted(Windows.Foundation.IAsyncOperationWithProgress <PackageInstallResult, uint> installResult, Windows.Foundation.AsyncStatus asyncStatus) { try { this.Dispatcher.BeginInvoke( () => { int index = FindAsyncAppIndex(installResult.Id); if (index != -1) { App.ViewModel.CompanyApps[index].ProgressValue = 100; if (asyncStatus == Windows.Foundation.AsyncStatus.Completed) { App.ViewModel.CompanyApps[index].Status = Status.Installed; } else if (asyncStatus == Windows.Foundation.AsyncStatus.Canceled) { App.ViewModel.CompanyApps[index].Status = Status.Canceled; } else { App.ViewModel.CompanyApps[index].Status = Status.InstallFailed; } } }); } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }
async void EventChannel_OnEventChannelClosed(Windows.Foundation.AsyncStatus status) { if (OnEventChannelTerminated != null) { await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal, new DispatchedHandler(() => { OnEventChannelTerminated(status); })); } if (this.restartEventChannel) { this.EventChannel.Start(); } }
private void CompletedBackgroundRequest(Windows.Foundation.IAsyncOperation <BackgroundAccessStatus> asyncInfo, Windows.Foundation.AsyncStatus asyncStatus) { OnBackgroundStatusChanged(); }
// For SharedCcw_AsyncOperationCompletedHandler internal static T Call <T>(IntPtr pfn, object handler, object asyncInfo, Windows.Foundation.AsyncStatus status) { return(default(T)); }
private void LoadCompleted(Windows.Foundation.IAsyncOperation <uint> asyncInfo, Windows.Foundation.AsyncStatus asyncStatus) { switch (asyncStatus) { case Windows.Foundation.AsyncStatus.Canceled: //logger.AddLog("Data load operation canceled"); break; case Windows.Foundation.AsyncStatus.Completed: //logger.AddLog("Data load operation completed"); if (TcpStreamReader.UnconsumedBufferLength.Equals(0)) { if (IsSocketConnected) { //logger.AddLog("Connection closed by remote host. Exiting"); IsSocketConnected = false; IsConnectionClosedByRemoteHost = true; CloseSocket(); } } else { IBuffer buffer = TcpStreamReader.DetachBuffer(); RaiseDataReceivedEvent(buffer.ToArray()); DataReaderLoadOperation loadOperation = TcpStreamReader.LoadAsync(ReadBufferLength); try { loadOperation.Completed = new Windows.Foundation.AsyncOperationCompletedHandler <UInt32>(LoadCompleted); } catch (Exception e) { } } break; case Windows.Foundation.AsyncStatus.Error: //logger.AddLog("Exception in data load operation"); IsSocketConnected = false; if (asyncInfo.ErrorCode.HResult.Equals(-2147014842)) { IsConnectionClosedByRemoteHost = true; } else { RaiseErrorOccuredEvent(asyncInfo.ErrorCode); } CloseSocket(); break; case Windows.Foundation.AsyncStatus.Started: //logger.AddLog("Data load operation started"); break; } }