public MainPageViewModel(INavigationService navigationService) { _navigationService = navigationService; NavigateCommand.Subscribe(OnNavigate); ModalNavigateCommand.Subscribe(OnModalNavigate); }
private void CreateCommands(INavigator navigator, ICommandDispatcher commandDispatcher, MessageBuilder messageBuilder) { setAsDefault = new CurrencySetAsDefaultCommand(commandDispatcher, UniqueCode); addExchangeRate = new NavigateCommand(navigator, new CurrencyAddExchangeRateParameter(UniqueCode)); Delete = new CurrencyDeleteCommand(navigator, commandDispatcher, messageBuilder, UniqueCode); DeleteExchangeRate = new CurrencyDeleteExchangeRateCommand(commandDispatcher, navigator, UniqueCode); }
protected override void OnFinishInflate() { base.OnFinishInflate(); var inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); var layout = inflater.Inflate(Resource.Layout.Control_EditTextNavigate, this, true); _label = (TextView)layout.FindViewById(Resource.Id.label); _label.Focusable = false; if (_text != null) { _label.Text = _text; } if (_transformationMethod != null) { _label.TransformationMethod = TransformationMethod; } _button = (Button)layout.FindViewById(Resource.Id.navigateButton); _button.ContentDescription = this.ContentDescription; _button.Click += (sender, e) => { NavigateCommand.ExecuteIfPossible(); }; }
private void OnNavigated(object sender, NavigationEventArgs e) { ShowSettingsCommand.RaiseCanExecuteChanged(); NavigateCommand.RaiseCanExecuteChanged(); GoBackCommand.RaiseCanExecuteChanged(); RaisePropertyChanged("CanGoBack"); }
protected void Close() { if (IsInternetAndCloseModal()) { NavigateCommand.Execute(MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <DashBoardPage>())); } }
private async void SignIn() { try { IsBusy = true; if (Validate()) { var responseRequest = await BaseModule.AuthenticationService.Login(_email.Value, _password.Value); if (responseRequest.Success) { NavigateCommand.Execute(MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <DashBoardPage>())); } else { IsBusy = false; await BaseModule.DialogService.ShowAlertAsync(responseRequest.Message, "Login error", "Ok"); } } } catch (ServiceAuthenticationException) { await BaseModule.DialogService.ShowAlertAsync("Please, try again", "Login error", "Ok"); } catch (Exception) { await BaseModule.DialogService.ShowAlertAsync("An error occurred, try again", "Error", "Ok"); } finally { IsBusy = false; } }
private RadialMenuCommand CreateKnownCommand(CommandId id) { RadialMenuCommand command = null; switch (id) { case CommandId.Open: command = new OpenMenuCommand(); break; case CommandId.Close: command = new CloseMenuCommand(); break; case CommandId.NavigateToView: command = new NavigateCommand(); break; case CommandId.NavigateBack: command = new NavigateBackCommand(); break; default: throw new ArgumentException("Unknown command id!", "id"); } command.Id = id; command.Owner = this.Owner; return(command); }
public ContactsViewModel(NavigationStore navigationStore, AuthenticationStore authenticationStore, UnitOfWorkFactory unitOfWorkFactory) { NavigateToRepairCommand = new NavigateCommand <RepairClientViewModel>(navigationStore, () => new RepairClientViewModel(navigationStore, authenticationStore, unitOfWorkFactory)); NavigateToStoreClientCommand = new NavigateCommand <StoreClientViewModel>(navigationStore, () => new StoreClientViewModel(navigationStore, authenticationStore, unitOfWorkFactory)); NavigateToOrdersClientCommand = new NavigateCommand <OrdersClientViewModel>(navigationStore, () => new OrdersClientViewModel(navigationStore, authenticationStore, unitOfWorkFactory)); NavigateToExitCommand = new NavigateCommand <LogInViewModel>(navigationStore, () => new LogInViewModel(navigationStore, authenticationStore, unitOfWorkFactory)); }
public MenuViewModel(NavigationService navigationService) { NavigateThesesCommand = new NavigateCommand <ThesesViewModel>(navigationService, () => new ThesesViewModel(navigationService)); NavigateLiteraturesCommand = new NavigateCommand <LiteraturesViewModel>(navigationService, () => new LiteraturesViewModel(navigationService)); CreateThesisCommand = new NavigateCommand <ThesisViewModel>(navigationService, () => new ThesisViewModel(navigationService, new Thesis(), "Dodaj prace dyplomową")); CreateLiteratureCommand = new NavigateCommand <LiteratureViewModel>(navigationService, () => new LiteratureViewModel(navigationService, new Literature(), "Dodaj literaturę")); }
public TestExplorerViewModel(ISelectionService selectionService, TestExplorerModel model, IClipboardWriter clipboard, // ReSharper disable once UnusedParameter.Local - left in place because it will likely be needed for app wide font settings, etc. IGeneralConfigService configService, ISettingsFormFactory settingsFormFactory) { _clipboard = clipboard; _settingsFormFactory = settingsFormFactory; NavigateCommand = new NavigateCommand(selectionService); RunSingleTestCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSingleTestCommand, CanExecuteSingleTest); RunSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestsCommand, CanExecuteSelectedTestsCommand); RunSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunSelectedGroupCommand, CanExecuteSelectedGroupCommand); CancelTestRunCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCancelTestRunCommand, CanExecuteCancelTestRunCommand); ResetResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteResetResultsCommand, CanExecuteResetResultsCommand); CopyResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand); OpenTestSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings); CollapseAllCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseAll); ExpandAllCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandAll); Model = model; Model.TestCompleted += HandleTestCompletion; if (CollectionViewSource.GetDefaultView(Model.Tests) is ListCollectionView tests) { tests.SortDescriptions.Add(new SortDescription("QualifiedName.QualifiedModuleName.Name", ListSortDirection.Ascending)); tests.SortDescriptions.Add(new SortDescription("QualifiedName.MemberName", ListSortDirection.Ascending)); Tests = tests; } OnPropertyChanged(nameof(Tests)); TestGrouping = TestExplorerGrouping.Outcome; }
private async void LoginFacebook() { string[] readPermissions = { "public_profile", "email" }; var fbtoken = await _dependencyService.Get <IFacebookLoginService>().LoginAsync(readPermissions); IsLoading = true; var userProfile = await _facebookService.GetFacebookProfileAsync(fbtoken); if (userProfile != null) { var response = await _fitMeetRestService.FacebookLoginAsync(userProfile); if (response != null && response.Output?.Status == 1 && response.Output?.Response?.token != null) { var token = response.Output.Response.token; _tokenService.SetToken(token); _fitMeetRestService.SetToken(token); if ((response?.Output?.Validation).Equals("User already exists", StringComparison.CurrentCultureIgnoreCase)) { NavigateCommand.Execute("app:///MainPage/NavigationPage/MainTabbedPage"); } else { NavigateCommand.Execute("SecondSignUpPage"); } } else { await _dialogService.DisplayAlertAsync("Error", "Could not register. Please try again", "Ok"); } } IsLoading = false; }
public void OnNavigatedTo(NavigationParameters parameters) { WriteLine($"{Title} OnNavigatedTo"); Message = parameters.GetValue <string>("message"); WriteLine($"Parameters: {Message}"); WriteLine($"Can Navigate: {NavigateCommand.CanExecute("foobar")}"); WriteLine($"NavigationService Page: {(_navigationService as IPageAware).Page.GetType().Name}"); }
public ThesesViewModel(NavigationService navigationService) { _navigationService = navigationService; NavigateThesis = new NavigateCommand <ThesisViewModel>(_navigationService, () => Selected); ChangeMenu = new ChangeMenuCommand <ReturnMenuViewModel>(_navigationService, () => new ReturnMenuViewModel(_navigationService, new ThesesViewModel(_navigationService), new MenuViewModel(_navigationService))); Create(); }
public MainMenuViewModel(NavigationStore navigationStore) { NavigateCreatureCreateMenuCommand = new NavigateCommand <CreatureCreateMenuViewModel>(navigationStore, () => new CreatureCreateMenuViewModel(navigationStore)); NavigateItemCreateMenuCommand = new NavigateCommand <ItemCreateMenuViewModel>(navigationStore, () => new ItemCreateMenuViewModel(navigationStore)); QuitCommand = new RelayCommand((par) => { Application.Current.Shutdown(); }); }
public void CanExecute_AlwaysTrue() { var nav = Substitute.For <INavigationService>(); string page = "test"; var command = new NavigateCommand(nav, page); Assert.IsTrue(command.CanExecute(null)); }
public FluentSessionRecorder Open(Uri uri) { var command = new NavigateCommand(uri); _performer.Perform(command); return(this); }
public bool Navigate(string direction) { var command = new NavigateCommand { Direction = direction }; return(SyncExecuteCommand(command) is SuccessResult); }
private void ChatWithContact(WeChatUser contact) { ChatListManager.ChatWithContact(contact); //导航到聊天列表 NavigateCommand.Execute("ChatListView"); ChatNavChecked = true; }
/// <summary> /// Initializing properties /// </summary> /// <param name="signUpPage">Page for signup</param> public SignUpViewModel(SignUpPage signUpPage) { //LoginCommand = new LoginCommand(this); mPage = signUpPage; SignUpPage = (SignUpPage)mPage; ActualPage = PageList.SignUp; RegisterCommand = new RegisterCommand(this); BackCommand = new NavigateCommand(this); }
public ThesisViewModel(NavigationService navigationService, Thesis thesis, string pageTitle = "Edycja pracy dyplomowej") : this(thesis, pageTitle) { _navigationService = navigationService; DeleteThesis = new ActionCommand(() => Delete()); SaveThesis = new ActionCommand(() => Save()); NavigateBackCommand = new NavigateCommand <ThesesViewModel>(_navigationService, () => new ThesesViewModel(_navigationService)); ShowThesisLiteratureCommand = new NavigateCommand <LiteraturesViewModel>(_navigationService, () => new LiteraturesViewModel(_navigationService, Thesis.Literatures, $"Literatura dla {Thesis.Topic}")); ChangeBackMenuCommand = new ChangeMenuCommand <MenuViewModel>(_navigationService, () => new MenuViewModel(_navigationService)); }
public LiteraturesViewModel(NavigationService navigationService, string pageTitle = "Literatura") { _navigationService = navigationService; NavigateLiterature = new NavigateCommand <LiteratureViewModel>(_navigationService, () => Selected); ChangeMenu = new ChangeMenuCommand <ReturnMenuViewModel>(_navigationService, () => new ReturnMenuViewModel(_navigationService)); PageTitle = pageTitle; Create(GetLiteratures()); }
public void Execute_NavigatesToTarget() { var nav = Substitute.For <INavigationService>(); string page = "test"; var command = new NavigateCommand(nav, page); command.Execute(null); nav.Received().Navigate(page); }
public MenuViewModel(NavigateCommand <TimeTableViewModel> timeTableNavigateCommand, NavigateCommand <NewsViewModel> newsNavigateCommand, NavigateCommand <VideosViewModel> videosNavigateCommand, NavigateCommand <GamesViewModel> gamesNavigateCommand) { ShowTimeTableCommand = timeTableNavigateCommand; ShowNewsCommand = newsNavigateCommand; ShowVideosCommand = videosNavigateCommand; ShowGamesCommand = gamesNavigateCommand; }
public FindSymbolCommand( RubberduckParserState state, ISelectionService selectionService, DeclarationIconCache iconCache, IVbeEvents vbeEvents) : base(vbeEvents) { _state = state; _navigateCommand = new NavigateCommand(selectionService); }
public MakeAcntTxnVM(BankAccountStore bankAccountStore, NavigationService <AcntTxnListingVM> makeAcntTcnViewnavigationService) { //_bankAccountStore = bankAccountStore; SubmitCommand = new MakeAcntTxnCommand(this, bankAccountStore, makeAcntTcnViewnavigationService); CancelCommand = new NavigateCommand <AcntTxnListingVM>(makeAcntTcnViewnavigationService); TxnAmnt = DateTime.Now.Hour + .01m * DateTime.Now.Minute; TxnTime = DateTime.Today; }
public LiteratureViewModel(NavigationService navigationService, Literature literature, string pageTitle = "Edycja literatury") { _navigationService = navigationService; Literature = literature; PageTitle = pageTitle; DeleteLiterature = new ActionCommand(() => Delete()); SaveLiterature = new ActionCommand(() => Save()); NavigateBackCommand = new NavigateCommand <LiteraturesViewModel>(_navigationService, () => new LiteraturesViewModel(_navigationService)); ChangeBackMenuCommand = new ChangeMenuCommand <MenuViewModel>(_navigationService, () => new MenuViewModel(_navigationService)); }
public AppContext() { NavigateCommand = new NavigateCommand(this); OpenCommand = new OpenCommand(this); RefreshCommand = new RefreshCommand(this); Drives = DriveInfo.GetDrives() .Where(d => d.DriveType == DriveType.Fixed && d.IsReady) .Select(d => new Drive(d)).ToList(); }
public NavigationBarViewModel(AccountStore accountStore, NavigationService <HomeViewModel> homeNavigationService, NavigationService <AccountViewModel> accountNavigationService, NavigationService <LoginViewModel> loginNavigationService) { _accountStore = accountStore; NavigateHomeCommand = new NavigateCommand <HomeViewModel>(homeNavigationService); NavigateAccountCommand = new NavigateCommand <AccountViewModel>(accountNavigationService); NavigateLoginCommand = new NavigateCommand <LoginViewModel>(loginNavigationService); }
private void OnReturnPress() { cts?.Cancel(); History.Remove(Text); History.Insert(0, Text); var h = ReturnPress; h?.Invoke(this, new EventArgs()); NavigateCommand?.Execute(txt.Text); }
private void AuthenticationRun() { if (AppSettings.AuthenticatedUserResponse != null) { BaseModule.NavigationService.NavigateAsync(MasterModule.GetMasterNavigationPage(AppSettings.StartupView)); } else { NavigateCommand.Execute(PageRoutes.GetKey <LoginPage>()); } }
public void Playback(AVItem item) { ICommand goToPage = new NavigateCommand( "Global", "Playback", new { item }, Navigator.For(Frame)); goToPage.Execute(item); }