Esempio n. 1
0
        public async Task RefreshFeedAsync(Feed feed, bool more = false)
        {
            var res = await _api.RefreshFeed(feed.Uri, feed.ShortId, more?feed.Items.NextPage : 0);

            if (string.IsNullOrWhiteSpace(feed.Name))
            {
                // Only update name if we don't have customized name.
                feed.Name = res.Name;
            }
            feed.IconUri        = res.IconUri;
            feed.WebsiteLink    = res.WebsiteLink;
            feed.Description    = res.Description;
            feed.Error          = res.Error;
            feed.Items.NextPage = res.Items.NextPage;

            if (res.Items != null)
            {
                if (!more)
                {
                    feed.Items.Items.Clear();
                }
                feed.Items.Items.AddRange(res.Items.Items);
            }
            RefreshRequested?.Invoke();
        }
Esempio n. 2
0
        private void Scroller_DirectManipulationCompleted(object sender, object e)
        {
            CompositionTarget.Rendering          -= CompositionTarget_Rendering;
            _refreshIndicatorTransform.TranslateY = -_refreshIndicatorBorder.ActualHeight;
            _contentTransform.TranslateY          = 0;

            if (_refreshActivated)
            {
                RefreshRequested?.Invoke(this, new EventArgs());
                if (RefreshCommand != null && RefreshCommand.CanExecute(null))
                {
                    RefreshCommand.Execute(null);
                }
            }

            _refreshActivated      = false;
            _lastRefreshActivation = default(DateTime);

            if (RefreshIndicatorContent == null)
            {
                _defaultIndicatorContent.Text = "Pull to Refresh";
            }

            PullProgressChanged?.Invoke(this, new RefreshProgressEventArgs()
            {
                PullProgress = 0
            });
        }
 private void TestForNavigateRequested(KeyDownEventArgs e)
 {
     if ((e.VirtualKey == VirtualKey.GoBack) ||
         (e.VirtualKey == VirtualKey.NavigationLeft) ||
         (e.VirtualKey == VirtualKey.GamepadMenu) ||
         (e.VirtualKey == VirtualKey.GamepadLeftShoulder) ||
         (e.OnlyAlt && e.VirtualKey == VirtualKey.Back) ||
         (e.OnlyAlt && e.VirtualKey == VirtualKey.Left))
     {
         Debug.WriteLine($"{nameof(GestureService)}.{nameof(BackRequested)}");
         BackRequested?.Invoke(null, EventArgs.Empty);
     }
     else if ((e.VirtualKey == VirtualKey.GoForward) ||
              (e.VirtualKey == VirtualKey.NavigationRight) ||
              (e.VirtualKey == VirtualKey.GamepadRightShoulder) ||
              (e.OnlyAlt && e.VirtualKey == VirtualKey.Right))
     {
         Debug.WriteLine($"{nameof(GestureService)}.{nameof(ForwardRequested)}");
         ForwardRequested?.Invoke(null, EventArgs.Empty);
     }
     else if ((e.VirtualKey == VirtualKey.Refresh) ||
              (e.VirtualKey == VirtualKey.F5))
     {
         Debug.WriteLine($"{nameof(GestureService)}.{nameof(RefreshRequested)}");
         RefreshRequested?.Invoke(null, EventArgs.Empty);
     }
 }
        /// <summary>
        /// Method called at the end of manipulation to clean up everything
        /// </summary>
        private void OnManipulationCompleted()
        {
            CompositionTarget.Rendering          -= CompositionTarget_Rendering;
            _refreshIndicatorTransform.TranslateY = -_refreshIndicatorBorder.ActualHeight;
            if (_contentTransform != null)
            {
                _contentTransform.TranslateY = 0;
            }

            if (_refreshActivated)
            {
                RefreshRequested?.Invoke(this, new EventArgs());
                if (RefreshCommand != null && RefreshCommand.CanExecute(null))
                {
                    RefreshCommand.Execute(null);
                }
            }

            _lastOffset            = 0;
            _pullDistance          = 0;
            _refreshActivated      = false;
            _lastRefreshActivation = default(DateTime);

            PullProgressChanged?.Invoke(this, new RefreshProgressEventArgs {
                PullProgress = 0
            });
        }
Esempio n. 5
0
 protected override void OnChildrenRequested()
 {
     if (m_requiresRefresh)
     {
         m_requiresRefresh = false;
         RefreshRequested.Raise(this, EventArgs.Empty);
     }
 }
