/// <summary> /// Remove Letter /// </summary> /// <param name="letter">Letter</param> public void RemoveLetter(Letter letter) { Letter letterToRemove = letters.Single(b => b.LetterID == letter.LetterID); letters.Remove(letterToRemove); OperationCompleted?.Invoke(this, new LetterEventArgs(letters, null, OperationType.Delete)); }
/// <inheritdoc /> Task IRawGraphClient.ExecuteCypherAsync(CypherQuery query) { var tx = ExecutionContext.Begin(this); if (Driver == null) { throw new InvalidOperationException("Can't execute cypher unless you have connected to the server."); } if (InTransaction) { return(transactionManager.EnqueueCypherRequest($"The query was: {query.QueryText}", this, query) .ContinueWith(responseTask => OperationCompleted?.Invoke(this, new OperationCompletedEventArgs { QueryText = $"BOLT:{query.QueryText}" }))); } using (var session = Driver.Session(query.IsWrite ? AccessMode.Write : AccessMode.Read)) { session.Run(query, this); } tx.Complete(query); #if NET45 return(Task.FromResult(0)); #else return(Task.CompletedTask); #endif }
/// <summary> /// Fire the OperationCompleted event /// </summary> protected void EndOperation() { if (_cancel) { return; } OperationCompleted?.Invoke(this, new EventArgs()); }
private void DetailsAnimationClose_Completed(object sender, EventArgs e) { var parent = _userControlDetails.Parent as Canvas; parent.Children.Remove(_userControlDetails); _userControlDetails.DetailsClose.Completed -= DetailsAnimationClose_Completed; _userControlDetails = null; OperationCompleted?.Invoke(this, new EventArgs()); }
/// <summary> /// Update Letter /// </summary> /// <param name="letter">Letter</param> public void UpdateLetter(Letter letter) { Letter letterToUpdate = letters.Where(i => i.LetterID == letter.LetterID).First(); int index = letters.IndexOf(letterToUpdate); if (index != -1) { letters[index] = letter; } OperationCompleted?.Invoke(this, new LetterEventArgs(letters, letter, OperationType.Update)); }
private void DetailsAnimationOpen_Completed(object sender, EventArgs e) { mainBorder.CornerRadius = new CornerRadius(8, 0, 0, 0); mainBorder.BorderThickness = new Thickness(1, 1, 0, 0); _userControlDetails.DetailsOpen.Completed -= DetailsAnimationOpen_Completed; foreach (var attachment in _userControlDetails.attachmentsGrid.Children) { (attachment as AttachmentButton).ShowAttachment.Begin(); } OperationCompleted?.Invoke(this, new EventArgs()); }
private async void saveButton_Click(object sender, RoutedEventArgs e) { if (isNew) { await productCommandService.AddProductAsync(Product); } else { await productCommandService.UpdateProductAsync(Product); } OperationCompleted?.Invoke(this, new EventArgs()); }
private async void RunOperation() { while (true) { FileOperationBase operation; lock (((ICollection)_queue).SyncRoot) { if (_currentOperation != null) { return; } if (_queue.Count == 0) { return; } operation = _queue.Dequeue(); if (operation.IsAborted) { continue; } _currentOperation = operation; } var success = await operation.Execute(); lock (((ICollection)_queue).SyncRoot) { _currentOperation = null; if (!operation.IsAborted) { if (!success) { if (operation.TryCount > 0) { _queue.Enqueue(operation); } } } } if (!success) { Thread.Sleep(500); continue; } OperationCompleted?.Invoke(this, new FileOperationEventArgs(operation)); operation.Dispose(); } }
private void _slideStoryBoard_Completed(object sender, object e) { //Set the IsShowingMinimizedView to true on Animation completed when minimized as untill it's done the Grid is not yet minimized if (this.IsMinimized) { this.IsShowingMinimizedView = true; } //for c# 6.0 use this: OperationCompleted?.Invoke(this, CurrentElement); //for c# before 6.0 comment the above and Uncomment this: //if(OperationCompleted!=null) //{ // OperationCompleted(this, CurrentElement); //} }
private void ProcessTaskResult <TResult>(Task <TResult> task, Action <Exception, TResult> completeAction, AsyncOperationType type) { if (task.IsFaulted && task.Exception != null) { // TODO: move this code into OperationCompleted registered by a Form to isolate it from UTing. ShowExceptionCarefully(task.Exception); } try { OperationCompleted?.Invoke(this, new PriceEventArgs <AsyncOperationType>(type)); completeAction?.Invoke(task.Exception, task.Exception == null ? task.Result : default(TResult)); } catch (Exception e) { ShowExceptionCarefully(e); } }
protected void SetProcessing(bool processing) { bool oldProcessing = this.processing; this.processing = processing; SetEnabled(); if (processing) { if (!oldProcessing) { OperationStarted?.Invoke(this, null); } } else { if (oldProcessing) { OperationCompleted?.Invoke(this, null); } } }
/// <summary> /// Invokes the <see cref="OperationCompleted"/> event. /// </summary> /// <param name="args"> /// The arguments to provide in the raised event. /// </param> protected virtual void OnOperationCompleted(OperationTraceCompletedArgs <TContent> args) { OperationCompleted?.Invoke(this, args); }
protected virtual void OnOperationCompleted(ProgressBackgroundEventArgs e) { OperationCompleted?.Invoke(this, e); }
protected virtual void OnOperationCompleted(OperationCompletedEventArgs e) { OperationCompleted?.Invoke(this, e); }
protected override void OnDisappearing() { OperationCompleted?.Invoke(this, EventArgs.Empty); base.OnDisappearing(); }
public void Calculate(string operation) { Number1 = Calculator.Operate(Number1, Number2, operation); OperationCompleted?.Invoke(); }
/// <summary> /// Add new Letter /// </summary> /// <param name="letter">Letter</param> public void AddLetter(Letter letter) { letters.Add(letter); OperationCompleted?.Invoke(this, new LetterEventArgs(null, null, OperationType.Read)); }
/// <summary> /// Load Letters /// </summary> public void LoadLetters() { OperationCompleted?.Invoke(this, new LetterEventArgs(letters, null, OperationType.Read)); }
private void _queue_OperationCompleted(object sender, FileOperationEventArgs e) { OperationCompleted?.Invoke(this, e); }
protected void _backWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { OperationCompleted?.Invoke(this, new OperationCompletedEventArgs(_errorMessageBuilder.ToString())); }
/// <summary>Raises the <see cref="OperationCompleted"/> event.</summary> /// <param name="args">The instance of <see cref="OperationCompletedEventArgs"/> to send to listeners.</param> protected void OnOperationCompleted(OperationCompletedEventArgs args) { OperationCompleted?.Invoke(this, args); }
private async void OnDismissButtonClicked() { OperationCompleted?.Invoke(this, EventArgs.Empty); await Navigation.PopModalAsync(); }
protected virtual void RaiseOperationCompleted() { OperationCompleted?.Invoke(this, new EventArgs()); }