Ejemplo n.º 1
0
        public static void CreateNhmUpdateInfoUpdate()
        {
            var notification = new Notification(NotificationsType.Info, NotificationsGroup.NhmUpdate, Tr("NiceHash Miner Update"), Tr("New version of NiceHash Miner is available."));

            if (!Configs.UpdateSettings.Instance.AutoUpdateNiceHashMiner)
            {
                notification.Action = new NotificationAction
                {
                    Info   = Tr("Start updater"),
                    Action = () =>
                    {
                        ApplicationStateManager.App.Dispatcher.Invoke(async() => {
                            var ok = await UpdateHelpers.StartUpdateProcess();
                            if (!ok)
                            {
                                CreateNhmUpdateAttemptFail();
                            }
                        });
                    },
                    IsSingleShotAction = true,
                };
            }

            NotificationsManager.Instance.AddNotificationToList(notification);
        }
        public static void CreateNhmUpdateInfo(bool isInstallerVersion)
        {
            var notification = new Notification(NotificationsType.Info, NotificationsGroup.NhmUpdate, Tr("NiceHash Miner Update"), Tr("New version of NiceHash Miner is available."));

            if (!Configs.UpdateSettings.Instance.AutoUpdateNiceHashMiner)
            {
                if (isInstallerVersion)
                {
                    notification.Actions.Add(new NotificationAction
                    {
                        Info   = Tr("Start updater"),
                        Action = () =>
                        {
                            ApplicationStateManager.App.Dispatcher.Invoke(async() => await UpdateHelpers.StartUpdateProcess(isInstallerVersion));
                        }
                    });
                }
                else
                {
                    notification.Actions.Add(new NotificationAction
                    {
                        Info   = Tr("Visit release Page"),
                        Action = () => { Process.Start(Links.VisitReleasesUrl); }
                    });
                }
            }

            NotificationsManager.Instance.AddNotificationToList(notification);
        }