protected override void HandleInteractionObjectChanged() { base.HandleInteractionObjectChanged(); _regionManager.RequestNavigate(RegionNames.ProfileWorkflowEditorOverlayRegion, Interaction.View); UpdateHelpTopic?.Invoke(); OkCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); }
private void InvalidateCommands() { RaisePropertyChanged(() => IsSessionActive); CloseCommand.RaiseCanExecuteChanged(); ExportCommand.RaiseCanExecuteChanged(); ConnectCommand.RaiseCanExecuteChanged(); DisconnectCommand.RaiseCanExecuteChanged(); }
void OnClose() { if (!EnsureSaved()) { return; } ProgramProvider.Reset(); CloseCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); }
void OnNew() { if (!EnsureSaved()) { return; } ProgramProvider.Reset(); CloseCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); StatusUpdateProvider.Publish(Resources.Strings.TitleBarViewModel_CreatedNewProgram); }
private void InvalidateCommands() { SaveCommand.RaiseCanExecuteChanged(); DeleteCommand.RaiseCanExecuteChanged(); CancelCommand.RaiseCanExecuteChanged(); PrintCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); GetAccountCommand.RaiseCanExecuteChanged(); EditInvoiceItemCommand.RaiseCanExecuteChanged(); DeleteInvoiceItemCommand.RaiseCanExecuteChanged(); NewInvoiceItemCommand.RaiseCanExecuteChanged(); }
protected TransportViewModel(DataTransport <T> dataTransport) { _dataTransport = dataTransport; _dataTransport.CanOpenChanged += delegate { OpenCommand.RaiseCanExecuteChanged(); }; _dataTransport.CanCloseChanged += delegate { CloseCommand.RaiseCanExecuteChanged(); }; _dataTransport.IsOpenChanged += (sender, args) => { RaisePropertyChanged(nameof(IsOpen)); }; }
protected override void RaiseCanExecuteCommands() { OpenCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); //NextPageCommand.RaiseCanExecuteChanged(); //PreviousPageCommand.RaiseCanExecuteChanged(); //FirstPageCommand.RaiseCanExecuteChanged(); //LastPageCommand.RaiseCanExecuteChanged(); SaveCommand.RaiseCanExecuteChanged(); NewCommand.RaiseCanExecuteChanged(); DeleteCommand.RaiseCanExecuteChanged(); ReloadCommand.RaiseCanExecuteChanged(); }
void OnLoad() { if (!EnsureSaved()) { return; } if (!Load()) { return; } CloseCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); }
void RootItemModelPropertyChanged() { CloseCommand.RaiseCanExecuteChanged(); if (TTFModel.RootItemModel != null) { ItemViewModel = new TTFItemViewModel(TTFModel.RootItemModel) { IsExpanded = true, }; string filePath = TTFModel.FilePath; if (filePath != null) WindowTitle = string.Format("{0} {1}", Path.GetFileName(filePath), StaticWindowTitle); } else { WindowTitle = StaticWindowTitle; ItemViewModel = null; } }
//this is copied from NexusModsLogin.xaml.cs cause I'm too lazy to make it shared code for what will likely never change private void AuthorizeWithNexus() { NamedBackgroundWorker nbw = new NamedBackgroundWorker(@"NexusAPICredentialsCheck"); nbw.DoWork += async(a, b) => { IsAuthorizing = true; VisibleIcon = true; SpinIcon = true; ActiveIcon = FontAwesomeIcon.Spinner; AuthorizeCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); AuthorizeToNexusText = M3L.GetString(M3L.string_pleaseWait); var apiKeyReceived = await NexusModsUtilities.SetupNexusLogin(x => Debug.WriteLine(x)); Application.Current.Dispatcher.Invoke(delegate { mainwindow.Activate(); }); if (!string.IsNullOrWhiteSpace(apiKeyReceived)) { //Check api key AuthorizeToNexusText = M3L.GetString(M3L.string_checkingKey); try { var authInfo = NexusModsUtilities.AuthToNexusMods(apiKeyReceived).Result; if (authInfo != null) { using FileStream fs = new FileStream(System.IO.Path.Combine(Utilities.GetNexusModsCache(), @"nexusmodsapikey"), FileMode.Create); File.WriteAllBytes(System.IO.Path.Combine(Utilities.GetNexusModsCache(), @"entropy"), NexusModsUtilities.EncryptStringToStream(apiKeyReceived, fs)); fs.Close(); mainwindow.NexusUsername = authInfo.Name; mainwindow.NexusUserID = authInfo.UserID; SetAuthorized(true); mainwindow.RefreshNexusStatus(); AuthorizedToNexusUsername = authInfo.Name; Analytics.TrackEvent(@"Authenticated to NexusMods"); } else { Log.Error(@"Error authenticating to nexusmods, no userinfo was returned, possible network issue"); mainwindow.NexusUsername = null; mainwindow.NexusUserID = 0; SetAuthorized(false); mainwindow.RefreshNexusStatus(); } } catch (ApiException apiException) { Log.Error(@"Error authenticating to NexusMods: " + apiException.ToString()); Application.Current.Dispatcher.Invoke(delegate { M3L.ShowDialog(window, M3L.GetString(M3L.string_interp_nexusModsReturnedAnErrorX, apiException.ToString()), M3L.GetString(M3L.string_errorAuthenticatingToNexusMods), MessageBoxButton.OK, MessageBoxImage.Error); }); } catch (Exception e) { Log.Error(@"Other error authenticating to NexusMods: " + e.Message); } } else { Log.Error(@"No API key - setting authorized to false for NM"); SetAuthorized(false); } IsAuthorizing = false; }; nbw.RunWorkerCompleted += (a, b) => { if (b.Error != null) { Log.Error($@"Exception occurred in {nbw.Name} thread: {b.Error.Message}"); } VisibleIcon = IsAuthorized; if (IsAuthorized) { ActiveIcon = FontAwesomeIcon.CheckCircle; } SpinIcon = false; AuthorizeCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); }; nbw.RunWorkerAsync(); }