Exemple #1
0
 private void UpdaterWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (active)
     {
         Cancelled?.Invoke(sender, e);
     }
 }
Exemple #2
0
        private void WebClientOnDownloadFileCompleted(object sender, AsyncCompletedEventArgs asyncCompletedEventArgs)
        {
            if (asyncCompletedEventArgs.Cancelled)
            {
                if (Exists())
                {
                    Delete();
                }
                Cancelled?.Invoke(this, new EventArgs());
                return;
            }

            if (asyncCompletedEventArgs.Error != null)
            {
                DownloadFailed?.Invoke(this, new DownloadFailEvent(asyncCompletedEventArgs.Error));

                AppLogger.Log.Error("Problem downloading file ", asyncCompletedEventArgs.Error);
                return;
            }


            if (Exists())
            {
                Downloaded?.Invoke(this, new EventArgs());
            }
        }
Exemple #3
0
        public void Move(bool d)
        {
            var s = d ? Current.Finish() : Current.Cancel();

            if (s == 0)
            {
                return;
            }
            Progress += s;
            if (Progress < 0)
            {
                Progress = 0;
                Cancelled?.Invoke(this, EventArgs.Empty);
                return;
            }
            if (Progress > Steps.Count - 1)
            {
                Progress = Steps.Count - 1;
                Finished?.Invoke(this, EventArgs.Empty);
                return;
            }
            Current.Init(s);
            if (Current.WillRecreate)
            {
                var type = Current.GetType();
                Steps[Progress] = new Lazy <Step>(() => (Step)Activator.CreateInstance(type));
                Current.Init(s);
            }
        }
Exemple #4
0
        private void InterstitialAdInterstitialAdMain_Cancelled(object sender, object e)
        {
            // Events
            HockeyClient.Current.TrackEvent("Ads cancelled");

            Cancelled?.Invoke();
        }
Exemple #5
0
 private void UpdaterWindow_DeleteEvent(object o, DeleteEventArgs args)
 {
     if (active)
     {
         Cancelled?.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #6
0
 /// <summary>Когда операция отменяется</summary>
 /// <param name="e">Аргумент события</param>
 protected virtual void OnCancelled(EventArgs?e)
 {
     if (!_IsDisposed)
     {
         Cancelled?.Invoke(this, e ?? EventArgs.Empty);
     }
 }
        private void Tick(object state)
        {
            var position = _gazePointProvider.CurrentPosition;

            if (position == null)
            {
                return;
            }
            var pNew = position.Value;
            var now  = _clock.Time;

            if (_point == null)
            {
                _point = new Timestamped <Point>(now, pNew);
                return;
            }
            var pOld = _point.Value.Value;

            if (Math.Abs(pOld.X - pNew.X) + Math.Abs(pOld.Y - pNew.Y) > _cursorMovementTolerance)
            {
                _point = new Timestamped <Point>(now, pNew);
                if (_cancellable && _inTrial)
                {
                    Cancelled?.Invoke(this, EventArgs.Empty);
                }
                return;
            }
            if (_inTrial || _clock.Unit.ToMilliseconds(Math.Abs(now - _point.Value.Timestamp)) < _dwellToSelectDelay)
            {
                return;
            }
            _point   = new Timestamped <Point>(now, pNew);
            _inTrial = true;
            Triggered?.Invoke(this, EventArgs.Empty);
        }
Exemple #8
0
 public void Cancel()
 {
     if (Stop())
     {
         OnCancelled();
         Cancelled?.Invoke(this);
     }
 }
 /// <summary>
 /// Triggers the <see cref="Cancelled"/> event.
 /// </summary>
 /// <param name="args">Authorization operation arguments.</param>
 /// <param name="authzUri">The full Uri used for calling the authorization endpoint.</param>
 protected void OnCancelled(A args, Uri authzUri)
 {
     Cancelled?.Invoke(this, new AuthorizationCancelledEventArgs()
     {
         AuthzArgs = args,
         AuthzUri  = authzUri
     });
 }
 private void OnCancelled()
 {
     if (AcquiringUI.AreHardwareButtonsAvailable)
     {
         HardwareButtons.BackPressed -= OnBackPressed;
     }
     Cancelled?.Invoke();
 }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void OnCancelled()
        {
            count        = 0;
            previousTask = Task.FromResult(true);
            tokenSource  = new CancellationTokenSource();

            Cancelled?.Invoke(this, new EventArgs());
        }
Exemple #12
0
 private void _progressDialog_Cancelled(object sender, EventArgs e)
 {
     if (Cancelled != null)
     {
         Cancelled.Invoke(this, null);                 //REVIEW jh wesay
     }
     _currentCommand.Cancel();
 }
Exemple #13
0
        public async Task Cancel()
        {
            await Plugin.Geolocator.CrossGeolocator.Current.StopListeningAsync();

            await Reset();

            Cancelled?.Invoke(this, EventArgs.Empty);
        }
Exemple #14
0
        /// <summary>
        ///    Cancels the FlightTask.
        /// </summary>
        public void Cancel()
        {
            Assert.AreEqual(State, FlightTaskState.Active, "Attempted to cancel inactive FlightTask.");

            State = FlightTaskState.Cancelled;
            Cancelled?.Invoke(this);

            Invalidate();
        }
Exemple #15
0
 private void bCancel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to cancel?", "Cancel", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         bCancel.Enabled = false;
         this.Text       = "Cancelling...";
         Cancelled?.Invoke(this, new CancelEventArgs(true));
     }
 }