Esempio n. 6
0
 public void MarkFeedAllItemsAsReadedAsync(Feed feed)
 {
     if (feed.Items != null && feed.Items.Items.Count > 0)
     {
         _ = _api.MarkAsReaded(feed.Uri, feed.Items.Items[0].PubDate);
         feed.Items.Items.ForEach(i => i.IsReaded = true);
         RefreshRequested?.Invoke();
     }
 }
        public void SubmitOrder()
        {
            facade.BatchOrder(SelectedProductIds, OrderedQuantity);

            OrderedQuantity = 0;
            IsDisplayed     = false;
            SelectedProductIds.Clear();

            RefreshRequested?.Invoke();
        }
        /// <summary>
        /// 结束后重置各值
        /// </summary>
        private void OnCompleted()
        {
            // CompositionTarget.Rendering -= CompositionTarget_Rendering;
            double delta = _contentTransform.TranslateY;

            if (delta > 50)
            {
                RefreshRequested?.Invoke(this, new EventArgs());
            }
            DisplayContent();
        }
Esempio n. 9
0
 private void RefreshContainer_RefreshRequested(object sender, Microsoft.UI.Xaml.Controls.RefreshRequestedEventArgs args)
 {
     using (var deferral = args.GetDeferral())
     {
         RefreshRequested?.Invoke(this, EventArgs.Empty);
         if (RefreshCommand != null && RefreshCommand.CanExecute(null))
         {
             RefreshCommand.Execute(null);
         }
     }
 }
Esempio n. 10
0
        public void AddMessage(Alert alert)
        {
            Messages.Add(alert);
            Console.WriteLine("Message count: {0}", Messages.Count);
            RefreshRequested?.Invoke();

            // pop message off after a delay
            _ = new System.Threading.Timer((_) => {
                Messages.RemoveAt(0);
                RefreshRequested?.Invoke();
            }, null, 8000, System.Threading.Timeout.Infinite);
        }
Esempio n. 11
0
        public void SendMessage(string message, ToastType toastType = ToastType.Success)
        {
            Message   = message;
            IsShow    = true;
            ToastType = toastType;

            RefreshRequested?.Invoke();

            new System.Threading.Timer((_) =>
            {
                this.IsShow = false;
                RefreshRequested?.Invoke();
            }, null, 5000, System.Threading.Timeout.Infinite);
        }
        private void FireRefresh()
        {
            var e = new RefreshRequestedEventArgs(() => CompleteRefresh());

            RefreshRequested?.Invoke(this, e);
            if (e.Cancel)
            {
                return;
            }
            _isRefreshing = true;
            if (!e.IsDeferred)
            {
                CompleteRefresh();
            }
        }
        /// <summary>
        /// Method called at the end of manipulation to clean up everything
        /// </summary>
        private void OnManipulationCompleted()
        {
            CompositionTarget.Rendering          -= CompositionTarget_Rendering;
            _refreshIndicatorTransform.TranslateY = -_refreshIndicatorBorder.ActualHeight;
            if (_contentTransform != null)
            {
                _contentTransform.TranslateY = 0;

                if (_headerTransform != null)
                {
                    _headerTransform.TranslateY = 0;
                }

                if (_footerTransform != null)
                {
                    _footerTransform.TranslateY = 0;
                }
            }

            if (_refreshActivated)
            {
                RefreshRequested?.Invoke(this, EventArgs.Empty);
                if (RefreshCommand != null && RefreshCommand.CanExecute(null))
                {
                    RefreshCommand.Execute(null);
                }
            }
            else if (_refreshIntentCanceled)
            {
                RefreshIntentCanceled?.Invoke(this, EventArgs.Empty);
                if (RefreshIntentCanceledCommand != null && RefreshIntentCanceledCommand.CanExecute(null))
                {
                    RefreshIntentCanceledCommand.Execute(null);
                }
            }

            _lastOffset              = 0;
            _pullDistance            = 0;
            _refreshActivated        = false;
            _refreshIntentCanceled   = false;
            _lastRefreshActivation   = default(DateTime);
            _isManipulatingWithMouse = false;

            PullProgressChanged?.Invoke(this, new RefreshProgressEventArgs {
                PullProgress = 0
            });
            _pullAndReleaseIndicatorContent.Content = null;
        }
        public async Task Upload()
        {
            if (UploadedFiles.Files.Any())
            {
                var file = UploadedFiles.Files.First();

                using (var stream = uploadedFileStorage.GetFile(file.FileId))
                {
                    await ordersApi.ApiOrdersDocumentByIdPostAsync(OrderId, Type, new FileParameter(stream, file.FileName));
                }
            }

            Hide();

            await RefreshRequested?.Invoke();
        }
        public WorkspaceInstallerModulesView() : base()
        {
            ToolBoxAvailable = true;
            Order            = 0;
            Title            = "Installer Modules";
            Icon             = null;

            designer.DuplicateToolStripButton.Click  += (s_, e_) => DuplicateRequested?.Invoke(this, EventArgs.Empty);
            designer.DeleteToolStripButton.Click     += (s_, e_) => DeleteRequested?.Invoke(this, EventArgs.Empty);
            designer.MoveUpToolStripButton.Click     += (s_, e_) => MoveUpRequested?.Invoke(this, EventArgs.Empty);
            designer.MoveDownToolStripButton.Click   += (s_, e_) => MoveDownRequested?.Invoke(this, EventArgs.Empty);
            designer.RefreshToolStripButton.Click    += (s_, e_) => RefreshRequested?.Invoke(this, EventArgs.Empty);
            designer.InstallAllToolStripButton.Click += (s_, e_) => ProceedRequested?.Invoke(this, EventArgs.Empty);

            designer.DataGridView1.SelectionChanged       += DataGridView_SelectionChanged;
            designer.DataGridView1.CellPainting           += DataGridView_CellPainting;
            designer.DataGridView1.CellContentClick       += DataGridView_CellContentClick;
            designer.SingleClickInstallButtonTimer.Tick   += SingleClickInstallButtonTimer_Tick;
            designer.DataGridView1.CellContentDoubleClick += DataGridView_CellContentDoubleClick;
        }
        private async Task StartLoadingAnimationAndRequestRefreshAsync(Action completed)
        {
            // Create a short delay to allow the expression rotation animation to smoothly transition
            // to the new keyframe animation.
            await Task.Delay(100);

            _refreshIconVisual.StartAnimation("RotationAngleInDegrees", _loadingAnimation);

            // When using the event...
            if (RefreshRequested != null)
            {
                var e = new RefreshRequestedEventArgs(new DeferralCompletedHandler(completed));
                RefreshRequested.Invoke(this, e);
            }

            // When using the command...
            if (RefreshCommand != null)
            {
                try
                {
                    _cts?.Cancel();
                    _cts = new CancellationTokenSource();

                    _pendingRefreshTask = DoCancellableRefreshTaskAsync(_cts.Token);
                    await _pendingRefreshTask;
                }
                catch (OperationCanceledException)
                {
                }

                if (_cts != null && !_cts.IsCancellationRequested)
                {
                    completed();
                }
            }
        }
