Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
        /// <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
        }
Exemplo n.º 3
0
 /// <summary>
 /// Fire the OperationCompleted event
 /// </summary>
 protected void EndOperation()
 {
     if (_cancel)
     {
         return;
     }
     OperationCompleted?.Invoke(this, new EventArgs());
 }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
        /// <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));
        }
Exemplo n.º 6
0
 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());
 }
Exemplo n.º 7
0
 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();
            }
        }
Exemplo n.º 9
0
        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);
            //}
        }
Exemplo n.º 10
0
        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);
            }
        }
Exemplo n.º 11
0
        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);
                }
            }
        }
Exemplo n.º 12
0
 /// <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);
 }
Exemplo n.º 13
0
 protected virtual void OnOperationCompleted(ProgressBackgroundEventArgs e)
 {
     OperationCompleted?.Invoke(this, e);
 }
Exemplo n.º 14
0
 protected virtual void OnOperationCompleted(OperationCompletedEventArgs e)
 {
     OperationCompleted?.Invoke(this, e);
 }
Exemplo n.º 15
0
 protected override void OnDisappearing()
 {
     OperationCompleted?.Invoke(this, EventArgs.Empty);
     base.OnDisappearing();
 }
Exemplo n.º 16
0
 public void Calculate(string operation)
 {
     Number1 = Calculator.Operate(Number1, Number2, operation);
     OperationCompleted?.Invoke();
 }
Exemplo n.º 17
0
 /// <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));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Load Letters
 /// </summary>
 public void LoadLetters()
 {
     OperationCompleted?.Invoke(this, new LetterEventArgs(letters, null, OperationType.Read));
 }
Exemplo n.º 19
0
 private void _queue_OperationCompleted(object sender, FileOperationEventArgs e)
 {
     OperationCompleted?.Invoke(this, e);
 }
Exemplo n.º 20
0
 protected void _backWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     OperationCompleted?.Invoke(this, new OperationCompletedEventArgs(_errorMessageBuilder.ToString()));
 }
Exemplo n.º 21
0
 /// <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);
 }
Exemplo n.º 22
0
 private async void OnDismissButtonClicked()
 {
     OperationCompleted?.Invoke(this, EventArgs.Empty);
     await Navigation.PopModalAsync();
 }
Exemplo n.º 23
0
 protected virtual void RaiseOperationCompleted()
 {
     OperationCompleted?.Invoke(this, new EventArgs());
 }