Exemple #16
0
        private void CancelBtn_Click(object sender, EventArgs e)
        {
            // Set some property values
            Cancelling        = true;
            labelContent.Text = "Aborting operation...";

            // Call cancel event
            Cancelled?.Invoke(this, null);
        }
Exemple #17
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (_possibleMultiJump)
     {
         MultiJumpCancelled?.Invoke();
     }
     else
     {
         Cancelled?.Invoke();
     }
 }
        public void Cancel()
        {
            if (Status == ProductSubscriptionStatus.Cancelled)
            {
                throw new ProductSubscriptionWasAlreadyCancelledException();
            }

            Status = ProductSubscriptionStatus.Cancelled;

            Cancelled?.Invoke(this, new ProductSubscriptionCancelledEventArgs());
        }
Exemple #19
0
        public IDownloadTask GetFetchEntriesSinceTask(DateTime startDate, CancellationToken cancellationToken)
        {
            var random       = new Random(DateTime.Now.Millisecond);
            var delay        = random.Next(0, 26) / 10d;
            var downloadTask = new MockDownloadTask(TimeSpan.FromSeconds(delay), startDate, posts => {
                Success?.Invoke(this, new ServerSuccessEventArgs(posts));
            }, () => {
                Cancelled?.Invoke(this, new EventArgs());
            }, cancellationToken);

            return(downloadTask);
        }
        public async void Cancel()
        {
            if (Busy)
            {
                return;
            }

            Busy = true;

            Cancelled?.Invoke(this, EventArgs.Empty);
            Device.StartTimer(TimeSpan.FromSeconds(1), Wait);
        }
Exemple #21
0
        private async void PointAnimation_Cancelled(object sender, EventArgs e)
        {
            try
            {
                await _calibrator.CancelAsync();
            }
            catch (Exception ex)
            {
                // TODO ex
            }

            Cancelled?.Invoke(this, EventArgs.Empty);
        }
        private void SingleBasicConsumerCancelled(BasicConsumer consumer)
        {
            if (cancelledConsumer == null)
            {
                cancelledConsumer = new HashSet <BasicConsumer>();
            }
            cancelledConsumer.Add(consumer);

            if (cancelledConsumer.Count == basicConsumers.Count)
            {
                cancelledConsumer = null;
                Cancelled?.Invoke(this);
            }
        }
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            PlayerIndex playerIndex;

            if (menuSelect.Occurred(input, ControllingPlayer, out playerIndex))
            {
                Accepted?.Invoke(this, new PlayerIndexEventArgs(playerIndex));
                ExitScreen();
            }
            else if (menuCancel.Occurred(input, ControllingPlayer, out playerIndex))
            {
                Cancelled?.Invoke(this, new PlayerIndexEventArgs(playerIndex));
                ExitScreen();
            }
        }
 private void pass_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key.Equals(Key.Enter))
     {
         if (pass.Password.Equals("neuronaware"))
         {
             pass.Password = null;
             Succeeded?.Invoke(sender, e);
         }
         else
         {
             Cancelled?.Invoke(sender, e);
             pass.Password = null;
             MessageBox.Show("비밀번호가 일치하지 않습니다.");
         }
     }
 }
