protected virtual void OnAfterCompleted(CompletedEventArgs e) { if (null != AfterCompleted) { AfterCompleted(e); } }
protected virtual void OnCompleted(CompletedEventArgs e) { var handler = Completed; if (handler != null) { handler(this, e); } }
void getProvidersComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Get Providers Error", MessageBoxButton.OK); return; } newDbDictionary.cbProvider.ItemsSource = (string[])args.Data; }
void ConsumerCompletedCallback(object source, CompletedEventArgs args) { Guid correlationId = args.CorrelationId; // you are on a MT thread, so you have to post back to your UI thread here or get an InvalidOperationException // for cross-thread operations _context.Post( _ => { richTextBox1.Text += string.Format("Consumer completed, CorrelationId is {0}\r\n", correlationId); }, null); }
private void Fi_Completed(object sender, CompletedEventArgs e) { _endTicks = DateTime.Now.Ticks; switch (e.Status) { case CompletionStatus.Cancelled: State = ConversionStateEnum.Cancelled; break; case CompletionStatus.Error: State = ConversionStateEnum.Error; break; case CompletionStatus.Success: State = ConversionStateEnum.Success; break; case CompletionStatus.Timeout: State = ConversionStateEnum.Timeout; break; } var evArgs = new ConversionCompletedEventArgs(State); if (State == ConversionStateEnum.Success) { var caminho = GeraManifestoMaster(); evArgs.MasterPlayList.Path = caminho; } evArgs.Duration = ElapsedTime; if (vaiFazer320) { evArgs.MasterPlayList.AvaiablePlayLists.Add(ObtemPlayListPara("320x180")); } if (vaiFazer480) { evArgs.MasterPlayList.AvaiablePlayLists.Add(ObtemPlayListPara("480x270")); } if (vaiFazer640) { evArgs.MasterPlayList.AvaiablePlayLists.Add(ObtemPlayListPara("640x360")); } if (vaiFazer1280) { evArgs.MasterPlayList.AvaiablePlayLists.Add(ObtemPlayListPara("1280x720")); } //var oQueFez = new[] { } OnComplete?.Invoke(this, evArgs); }
private void RaiseRefreshApps(object sender, CompletedEventArgs e) { var observer = sender as ManagementOperationObserver; if (observer != null) { observer.Completed -= RaiseRefreshApps; } Refresh(); }
public void Done(object sender, CompletedEventArgs e) { _stopwatch.Stop(); if (_isNamespace) { if (e.Status == ManagementStatus.CallCanceled) { _wmiNamespace.IsPartiallyEnumerated = true; _wmiNamespace.IsEnumerationCancelled = true; } else { _wmiNamespace.IsPartiallyEnumerated = false; _wmiNamespace.IsEnumerationCancelled = false; } _wmiNamespace.IsEnumerated = true; _wmiNamespace.IsEnumerating = false; _wmiNamespace.EnumerationStatus = e.Status.ToString(); _wmiNamespace.EnumTime = DateTime.Now; _wmiNamespace.EnumTimeElapsed = _stopwatch.Elapsed; CacheItem ci = new CacheItem(_wmiNamespace.Path, _wmiNamespace.Classes); WmiExplorer.AppCache.Set(ci, WmiExplorer.CachePolicy); _wmiNamespace.ResetClasses(); } if (_isClass) { if (e.Status == ManagementStatus.CallCanceled) { _wmiClass.IsPartiallyEnumerated = true; _wmiClass.IsEnumerationCancelled = true; } else { _wmiClass.IsPartiallyEnumerated = false; _wmiClass.IsEnumerationCancelled = false; } _wmiClass.IsEnumerated = true; _wmiClass.IsEnumerating = false; _wmiClass.IsEnumerationCancelled = false; _wmiClass.EnumerationStatus = e.Status.ToString(); _wmiClass.EnumTime = DateTime.Now; _wmiClass.EnumTimeElapsed = _stopwatch.Elapsed; CacheItem ci = new CacheItem(_wmiClass.Path, _wmiClass.Instances); WmiExplorer.AppCache.Set(ci, WmiExplorer.CachePolicy); _wmiClass.ResetInstances(); } IsComplete = true; }
public void OnAllProcessors(object sender, CompletedEventArgs e) { if (totalProcessors > 1) { Console.WriteLine("\n{0} processors", totalProcessors); } else { Console.WriteLine("\n{0} processor", totalProcessors); } }
public void Done(object sender, CompletedEventArgs e) { if (null != e.Context) { Console.WriteLine("Context is " + e.Context.ToString()); } Console.WriteLine("Operation completed with status " + e.Status + " on thread " + System.Threading.Thread.CurrentThread.GetHashCode()); m_bIsComplete = true; }
void savedbdictionaryComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Save Database Dictionary Error", MessageBoxButton.OK); return; } _dal.GetExistingDbDictionaryFiles(); //tvwItemDestinationRoot.Items.Clear(); }
void threadProcessor_Completed(object sender, CompletedEventArgs e) { if (this.InvokeRequired) { // We're on a thread other than the GUI thread this.Invoke(new MethodInvoker(() => threadProcessor_Completed(sender, e))); return; } EndExecuteActions(); }
internal void Done(object sender, CompletedEventArgs args) { if (opCount == initialOpCount) { labelStatus.Text = "All " + opCount + " callbacks processed"; } else { labelStatus.Text = "Only " + opCount + " of " + initialOpCount + " callbacks processed"; } }
private void DelegateReceiveCompleted(object sender, CompletedEventArgs args) { if (ReceiveCompleted == null) { return; } ReceiveCompletedEventArgs newArgs = new ReceiveCompletedEventArgs(this, args.AsyncResult); ReceiveCompleted(sender, newArgs); }
private void MyFact_Completed(object sender, CompletedEventArgs e) { this.Dispatcher.Invoke(() => { TxtResult.Text = e.Result.ToString(); BtnFact.IsEnabled = true; BtnCancel.IsEnabled = false; }); CTS.Dispose(); }
private void DelegatePeekCompleted(object sender, CompletedEventArgs args) { if (PeekCompleted == null) { return; } PeekCompletedEventArgs newArgs = new PeekCompletedEventArgs(this, args.AsyncResult); PeekCompleted(sender, newArgs); }
public void deleteCompleted(object sender, CompletedEventArgs obj) { if (InvokeRequired) { Invoke((CompletedEventHandler)deleteCompleted, sender, obj); } else { SetEnabledLocalFilesTab(true); } }
private void OnCompleted(IntPtr vector2) { if (scrollableCompletedEventHandler != null) { CompletedEventArgs e = new CompletedEventArgs(); // Populate all members of "e" (CompletedEventArgs) with real data e.Vector2 = Tizen.NUI.Vector2.GetVector2FromPtr(vector2); //here we send all data to user event handlers scrollableCompletedEventHandler(this, e); } }
void _searcher_Completed(object sender, CompletedEventArgs e) { //rbSelect_Click(this, new EventArgs()); //rbSelect.Toggle(); if (e.Result == null) { return; } e.ProgressHandler.ReportMessage("Adding Sites to Map..."); var result = e.Result; //We need to reproject the Search results from WGS84 to the projection of the map. var wgs84 = KnownCoordinateSystems.Geographic.World.WGS1984; foreach (var item in result.ResultItems) { item.FeatureSet.Projection = wgs84; } var layers = ShowSearchResults(result); Debug.WriteLine("ShowSearchResults done."); // Unselect all layers in legend (http://hydrodesktop.codeplex.com/workitem/8559) App.Map.MapFrame.GetAllLayers().ForEach(r => r.IsSelected = false); // Select first search result layer var first = layers.FirstOrDefault().GetParentItem(); if (first != null) { first.IsSelected = true; } // Unselect "Map Layers" legend item (http://hydrodesktop.codeplex.com/workitem/8458) App.Legend.RootNodes .ForEach(delegate(ILegendItem item) { if (item.LegendText == "Map Layers") { item.IsSelected = false; } }); Debug.WriteLine("Finished."); }
public void OnCompleted(object sender, CompletedEventArgs ea) { if (ea.Status != ManagementStatus.NoError) { Console.WriteLine( "Error occurred: {0}", ea.StatusObject["Description"]); Console.WriteLine("Provider: {0}", ea.StatusObject["ProviderName"]); Console.WriteLine("Operation: {0}", ea.StatusObject["Operation"]); Console.WriteLine("ParameterInfo: {0}", ea.StatusObject["ParameterInfo"]); } bComplete = true; }
void postdbdictionaryComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Post Database Dictionary Error", MessageBoxButton.OK); return; } Response response = (Response)args.Data; resultsList.lbResult.ItemsSource = response; biBusyWindow.IsBusy = false; isPosting = false; resultsList.Show(); }
void threadProcessor_Completed(object sender, CompletedEventArgs e) { if (this.InvokeRequired) { // We're on a thread other than the GUI thread this.Invoke(new MethodInvoker(() => threadProcessor_Completed(sender, e))); return; } EndExecuteActions(); if (e.Canceled) { DisplayMessage("Execution was interrupted by user"); } }
void threadProcessor_SavingCompleted(object sender, CompletedEventArgs e) { if (this.InvokeRequired) { // We're on a thread other than the GUI thread this.Invoke(new MethodInvoker(() => threadProcessor_SavingCompleted(sender, e))); return; } EndExecuteSaveActions(); //LoadInProgressServiceInstances(txtAppName.Text); /*if (this.InvokeRequired) * { * // We're on a thread other than the GUI thread * this.Invoke(new MethodInvoker(() => threadProcessor_Completed(sender, e))); * return; * }*/ }
void deleteComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Delete Application Error", MessageBoxButton.OK); return; } Response response = (Response)args.Data; string dictionaries = cbDictionary.SelectedItem.ToString(); string project = dictionaries.Split('.')[1]; string application = dictionaries.Split('.')[2]; resultsList.lbResult.ItemsSource = response; _dal.GetDbDictionary(project, application); }
void clearTripleStoreComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Post Database Dictionary Error", MessageBoxButton.OK); return; } Response resp = (Response)args.Data; string dictionary = cbDictionary.SelectedItem.ToString(); string project = dictionary.Split('.')[1]; string application = dictionary.Split('.')[2]; resultsList.lbResult.ItemsSource = resp; //_dal.PostDictionaryToAdapterService(project, application); }
void threadProcessor_Completed(object sender, CompletedEventArgs e) { if (this.InvokeRequired) { // We're on a thread other than the GUI thread try { this.Invoke(new MethodInvoker(() => threadProcessor_Completed(sender, e))); } catch (Exception) { return; } return; } this.FormState = FormStateEnum.Initial; //EndExecuteActions(); }
void getdbdictionariesComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Get Existing Database Dictionaries Error", MessageBoxButton.OK); return; } dbDictionaries = (List <string>)args.Data; cbDictionary.IsEnabled = true; List <string> dbDict = dbDictionaries.ToList <string>(); dbDict.Sort(); cbDictionary.ItemsSource = dbDict; if (cbDictionary.Items.Count > 0) { if (newDictionary != null) { if (cbDictionary.Items.Contains(newDictionary.ToString())) { cbDictionary.SelectedIndex = cbDictionary.Items.IndexOf(newDictionary.ToString()); } _dal.GetDbDictionary(newDictionary.ToString().Split('.')[1], newDictionary.ToString().Split('.')[2]); newDictionary = null; } else { if (string.IsNullOrEmpty(selectedCBItem)) { cbDictionary.SelectedIndex = 0; selectedCBItem = cbDictionary.SelectedItem.ToString(); } cbDictionary.SelectedIndex = cbDictionary.Items.IndexOf(selectedCBItem); } _dal.GetDbDictionary(selectedCBItem.Split('.')[1], selectedCBItem.Split('.')[2]); } biBusyWindow.IsBusy = false; }
void _searcher_Completed(object sender, CompletedEventArgs e) { DeactivateDrawBox(); if (e.Result == null) { return; } e.ProgressHandler.ReportMessage("Adding Sites to Map..."); var result = e.Result; //We need to reproject the Search results from WGS84 to the projection of the map. ProjectionInfo wgs84 = KnownCoordinateSystems.Geographic.World.WGS1984; foreach (var item in result.ResultItems) { item.FeatureSet.Projection = wgs84; } ShowSearchResults(result); }
private void HandleImageSorterCompleted(object sender, CompletedEventArgs completedEventArgs) { this.stopWatch.Stop(); if (!this.commandLineParser.IsNoPreview) { if (!string.IsNullOrWhiteSpace(completedEventArgs.Directory) && this.systemContext.DirectoryExists(completedEventArgs.Directory)) { ProcessStartInfo startInfo = new ProcessStartInfo(completedEventArgs.Directory) { ErrorDialog = true, UseShellExecute = true, WindowStyle = ProcessWindowStyle.Normal }; this.OnMessageSent(new MessageSentEventArgs(Resources.Info_LaunchingPreview, MessageType.Information)); this.systemContext.StartProcess(startInfo); } else { this.OnMessageSent(new MessageSentEventArgs(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Resources.Warning_FailedToStartPreviewDueToInvalidOutputDirectory, (object)(string.IsNullOrWhiteSpace(completedEventArgs.Directory) ? string.Empty : Path.GetFullPath(completedEventArgs.Directory))), MessageType.Warning)); } } this.RaiseCompletedEvent(completedEventArgs.Summary); }
void pv2_ValidateCompleted(object sender, CompletedEventArgs e) { if (e.Error == null) { _ThreadNum--; ShowMessage("验证列表[" + e.UserState.ToString() + "]", "完成.", ""); Monitor.Enter(_ProxyListOK); _ProxyListOK.AddRange(e.ProxyList); Monitor.Exit(_ProxyListOK); if (_ThreadNum < 1) { ShowMessage("验证列表", "全部完成.", ""); ProxyUtility.SaveProxyList_ToConfig(RemoveExitsProxy(_ProxyListOK), _ProxyListFilePath); ShowMessage("验证列表", "保存到配置成功.", ""); } } else { //TODO ShowMessage("错误", e.Error.Message, ""); } }
void getdbschemaComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Get Database Schema Error", MessageBoxButton.OK); return; } TreeViewItem sourceTable; TreeViewItem destinationTable; tvwItemSourceRoot.Items.Clear(); DatabaseDictionary databaseDictionary = (DatabaseDictionary)args.Data; ConstructTreeView(databaseDictionary, tvwItemSourceRoot); for (int sourceTables = 0; sourceTables < tvwItemSourceRoot.Items.Count; sourceTables++) { sourceTable = (TreeViewItem)tvwItemSourceRoot.Items[sourceTables]; StackPanel sourceStackPanel = (StackPanel)sourceTable.Header; TextBlock sourceTextBlock = (TextBlock)sourceStackPanel.Children[1]; TreeViewItem sourceParent = sourceTable.Parent as TreeViewItem; for (int destTables = 0; destTables < tvwItemDestinationRoot.Items.Count; destTables++) { destinationTable = (TreeViewItem)tvwItemDestinationRoot.Items[destTables]; StackPanel destinationStackPanel = (StackPanel)destinationTable.Header; TextBlock destinationTextBlock = (TextBlock)destinationStackPanel.Children[1]; if (sourceTextBlock.Text == destinationTextBlock.Text) { RemoveTreeItem(sourceParent, sourceTable); sourceTables--; break; } } } biBusyWindow.IsBusy = false; }
private async Task <CompletedEventArgs> StartConnection(DownloadConnection connection, CancellationToken stopToken = default(CancellationToken)) { Debug.WriteLine("Downloading {0:N} bytes file", File.Size); CompletedEventArgs completedEventArgs = null; connection.StatusChanged += (sender, args) => { // ReSharper disable once AccessToDisposedClosure Debug.WriteLine("[Status]\t\t" + connection.Status.ToString()); }; connection.MessageChanged += (sender, args) => { // ReSharper disable once AccessToDisposedClosure Debug.WriteLine("[Message]\t" + connection.Message); }; connection.Completed += (sender, args) => { completedEventArgs = args; }; var sw = new Stopwatch(); sw.Start(); await connection.Start(stopToken); sw.Stop(); Debug.WriteLine("Download ended after {0:F} seconds", sw.Elapsed.TotalSeconds); if (completedEventArgs != null) { Debug.WriteLine("Completed in {0:F} seconds at average speed of {1:N} B/s", (completedEventArgs.Completed - completedEventArgs.Started).TotalSeconds, completedEventArgs.AverageSpeed); } else { Debug.WriteLine("Completed {0} ('{1}')", connection.Status, connection.Message); } return(completedEventArgs); }
void getdbDictionaryComplete(CompletedEventArgs args) { if (args.Error != null) { MessageBox.Show(args.FriendlyErrorMessage, "Get Database Dictionary Error", MessageBoxButton.OK); return; } DatabaseDictionary dict = (DatabaseDictionary)args.Data; if (isPosting) { string project = cbDictionary.SelectedItem.ToString().Split('.')[1]; string application = cbDictionary.SelectedItem.ToString().Split('.')[2]; _dal.PostDictionaryToAdapterService(project, application, dict); } else { tvwItemDestinationRoot.Items.Clear(); _dal.GetDatabaseSchema(dict.connectionString, dict.provider.ToString()); ConstructTreeView(dict, tvwItemDestinationRoot); } }
protected override void OnAfterCompleted(CompletedEventArgs e) { IsBusy = false; base.OnAfterCompleted(e); }
void cb_completed(object sender, CompletedEventArgs e) { Console.WriteLine(e.ErrorMessage); }
protected void OnCompleted(CompletedEventArgs args) { syncContext.Post(delegate(Object _) { if (completed) return; completed = true; if (Completed != null) Completed(this, args); }, null); }
private async Task<ChunkStatus> SendNextChunkAsync(Stream blobStream, int chunkSize, long chunkStart, long bytesTotal) { // Errors will be caught by the caller. var buffer = new byte[chunkSize]; int bytesTransferred = await blobStream.ReadAsync(buffer, 0, chunkSize); this.request = WebRequestCreator.BrowserHttp.Create(uri) as HttpWebRequest; request.Method = "POST"; request.ContentType = "application/octet-stream"; // default request.ContentLength = bytesTransferred; // Set headers foreach (var entry in this.headers) { request.Headers[entry.Key] = entry.Value; } if (headerAccept != null) request.Accept = headerAccept; if (headerContentType != null) request.ContentType = headerContentType; // Set content-range, specially if (headerContentRange != null) { request.Headers["X-MSHACK-Content-Range"] = "" + chunkStart + "-" + (chunkStart + bytesTransferred - 1) + "/" + bytesTotal; } using (Stream sendStream = await request.GetRequestStreamAsync()) { await sendStream.WriteAsync(buffer, 0, bytesTransferred); } HttpStatusCode status; WebHeaderCollection headers; string body; using (HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse) using (Stream responseStream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(responseStream)) { status = response.StatusCode; headers = response.GetRealOrFakeHeaders(); body = await reader.ReadToEndAsync(); } CompletedEventArgs args = new CompletedEventArgs(status, headers, body); return new ChunkStatus(bytesTransferred, args); }
public ChunkStatus(int bytesSent, CompletedEventArgs args) { BytesSent = bytesSent; Args = args; }