예제 #1
0
 public DashboardViewModel(IMvxNavigationService navigationService)
 {
     _navigationService = navigationService;
     MyProperty         = "This is dashboard viewmodel property";
     ButtonText         = "GO TO";
     OpenNewFragment    = new MvxAsyncCommand(ExecuteOpenNewFragmentAsync);
 }
예제 #2
0
        public LoginViewModel(
            ILoginManager loginManager,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IMvxNavigationService navigationService,
            IPasswordManagerService passwordManagerService,
            IErrorHandlingService errorHandlingService)
        {
            Ensure.Argument.IsNotNull(loginManager, nameof(loginManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(passwordManagerService, nameof(passwordManagerService));
            Ensure.Argument.IsNotNull(errorHandlingService, nameof(errorHandlingService));

            this.loginManager           = loginManager;
            this.analyticsService       = analyticsService;
            this.onboardingStorage      = onboardingStorage;
            this.navigationService      = navigationService;
            this.passwordManagerService = passwordManagerService;
            this.errorHandlingService   = errorHandlingService;

            SignupCommand                   = new MvxAsyncCommand(signup);
            GoogleLoginCommand              = new MvxCommand(googleLogin);
            LoginCommand                    = new MvxCommand(login, () => LoginEnabled);
            ForgotPasswordCommand           = new MvxAsyncCommand(forgotPassword);
            TogglePasswordVisibilityCommand = new MvxCommand(togglePasswordVisibility);
            StartPasswordManagerCommand     = new MvxAsyncCommand(startPasswordManager, () => IsPasswordManagerAvailable);
        }
예제 #3
0
 public static async Task TryExecuteAsync <T>(this IMvxAsyncCommand <T> self, T parameter)
 {
     if (self.CanExecute(parameter))
     {
         await self.ExecuteAsync(parameter);
     }
 }
예제 #4
0
 public MainViewModel(ITranslateService translateService) : base()
 {
     TranslateCommand = new MvxAsyncCommand(async() =>
     {
         TranslatedText = await translateService.Translate(InputText);
     });
 }
예제 #5
0
        public MenuViewModel(IMvxNavigationService navigationService)
        {
            _navigationService = navigationService;

            ShowHomeCommand     = new MvxAsyncCommand(NavigateToHomeAsync);
            ShowSettingsCommand = new MvxAsyncCommand(NavigateToSettingsAsync);
        }
예제 #6
0
        public MenuViewModel(IMvxNavigationService navigationService)
        {
            _navigationService = navigationService;

            ShowHomeCommand        = new MvxAsyncCommand(NavigateToHomeAsync);
            ShowEventCreateCommand = new MvxAsyncCommand(NavigateToCreateAsync);
        }
예제 #7
0
        public SignupViewModel(
            IApiFactory apiFactory,
            ILoginManager loginManager,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IMvxNavigationService navigationService,
            IApiErrorHandlingService apiErrorHandlingService)
        {
            Ensure.Argument.IsNotNull(apiFactory, nameof(apiFactory));
            Ensure.Argument.IsNotNull(loginManager, nameof(loginManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(apiErrorHandlingService, nameof(apiErrorHandlingService));

            this.apiFactory              = apiFactory;
            this.loginManager            = loginManager;
            this.analyticsService        = analyticsService;
            this.onboardingStorage       = onboardingStorage;
            this.navigationService       = navigationService;
            this.apiErrorHandlingService = apiErrorHandlingService;

            LoginCommand                    = new MvxAsyncCommand(login);
            GoogleSignupCommand             = new MvxCommand(googleSignup);
            PickCountryCommand              = new MvxAsyncCommand(pickCountry);
            SignupCommand                   = new MvxAsyncCommand(signup, () => SignupEnabled);
            TogglePasswordVisibilityCommand = new MvxCommand(togglePasswordVisibility);
        }
예제 #8
0
        //public IMvxAsyncCommand LoginCommand { get; }

        public LoginViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService, Services.IAppSettings settings) : base(logProvider, navigationService)
        {
            _navigationService = navigationService;
            _settings          = settings;
            NavigateToRegistrationPageCommand = new MvxAsyncCommand(async() => await NavigationService.Navigate <RegistrationViewModel>());
            LoginCommand = new MvxAsyncCommand(async() => await NavigationService.Navigate <SplitRootViewModel>());
        }
예제 #9
0
 public MyPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post,
                            IMvxAsyncCommand <MyPostItemViewModel> removeCommand)
 {
     _navigationService = navigationService;
     Post           = post;
     _removeCommand = removeCommand;
 }
예제 #10
0
 /// <summary>
 ///     Initialize a ContentButton
 /// </summary>
 /// <param name="label">The label to appear on the button</param>
 /// <param name="glyph">The button icon</param>
 /// <param name="isExtended">Should the icon be extended or not</param>
 /// <param name="clickCommand">Command to run on click</param>
 public ContentButton(string label, string glyph, bool isExtended, IMvxAsyncCommand <ContentGroup> clickCommand)
 {
     Label              = label;
     Glyph              = glyph;
     IsExtended         = isExtended;
     ButtonClickCommand = clickCommand;
 }
예제 #11
0
 public static async Task TryExecuteAsync(this IMvxAsyncCommand self)
 {
     if (self.CanExecute())
     {
         await self.ExecuteAsync();
     }
 }
예제 #12
0
        public BrowserViewModel(IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;

            BackCommand = new MvxAsyncCommand(back);
        }
예제 #13
0
        public HomeViewModel(IMvxNavigationService navigationService, ILocationPromptService locationPromptService, IMvxLog log, IUserDialogs userDialogs)
        {
            _navigationService     = navigationService;
            _locationPromptService = locationPromptService;
            _log        = log;
            _useDialogs = userDialogs;

            SearchCommandAsync = new MvxAsyncCommand(SearchPropertiesAsync);
        }
예제 #14
0
 public MapsViewModel(IMvxNavigationService navigationService, ITaskService iTaskService, IMvxMessenger messenger)
 {
     _navigationService        = navigationService;
     _iTaskService             = iTaskService;
     _messenger                = messenger;
     _token                    = messenger.Subscribe <GoogleMapMessenger>(OnLosationMessage);
     BackTaskCommand           = new MvxAsyncCommand(BackGoogleMap);
     SaveGoogleMapPointCommand = new MvxAsyncCommand(SaveGoogleMapPoint);
 }
        public SelectDateTimeViewModel(IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;

            CloseCommand = new MvxAsyncCommand(close);
            SaveCommand  = new MvxAsyncCommand(save);
        }
예제 #16
0
        public AuthenticationViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService,
                                       IAuthenticationService authenticationService, IDialogService dialogService) : base(logProvider, navigationService)
        {
            _authenticationService = authenticationService;
            _dialogService         = dialogService;

            CloseCommand         = new MvxAsyncCommand(async() => await NavigationService.Close(this));
            HandleRequestCommand = new MvxAsyncCommand <string>(HandleRequestAsync);
        }
        public HomeViewModel(IModelFacade modelFacade, IMvxMessenger messenger)
            : base(modelFacade)
        {
            _messenger = messenger;

            CommandSendMessage = new MvxAsyncCommand(SendMessage);
            CommandReset       = new MvxAsyncCommand(ResetConnection);

            Results = new MvxObservableCollection <string>();
        }
예제 #18
0
        public AboutViewModel(IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;

            OpenPrivacyPolicyCommand  = new MvxAsyncCommand(openPrivacyPolicyView);
            OpenTermsOfServiceCommand = new MvxAsyncCommand(openTermsOfServiceView);
            OpenLicensesCommand       = new MvxAsyncCommand(openLicensesView);
        }
 public TrainingsListViewModel(ITrainingService trainingService, IMvxNavigationService navigationService, IMvxViewPresenter viewPresenter)
 {
     this.trainingService               = trainingService;
     this.navigationService             = navigationService;
     this.viewPresenter                 = viewPresenter;
     ShowTrainingDetailPageAsyncCommand = new MvxAsyncCommand(ShowTrainingDetailPageAsync);
     LoadAsyncCommand      = new MvxAsyncCommand(async() => await LoadTrainings());
     CreateTrainingCommand = new MvxAsyncCommand(async() => await this.CreateTraining());
     DeleteTrainingCommand = new MvxAsyncCommand <int>(async(x) => await DeleteTrainingAsync(x));
 }
예제 #20
0
 public CounterViewModel(ICountersService service,
                         IMvxNavigationService navigationService)
 {
     this.navigationService = navigationService;
     this.service           = service;
     IncrementCommand       = new MvxAsyncCommand(IncrementCounter);
     DeleteCommand          = new MvxAsyncCommand(DeleteCounter);
     SaveCommand            = new MvxAsyncCommand(Save);
     CancelCommand          = new MvxAsyncCommand(Cancel);
 }
예제 #21
0
        public CountersViewModel(ICountersService service, IMvxMessenger messenger, IMvxNavigationService navigationService)
        {
            token = messenger
                    .SubscribeOnMainThread <CountersChangedMessage>
                        (async m => await LoadCounters());

            this.service             = service;
            this.navigationService   = navigationService;
            ShowAddNewCounterCommand = new MvxAsyncCommand(ShowAddNewCounter);
            Counters = new ObservableCollection <CounterViewModel>();
        }
예제 #22
0
        public MenuViewModel(IMvxNavigationService navigationService)
        {
            _navigationService = navigationService;
            MenuItemList       = new MvxObservableCollection <string>()
            {
                "Home",
                "Contacts"
            };

            ShowDetailPageAsyncCommand = new MvxAsyncCommand(ShowDetailPageAsync);
        }
        public PropertiesViewModel(IMvxNavigationService navigationService, ISearchService searchService, IMvxLog log, IUserDialogs userDialogs)
        {
            _navigationService = navigationService;
            _searchService     = searchService;
            _log        = log;
            _useDialogs = userDialogs;

            ShowPropertyDetailsAsyncCommand = new MvxAsyncCommand <SearchPropertyResult>(ShowPropertyDetailsAsync);
            LoadMorePropertiesAsyncCommand  = new MvxAsyncCommand <SearchPropertyResult>(LoadMorePropertiesAsync);
            RefreshPropertiesAsyncCommand   = new MvxAsyncCommand(RefreshPropertiesAsync);
        }
예제 #24
0
 public MovieShows(ImageSource imageSource, string title, string genre, string shows, double rating,
                   IMvxAsyncCommand command)
 {
     //_basicShowData = showData;
     ImageSource = imageSource;
     Title       = title;
     Genre       = genre;
     Shows       = shows;
     Rating      = rating;
     //_navigationService = navigationService;
     GoToMoviePageCommand = command;
 }
예제 #25
0
        public SettingsViewModel(ITogglDataSource dataSource, IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            Title = Resources.Settings;

            this.dataSource        = dataSource;
            this.navigationService = navigationService;

            BackCommand   = new MvxAsyncCommand(back);
            LogoutCommand = new MvxAsyncCommand(logout);
        }
        public SelectDateFormatViewModel(IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;

            CloseCommand        = new MvxAsyncCommand(close);
            SelectFormatCommand = new MvxAsyncCommand <SelectableDateFormatViewModel>(selectFormat);

            DateTimeFormats = availableDateFormats
                              .Select(dateFormat => new SelectableDateFormatViewModel(dateFormat, false))
                              .ToArray();
        }
예제 #27
0
        public TimeEntriesLogViewModel(ITogglDataSource dataSource, ITimeService timeService,
                                       IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.navigationService = navigationService;

            EditCommand = new MvxAsyncCommand <TimeEntryViewModel>(edit);
            ContinueTimeEntryCommand = new MvxAsyncCommand <TimeEntryViewModel>(continueTimeEntry);
        }
예제 #28
0
        public EditProjectViewModel(ITogglDataSource dataSource, IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.dataSource        = dataSource;
            this.navigationService = navigationService;

            DoneCommand          = new MvxAsyncCommand(done);
            CloseCommand         = new MvxAsyncCommand(close);
            PickColorCommand     = new MvxAsyncCommand(pickColor);
            PickClientCommand    = new MvxAsyncCommand(pickClient);
            PickWorkspaceCommand = new MvxAsyncCommand(pickWorkspace);
        }
        public TermsOfServiceViewModel(
            IBrowserService browserService, IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(browserService, nameof(browserService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;
            this.browserService    = browserService;

            CloseCommand              = new MvxAsyncCommand(() => close(false));
            AcceptCommand             = new MvxAsyncCommand(() => close(true));
            ViewPrivacyPolicyCommand  = new MvxCommand(viewPrivacyPolicy);
            ViewTermsOfServiceCommand = new MvxCommand(viewTermsOfService);
        }
        public SelectBeginningOfWeekViewModel(IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;

            CloseCommand = new MvxAsyncCommand(close);
            SelectBeginningOfWeekCommand = new MvxAsyncCommand <SelectableBeginningOfWeekViewModel>(selectFormat);

            BeginningOfWeekCollection = Enum.GetValues(typeof(BeginningOfWeek))
                                        .Cast <BeginningOfWeek>()
                                        .Select(beginningOfWeek => new SelectableBeginningOfWeekViewModel(beginningOfWeek, false))
                                        .ToArray();
        }