Exemple #25
0
 public override void HandleInput(GameTime gameTime, InputState input)
 {
     // We pass in our ControllingPlayer, which may either be null (to
     // accept input from any player) or a specific index. If we pass a null
     // controlling player, the InputState helper returns to us which player
     // actually provided the input. We pass that through to our Accepted and
     // Cancelled events, so they can tell which player triggered them.
     if (_menuSelect.Occurred(input, ControllingPlayer, out var playerIndex))
     {
         Accepted?.Invoke(this, new PlayerIndexEventArgs(playerIndex));
         ExitScreen();
     }
     else if (_menuCancel.Occurred(input, ControllingPlayer, out playerIndex))
     {
         Cancelled?.Invoke(this, new PlayerIndexEventArgs(playerIndex));
         ExitScreen();
     }
 }
        public void Cancel()
        {
            PeerInfo current = Current;

            if (current == null)
            {
                return;
            }

            lock (_allocationLock)
            {
                current.IsAllocated = false;
                Current             = null;
            }

            AllocationChangeEventArgs args = new AllocationChangeEventArgs(current, null);

            Cancelled?.Invoke(this, args);
        }
        private void bCancel_Click(object sender, EventArgs e)
        {
            if (bCancel.Text == "Close")
            {
                Close();
                return;
            }

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Error);
            }

            if (MessageBox.Show("Are you sure you want to cancel?", "Cancel", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                bCancel.Enabled = false;
                Text            = "Cancelling...";
                Cancelled?.Invoke(this, new CancelEventArgs(true));
            }
        }
Exemple #28
0
        // Handle Input

        /// Responds to user input, accepting or cancelling the message box.
        public override void HandleInput()
        {
            if (InputManager.IsActionTriggered(InputManager.Action.Ok))
            {
                // Raise the accepted event, then exit the message box.
                Accepted?.Invoke(this, EventArgs.Empty);

                AudioManager.PlayCue("closeWindow");

                ExitScreen();
            }
            else if (InputManager.IsActionTriggered(InputManager.Action.Back))
            {
                // Raise the cancelled event, then exit the message box.
                Cancelled?.Invoke(this, EventArgs.Empty);

                AudioManager.PlayCue("closeWindow");

                ExitScreen();
            }
        }
Exemple #29
0
        private void MouseClick(object sender, MouseEventArgs e)
        {
            _count++;

            if (_count == 2 && e.Button == MouseButtons.Right)
            {
                // cancela a criação de linhas
                // acesso condicional invoke só é chamado se Cancelled não foi nulo
                Cancelled?.Invoke(this, EventArgs.Empty);
                return;
            }

            switch (_count)
            {
            case 1:
                _line.InitialPoint = e.Location;
                break;

            case 2:     // terminou de desenhar a linha
                _line.EndPoint = e.Location;
                Finished?.Invoke(this, EventArgs.Empty);
                break;
            }
        }
Exemple #30
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            PlayerIndex playerIndex = PlayerIndex.One;

            // We pass in our ControllingPlayer, which may either be null (to
            // accept input from any player) or a specific index. If we pass a null
            // controlling player, the InputState helper returns to us which player
            // actually provided the input. We pass that through to our Accepted and
            // Cancelled events, so they can tell which player triggered them.
            if (menuSelect?.Evaluate(input, ControllingPlayer, out playerIndex) ?? false)
            {
                // Raise the accepted event, then exit the message box.
                Accepted?.Invoke(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
            else if (menuCancel?.Evaluate(input, ControllingPlayer, out playerIndex) ?? false)
            {
                // Raise the cancelled event, then exit the message box.
                Cancelled?.Invoke(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
        }