Esempio n. 17
0
        protected void Refresh()
        {
            Log.Debug("Demo", "Enter");

            RefreshRequested?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 18
0
 public void CallRequestRefresh()
 {
     RefreshRequested?.Invoke();
 }
Esempio n. 19
0
 protected void OnRefreshRequested()
 {
     RefreshRequested?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 20
0
 private void OnSourceLoaded(ISpriteSource obj)
 {
     RefreshRequested?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 21
0
 public void RaiseRefreshBackRequested() => RefreshRequested?.Invoke(this, EventArgs.Empty);
 public void RefreshAppointments(List <AppointmentDto> appointments)
 {
     Appointments = appointments;
     RefreshRequested?.Invoke();
 }
Esempio n. 23
0
 /// <summary>
 /// Fires the request event to refresh the issues
 /// </summary>
 public void FireRefreshRequestedEvent()
 {
     RefreshRequested?.Invoke(this, new IssueRefreshEventArgs());
 }
Esempio n. 24
0
 public static void RequestPageRefresh() => RefreshRequested?.Invoke();
Esempio n. 25
0
 private void Refresh_Click(object sender, RoutedEventArgs e)
 {
     RefreshRequested?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 26
0
 public bool RaiseRefreshRequested() => IfCanRaiseEvent(Gesture.Refresh, () => RefreshRequested?.Invoke(this, EventArgs.Empty));
 partial void RefreshClicked(NSObject sender)
 {
     RefreshRequested?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 28
0
 /// <summary>
 /// Refreshes the dropzone and all items within. This is neded in case of adding items to the collection or changed values of items
 /// </summary>
 public void Refresh() => RefreshRequested?.Invoke(this, EventArgs.Empty);
Esempio n. 29
0
 public void RequestRefresh() => RefreshRequested?.Invoke();
Esempio n. 30
0
 internal void InvokeRefresh()
 {
     RefreshRequested?.Invoke(this, null);
 }