コード例 #1
0
ファイル: ShellViewModel.cs プロジェクト: jstcyr/Poe-Lurker
        /// <summary>
        /// Updates this instance.
        /// </summary>
        private async Task CheckForUpdate()
        {
            var updateManager = IoC.Get <UpdateManager>();

            this.NeedUpdate = await updateManager.CheckForUpdate();

            if (this.NeedUpdate)
            {
                var message = new ManaBulbMessage()
                {
                    View   = new UpdateViewModel(UpdateState.NeedUpdate),
                    Action = () => this.Update(),
                };

                this._eventAggregator.PublishOnUIThread(message);
                return;
            }

            if (this._showUpdateSuccess)
            {
                this._showUpdateSuccess = false;
                this._eventAggregator.PublishOnUIThread(new ManaBulbMessage()
                {
                    View = new UpdateViewModel(UpdateState.Success), DisplayTime = TimeSpan.FromSeconds(5)
                });
            }
        }
コード例 #2
0
ファイル: ShellViewModel.cs プロジェクト: Rhulen/Poe-Lurker
        /// <summary>
        /// When the system tray opens.
        /// </summary>
        public void OnTrayOpen()
        {
            // Hide mana overlay for 10s
            var message = new ManaBulbMessage()
            {
                NeedToHide = true,
            };

            this._eventAggregator.PublishOnUIThread(message);
        }
コード例 #3
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        private async Task CheckForUpdate()
        {
            var updateManager = IoC.Get <UpdateManager>();

            this.NeedUpdate = await updateManager.CheckForUpdate();

            if (this.NeedUpdate)
            {
                var message = new ManaBulbMessage()
                {
                    IsUpdate = true,
                    View     = new UpdateViewModel(UpdateState.NeedUpdate),
                    Action   = () => this.Update(),
                };

                this._eventAggregator.PublishOnUIThread(message);
                return;
            }
            else if (this._showUpdateSuccess)
            {
                this._showUpdateSuccess = false;
                this._eventAggregator.PublishOnUIThread(new ManaBulbMessage()
                {
                    IsUpdate = true, View = new UpdateViewModel(UpdateState.Success), DisplayTime = TimeSpan.FromSeconds(5)
                });
            }
            else
            {
                using (var patreonService = new PatreonService())
                {
                    var isPledging = await patreonService.IsPledging();

                    if (isPledging)
                    {
                        return;
                    }
                }

                using (var service = new CollaborationService())
                {
                    var collaboration = await service.GetCollaborationAsync();

                    if (!collaboration.IsExpired())
                    {
                        this._eventAggregator.PublishOnUIThread(new ManaBulbMessage()
                        {
                            View = new CollaborationViewModel(collaboration), Action = collaboration.Open, DisplayTime = TimeSpan.FromSeconds(6)
                        });
                    }
                }
            }
        }
コード例 #4
0
ファイル: ShellViewModel.cs プロジェクト: jstcyr/Poe-Lurker
        /// <summary>
        /// Updates this instance.
        /// </summary>
        public async void Update()
        {
            var message = new ManaBulbMessage()
            {
                View = new UpdateViewModel(UpdateState.Working)
            };

            this._eventAggregator.PublishOnUIThread(message);
            this.CleanUp();

            this.ShowInTaskBar = false;
            var updateManager = IoC.Get <UpdateManager>();
            await updateManager.Update();
        }