示例#1
0
        // just in case we add more awaits this signature will await all of them
        private async Task MainWindow_OnLoadedTask()
        {
            try
            {
                await _vm.InitializeNhm(LoadingBar.StartupLoader);
            }
            finally
            {
                LoadingBar.Visibility = Visibility.Collapsed;
                // Re-enable managed controls
                IsEnabled = true;
                SetTabButtonsEnabled();
                if (BuildOptions.SHOW_TDP_SETTINGS)
                {
                    var tdpWindow = new TDPSettingsWindow();
                    tdpWindow.DataContext = _vm;
                    tdpWindow.Show();
                }

                if (MinerPluginsManager.EulaConfirm.Count > 0)
                {
                    var pluginsPopup = new Plugins.PluginsConfirmDialog();
                    pluginsPopup.DataContext = new Plugins.PluginsConfirmDialog.VM
                    {
                        Plugins = new ObservableCollection <PluginPackageInfoCR>(MinerPluginsManager.EulaConfirm)
                    };
                    ShowContentAsModalDialog(pluginsPopup);
                }

                if (Launcher.IsUpdated)
                {
                    var nhmUpdatedDialog = new CustomDialog()
                    {
                        Title            = Translations.Tr("NiceHash Miner Updated"),
                        Description      = Translations.Tr("Completed NiceHash Miner auto update."),
                        OkText           = Translations.Tr("OK"),
                        CancelVisible    = Visibility.Collapsed,
                        AnimationVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdatedDialog);
                }

                if (Launcher.IsUpdatedFailed)
                {
                    var nhmUpdatedDialog = new CustomDialog()
                    {
                        Title            = Translations.Tr("NiceHash Miner Autoupdate Failed"),
                        Description      = Translations.Tr("NiceHash Miner auto update failed to complete. Autoupdates are disabled until next miner launch."),
                        OkText           = Translations.Tr("OK"),
                        CancelVisible    = Visibility.Collapsed,
                        AnimationVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdatedDialog);
                }
            }
        }
示例#2
0
        // just in case we add more awaits this signature will await all of them
        private async Task MainWindow_OnLoadedTask()
        {
            try
            {
                await _vm.InitializeNhm(LoadingBar.StartupLoader);
            }
            finally
            {
                LoadingBar.Visibility = Visibility.Collapsed;
                // Re-enable managed controls
                IsEnabled = true;
                SetTabButtonsEnabled();
                if (BuildOptions.SHOW_TDP_SETTINGS)
                {
                    var tdpWindow = new TDPSettingsWindow();
                    tdpWindow.DataContext = _vm;
                    tdpWindow.Show();
                }

                if (MinerPluginsManager.EulaConfirm.Any())
                {
                    var pluginsPopup = new Plugins.PluginsConfirmDialog();
                    pluginsPopup.DataContext = new Plugins.PluginsConfirmDialog.VM
                    {
                        Plugins = new ObservableCollection <PluginPackageInfoCR>(MinerPluginsManager.EulaConfirm)
                    };
                    ShowContentAsModalDialog(pluginsPopup);
                }

                if (LoginSuccess.HasValue)
                {
                    var description    = LoginSuccess.Value ? Translations.Tr("Login performed successfully.") : Translations.Tr("Unable to retreive BTC address. Please retreive it by yourself from web page.");
                    var btcLoginDialog = new CustomDialog()
                    {
                        Title            = Translations.Tr("Login"),
                        OkText           = Translations.Tr("Ok"),
                        CancelVisible    = Visibility.Collapsed,
                        AnimationVisible = Visibility.Collapsed,
                        Description      = description
                    };
                    btcLoginDialog.OKClick += (s, e) =>
                    {
                        if (!LoginSuccess.Value)
                        {
                            Process.Start(Links.Login);
                        }
                    };
                    CustomDialogManager.ShowModalDialog(btcLoginDialog);
                }

                if (Launcher.IsUpdated)
                {
                    var nhmUpdatedDialog = new CustomDialog()
                    {
                        Title            = Translations.Tr("NiceHash Miner Updated"),
                        Description      = Translations.Tr("Completed NiceHash Miner auto update."),
                        OkText           = Translations.Tr("OK"),
                        CancelVisible    = Visibility.Collapsed,
                        AnimationVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdatedDialog);
                }

                if (Launcher.IsUpdatedFailed)
                {
                    var nhmUpdatedDialog = new CustomDialog()
                    {
                        Title            = Translations.Tr("NiceHash Miner Autoupdate Failed"),
                        Description      = Translations.Tr("NiceHash Miner auto update failed to complete. Autoupdates are disabled until next miner launch."),
                        OkText           = Translations.Tr("OK"),
                        CancelVisible    = Visibility.Collapsed,
                        AnimationVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdatedDialog);
                }
            }
        }