Esempio n. 1
0
        public Task PushAsync(PopupPage page, bool animate = true)
        {
            lock (_locker)
            {
                if (_popupStack.Contains(page))
                {
                    return(Task.CompletedTask);
                }

                _popupStack.Add(page);

                var task = InvokeThreadSafe(async() =>
                {
                    animate = CanBeAnimated(animate);

                    if (animate)
                    {
                        page.PreparingAnimation();
                        await AddAsync(page);
                        await page.AppearingAnimation();
                    }
                    else
                    {
                        await AddAsync(page);
                    }

                    page.AppearingTransactionTask = null;
                });
                page.AppearingTransactionTask = task;
                Pushed?.Invoke(this, new NavigationEventArgs(page));
                return(task);
            }
        }
Esempio n. 2
0
        async Task PushAsyncInner(Page page, bool animated)
        {
            if (InternalChildren.Contains(page))
            {
                return;
            }

            PushPage(page);

            var args = new NavigationRequestedEventArgs(page, animated);

            EventHandler <NavigationRequestedEventArgs> requestPush = PushRequested;

            if (requestPush != null)
            {
                requestPush(this, args);

                if (args.Task != null)
                {
                    await args.Task;
                }
            }

            Pushed?.Invoke(this, args);
        }
Esempio n. 3
0
 /// <inheritdoc/>
 public Task PushAsync(PopupPage page, bool animate = true)
 {
     Pushing?.Invoke(this, new PopupNavigationEventArgs(page, animate));
     _stack.Push(page);
     Pushed?.Invoke(this, new PopupNavigationEventArgs(page, animate));
     return(Task.CompletedTask);
 }
 private void Enc0Falling(object sender, PinValueChangedEventArgs pinValueChangedEventArgs)
 {
     Enc0Deboucer.Debouce(() => {
         Pushed?.Invoke(this, new EventArgs());
         //Console.WriteLine("ENC0 push");
     });
 }
Esempio n. 5
0
        public AsyncBuffer(int boundedCapacity, TimeSpan sample)
        {
            var buffer = new BroadcastBlock <Action>(n => n, new DataflowBlockOptions()
            {
                BoundedCapacity = boundedCapacity
            });

            _StartProcessDisposable = _StartProcessSubject
                                      .Subscribe(a => buffer.SendAsync(a)
                                                 , exc => Error.OnNext(exc));
            var b = buffer
                    .AsObservable();

            if (sample != TimeSpan.Zero)
            {
                b = b.Sample(sample);
            }
            _bufferDisposable = b
                                .SubscribeOn(NewThreadScheduler.Default)
                                .Subscribe(a => {
                try {
                    a();
                    Pushed.OnNext(_lastContext);
                } catch (Exception exc) {
                    Error.OnNext(exc);
                }
            }, exc => Error.OnNext(exc));
        }
Esempio n. 6
0
 public void OnPushed(Unit emeny)
 {
     _rigidbody.isKinematic = false;
     _enemy = emeny;
     Pushed?.Invoke();
     StartCoroutine(OnStandUpDelay());
 }
Esempio n. 7
0
 private void repeatTimer_Tick(object sender, EventArgs e)
 {
     if (Pushed != null && pressed)
     {
         Pushed.Invoke(this, new EventArgs());
     }
     repeatTimer.Interval = 150;
     repeatTimer.Enabled  = true;
 }
Esempio n. 8
0
    protected virtual void OnPushed()
    {
        Pushed?.Invoke();
        var currentTile = LayerManager.Instance.CurrentLayer?.GetTileAtPosition(CurrentPosition);

        if (currentTile == null)
        {
            OnEmptyPlaceReached();
        }
    }
Esempio n. 9
0
 private void ArrowButton_MouseDown(object sender, MouseEventArgs e)
 {
     pressed = true;
     if (Pushed != null)
     {
         Pushed.Invoke(this, new EventArgs());
     }
     repeatTimer.Interval = 400;
     repeatTimer.Enabled  = true;
     Refresh();
 }
Esempio n. 10
0
        public void Enqueue(T value)
        {
            var node     = new Node <T>(value);
            var prevNode = _tail;

            _tail = node;
            if (Count == 0)
            {
                _head = _tail;
            }
            else
            {
                prevNode.NextNode = _tail;
            }
            Count++;
            Pushed?.Invoke(this, new PushToQueueEventArgs <T>(value, $"{value} pushed"));
        }
        async Task SendHandlerUpdateAsync(bool animated, bool push = false, bool pop = false, bool popToRoot = false)
        {
            // Wait for any pending navigation tasks to finish
            await WaitForCurrentNavigationTask();

            var completionSource = new TaskCompletionSource <object>();

            CurrentNavigationTask = completionSource.Task;
            _taskCompletionSource = completionSource;

            // We create a new list to send to the handler because the structure backing
            // The Navigation stack isn't immutable
            var previousPage             = CurrentPage;
            var immutableNavigationStack = new List <IView>(NavigationStack);

            // Alert currently visible pages that navigation is happening
            SendNavigating();

            // Create the request for the handler
            var request = new NavigationRequest(immutableNavigationStack, animated);

            ((INavigationView)this).RequestNavigation(request);

            // Wait for the handler to finish processing the navigation
            await completionSource.Task;

            // Send navigated event to currently visible pages and associated navigation event
            SendNavigated(previousPage);
            if (push)
            {
                Pushed?.Invoke(this, new NavigationEventArgs(CurrentPage));
            }
            else if (pop)
            {
                Popped?.Invoke(this, new NavigationEventArgs(previousPage));
            }
            else
            {
                PoppedToRoot?.Invoke(this, new NavigationEventArgs(previousPage));
            }
        }
Esempio n. 12
0
        private void PushActivity(Cursor cursor)
        {
            if (cursor.PrimaryPush)
            {
                float worldX = cursor.GetWorldX(managers);
                float worldY = cursor.GetWorldY(managers);

                var sideOver = GetSideOver(
                    worldX,
                    worldY);


                mSideGrabbed = sideOver;

                if (mSideGrabbed != ResizeSide.None)
                {
                    Pushed?.Invoke(this, null);
                    StartRegionChanged?.Invoke(this, null);
                }
            }
        }
        public Task PushAsync(PopupPage page, bool animate = true)
        {
            lock (_locker)
            {
                if (_popupStack.Contains(page))
                {
                    return(Task.CompletedTask);
                    //throw new InvalidOperationException("The page has been pushed already. Pop or remove the page before to push it again");
                }

                Pushing?.Invoke(this, new PopupNavigationEventArgs(page, animate));

                _popupStack.Add(page);

                var task = InvokeThreadSafe(async() =>
                {
                    animate = CanBeAnimated(animate);

                    if (animate)
                    {
                        page.PreparingAnimation();
                        await AddAsync(page);
                        await page.AppearingAnimation();
                    }
                    else
                    {
                        await AddAsync(page);
                    }

                    page.AppearingTransactionTask = null;

                    Pushed?.Invoke(this, new PopupNavigationEventArgs(page, animate));
                });

                page.AppearingTransactionTask = task;

                return(task);
            }
        }
 private void RaisePushed(IEnumerable <string> changes)
 {
     Pushed?.Invoke(this, new DataEventArgs <IEnumerable <string> >(changes));
 }
Esempio n. 15
0
 public override void OnPush(MachineId machineId, string currentStateName, string newStateName)
 {
     base.OnPush(machineId, currentStateName, newStateName);
     Pushed?.Invoke(machineId, currentStateName, newStateName);
 }
Esempio n. 16
0
 public void Push(string message)
 {
     Pushed?.Invoke(this, message);
 }
Esempio n. 17
0
 public void BackgroundPush()
 {
     Pushed?.Invoke();
 }
Esempio n. 18
0
 public new T Push(T item)
 {
     base.Push(item);
     Pushed?.Invoke(item, EventArgs.Empty);
     return(item);
 }
Esempio n. 19
0
 public IDisposable Push(T item)
 {
     _stack.Push(item);
     Pushed?.Invoke(item);
     return(this);
 }