public MainViewModel(ITranslationService translationService, IMvxNavigationService navigationService)
        {
            _translationService = translationService;
            _navigationService  = navigationService;

            TranslateCommand   = new MvxCommand(() => Translate(), () => true);
            ShowHistoryCommand = new MvxAsyncCommand(ShowHistoryTask);
            ShowAboutCommand   = new MvxAsyncCommand(async() => await _navigationService.Navigate <AboutViewModel>());
        }
        public MainViewModel(IMvxNavigationService navigationService, ILoginService iLoginService)
        {
            _navigationService = navigationService;
            _iLoginService     = iLoginService;

            CurrentMainViewCommand = new MvxAsyncCommand(CurrentMainView);
            TestIOSCommand         = new MvxAsyncCommand(async() => await _navigationService.Navigate <TestLoginViewModel>());
            MenuViewCommand        = new MvxAsyncCommand(async() => await _navigationService.Navigate <ListTaskViewModel>());
        }
Exemple #3
0
        public OutdatedAppViewModel(IBrowserService browserService)
        {
            Ensure.Argument.IsNotNull(browserService, nameof(browserService));

            this.browserService = browserService;

            UpdateAppCommand   = new MvxCommand(updateApp);
            OpenWebsiteCommand = new MvxCommand(openWebsite);
        }
Exemple #4
0
        public MenuViewModel(IMvxNavigationService navigation,
                             IUserDialogs dialogs)
        {
            _navigation = navigation;
            _dialogs    = dialogs;

            CloseMenuCommand = new MvxAsyncCommand(() => _navigation.Close(this));
            LogOutCommand    = new MvxAsyncCommand(LogOut);
        }
Exemple #5
0
        public ContactViewModel(IActionHelper actionHelper, IContactLogic contactLogic, ISettingLogic settingLogic, IMvxNavigationService navigationService)
        {
            _contactLogic      = contactLogic;
            _navigationService = navigationService;
            _settingLogic      = settingLogic;
            _actionHelper      = actionHelper;

            SaveContactCommand = new MvxAsyncCommand(() => _actionHelper.DoAction(SaveContact));
            NumberPrefixes     = NumberPrefixProvider.GetNumberPrefixes();
        }
Exemple #6
0
        protected EntryViewModel(IAuthService authService, IApiService apiService, IMvxNavigationService navigationService, ICurrentUserService currentUserService)
            : base(apiService, navigationService, currentUserService)
        {
            this.authService = authService;

            GoToServerSettingCommand = new MvxAsyncCommand(() => navigationService.Navigate <ServerSettingViewModel>());
            GoToLoginCommand         = new MvxAsyncCommand(() => navigationService.Navigate <LoginViewModel>());
            GoToRegisterCommand      = new MvxAsyncCommand(() => navigationService.Navigate <RegisterViewModel>());
            CloseAppCommand          = new MvxCommand(() => closeAppInteraction.Raise());
        }
Exemple #7
0
 public WelcomeViewModel(IMvxNavigationService navigation)
 {
     //Disables access to swipe right main menu while this page is open
     if (Application.Current.MainPage is MasterDetailPage masterDetailPage)
     {
         masterDetailPage.IsGestureEnabled = false;
     }
     navigationService = navigation;
     AddBudgetCommand  = new MvxAsyncCommand(async() => await OnAddBudget());
 }
        public MainViewModel(
            IMvxNavigationService navigationService,
            ISimulationService simulationService)
            : base(navigationService)
        {
            SimulationService = simulationService;

            CreateNewCommand = new MvxCommand(() => SimulationService.CreateNewField());
            StartCommand     = new MvxCommand(() => SimulationService.Start());
            PauseCommand     = new MvxCommand(() => SimulationService.Pause());
        }
Exemple #9
0
        public ScanViewModel(IAdapter adapter)
        {
            Adapter = adapter ?? throw new ArgumentNullException(nameof(adapter));

            PairDevice = new MvxCommand <DeviceViewModel>(async d =>
            {
                Adapter.StopScan();
                d.Device.Connect();
                var services = await d.Device.DiscoverServices().AsQbservable().ToArray();
            });
        }
        public LoginViewModel(IMvxNavigationService navigationService, ISendbirdConnectionService sendBird, IMvxMessenger messenger, IContext context) : base()
        {
            _navigationService = navigationService ?? throw new ArgumentNullException(nameof(navigationService));
            _sendbird          = sendBird;
            _messenger         = messenger;
            _context           = context;

            ShowChatListViewModelCommand = new MvxCommand(LoginConnect);

            RegisterConnectionStatusChangeNotificationListener();
        }
Exemple #11
0
        public override void Prepare()
        {
            GoToContentPageCommand = new MvxCommand(() => {
                _navigationService.Navigate <ContentViewModel>();
            });

            GoToSectionPageCommand = new MvxCommand <string>(pram => {
                _navigationService.Navigate <SectionViewModel, string>(pram);
            });
            base.Prepare();
        }
        private static void AddToLookup(IDictionary<string, IMvxCommand> lookup, IMvxCommand command, string name)
        {
            if (string.IsNullOrEmpty(name))
                return;

            if (lookup.ContainsKey(name))
            {
                MvxTrace.Warning("Ignoring Commmand - it would overwrite the existing Command, name {0}", name);
                return;
            }
            lookup[name] = command;
        }
Exemple #13
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         var disposableCommand = Command as IDisposable;
         if (disposableCommand != null)
         {
             disposableCommand.Dispose();
         }
         Command = null;
     }
 }
Exemple #14
0
        public SettingsViewModel(ISettingLogic settingLogic, IActionHelper actionHelper, IMvxNavigationService navigationService,
                                 IMvxMessenger messenger)
        {
            _settingLogic      = settingLogic;
            _actionHelper      = actionHelper;
            _navigationService = navigationService;
            _messenger         = messenger;

            LoadSettingsCommand = new MvxAsyncCommand(() => _actionHelper.DoAction(LoadSettings));
            SaveSettingsCommand = new MvxAsyncCommand(() => _actionHelper.DoAction(SaveSettings));
            NumberPrefixes      = NumberPrefixProvider.GetNumberPrefixes();
        }
 public HomeViewModel(IMvxNavigationService navigationService)
 {
     _navigationService = navigationService;
     ShowDimmsCommand   = new MvxCommand(() =>
     {
         _navigationService.Navigate <DimmPackagesViewModel>();
     });
     ShowPackagesCommand = new MvxCommand(() =>
     {
         _navigationService.Navigate <PackagesListViewModel>();
     });
 }
Exemple #16
0
 public TaskViewModel(IMvxNavigationService navigationService, ITaskService iTaskService, IMvxMessenger messenger)
 {
     _navigationService           = navigationService;
     _iTaskService                = iTaskService;
     _messenger                   = messenger;
     _token                       = messenger.Subscribe <GoogleMapMessenger>(OnLocationMessage);
     SaveTaskCommand              = new MvxAsyncCommand(SaveTask);
     DeleteTaskCommand            = new MvxAsyncCommand(DeleteTask);
     BackTaskCommand              = new MvxAsyncCommand(BackTask);
     DeleteMarkerGoogleMapCommand = new MvxCommand(DeleteMarkerGoogleMap);
     GoogleMapCommand             = new MvxAsyncCommand(CreateMarkerGoogleMap);
 }
        public BarrierViewModel(IBarrierLogic barrierLogic, ISettingLogic settingLogic, IActionHelper actionHelper, IMvxNavigationService navigationService, IMvxMessenger messenger)
        {
            _barrierLogic      = barrierLogic;
            _settingLogic      = settingLogic;
            _actionHelper      = actionHelper;
            _navigationService = navigationService;
            _messenger         = messenger;

            SaveBarrierCommand = new MvxAsyncCommand(() => _actionHelper.DoAction(SaveBarrier));
            LoadBarrierCommand = new MvxAsyncCommand(() => _actionHelper.DoAction(LoadBarrier));
            NumberPrefixes     = NumberPrefixProvider.GetNumberPrefixes();
        }
        public AppointmentsViewModel(IMyHealthClient client, IMvxMessenger messenger) 
			: base(messenger)
        {
            _myHealthClient = client;
            _messenger = messenger;

            Appointments = new ObservableCollection<ClinicAppointment>();
            ShowDetailsCommand = new MvxCommand<Appointment>(OnShowDetails);
            RefreshCommand = new MvxCommand(async () => await ReloadDataAsync());

            _newAppointmentViewModel = new Lazy<NewAppointmentViewModel>(() => 
                Mvx.IocConstruct<NewAppointmentViewModel>());
        }
Exemple #19
0
        private static void AddToLookup(IDictionary <string, IMvxCommand> lookup, IMvxCommand command, string?name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            if (lookup.ContainsKey(name !))
            {
                MvxLogHost.Default?.Log(LogLevel.Warning, "Ignoring Commmand - it would overwrite the existing Command, name {name}", name);
                return;
            }
            lookup[name !] = command;
        public DateRangeViewModel(IMvxNavigationService navigation)
        {
            navigationService = navigation;
            Title             = "Custom Dates";

            var _accts = LoadAccountOptions();

            AddBillCommand        = new MvxAsyncCommand(async() => await navigationService.Navigate <NewBillsViewModel, string>(string.Empty));
            OnDateSelectedCommand = new MvxAsyncCommand(async() => await GetBills());

            Messenger.Register <ChangeBillMessage>(this, async x => await OnChangeBillMessage(x.AccountId));
            Messenger.Register <UpdateBillMessage>(this, async x => await OnUpdateBillMessage(x.AccountId));
        }
Exemple #21
0
        public AppointmentsViewModel(IMyHealthClient client, IMvxMessenger messenger)
            : base(messenger)
        {
            _myHealthClient = client;
            _messenger      = messenger;

            Appointments       = new ObservableCollection <ClinicAppointment>();
            ShowDetailsCommand = new MvxCommand <Appointment>(OnShowDetails);
            RefreshCommand     = new MvxCommand(async() => await ReloadDataAsync());

            _newAppointmentViewModel = new Lazy <NewAppointmentViewModel>(() =>
                                                                          Mvx.IocConstruct <NewAppointmentViewModel>());
        }
 public LoginViewModel(IMvxNavigationService navigationService, ILoginService loginService, ITaskService iTaskService)
 {
     ShowListTaskViewCommand         = new MvxAsyncCommand(async() => await _navigationService.Navigate <ListTaskViewModel>());
     _iTaskService                   = iTaskService;
     _loginService                   = loginService;
     _navigationService              = navigationService;
     LoginCommand                    = new MvxCommand(_loginService.LoginInstagram);
     _loginService.OnLoggedInHandler = new Action(() =>
     {
         CreateNewUser();
         ShowListTaskViewCommand.Execute(null);
     });
 }
Exemple #23
0
        private void AddCommand(IMvxCommand command, string whichText, string image)
        {
            var frame  = new RectangleF(10, _currentTop, 280, 37);
            var button = UIButton.FromType(UIButtonType.Custom);

            button.Frame           = frame;
            button.BackgroundColor = UIColor.Black;
            button.SetTitleColor(UIColor.White, UIControlState.Normal);
            button.SetTitle(GetText(whichText), UIControlState.Normal);
            button.SetImage(UIImage.FromFile("ConfResources/Images/" + image + ".png"), UIControlState.Normal);
            AddView(button);

            button.TouchDown += (sender, e) => command.Execute();
        }
Exemple #24
0
        protected void RegisterCommand(IMvxCommand command)
        {
            if (_commands.Contains(command))
            {
                return;
            }

            if (_commands.Count == 0)
            {
                RegisterCanExecuteChangedHandler();
            }

            _commands.Add(command);
        }
Exemple #25
0
        public ReportsCalendarViewModel(
            ITimeService timeService, ITogglDataSource dataSource)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));

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

            CalendarDayTappedCommand = new MvxCommand <CalendarDayViewModel>(calendarDayTapped);
            QuickSelectCommand       = new MvxCommand <CalendarBaseQuickSelectShortcut>(quickSelect);

            disposableBag = new CompositeDisposable();
        }
        private static void AddToLookup(IDictionary <string, IMvxCommand> lookup, IMvxCommand command, string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            if (lookup.ContainsKey(name))
            {
                MvxTrace.Warning("Ignoring Commmand - it would overwrite the existing Command, name {0}", name);
                return;
            }
            lookup[name] = command;
        }
        public StartTimeEntryViewModel(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;

            BackCommand           = new MvxAsyncCommand(back);
            DoneCommand           = new MvxAsyncCommand(done);
            ToggleBillableCommand = new MvxCommand(toggleBillable);
        }
Exemple #28
0
        public BoontonPiControlViewModel(IBackgroundHandler backgroundHandler, IBoontonPi device, IPiControlPublisher commandPublisher) : base(backgroundHandler, device)
        {
            _commandPublisher = commandPublisher;
            foreach (var sensor in Device.Sensors)
            {
                Sensors.Add(new SensorControlViewModel(sensor, _commandPublisher));
            }

            StartPollingCommand        = new MvxAsyncCommand(OnStartPi);
            StopPollingCommand         = new MvxAsyncCommand(OnStopPi);
            BoontonStartupCommand      = new MvxAsyncCommand(OnBoontonStartup);
            BoontonCloseSensorsCommand = new MvxAsyncCommand(OnBoontonCloseSensors);
            BoontonResetSensorsCommand = new MvxAsyncCommand(OnBoontonResetSensors);
        }
 private void SyncFireHandler(IMvxCommand handler)
 {
     if (handler != null)
     {
         var waitForHandler = new ManualResetEvent(false);
         ((Activity)Context).RunOnUiThread(
             () =>
         {
             handler.Execute();
             waitForHandler.Set();
         });
         waitForHandler.WaitOne();
     }
 }
        public SignInPageViewModel(IMvxNavigationService navigationService, ITokenService tokenService)
        {
            this._navigationService = navigationService;

            LoginCompletedCommand = new MvxAsyncCommand <SignInResponse>(async(SignInResponse response) =>
            {
                if (response.SignInResult == null)
                {
                    return;
                }

                tokenService.SetCurrentToken(response.SignInResult.Token);
                await _navigationService.Navigate <Congreg8PageViewModel>();
            });
        }
        public LoginViewModel(ILoginManager loginManager, IMvxNavigationService navigationService, IPasswordManagerService passwordManagerService)
        {
            Ensure.Argument.IsNotNull(loginManager, nameof(loginManager));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(passwordManagerService, nameof(passwordManagerService));

            this.loginManager           = loginManager;
            this.navigationService      = navigationService;
            this.passwordManagerService = passwordManagerService;

            BackCommand = new MvxCommand(back);
            NextCommand = new MvxCommand(next);
            StartPasswordManagerCommand     = new MvxCommand(startPasswordManager);
            TogglePasswordVisibilityCommand = new MvxCommand(togglePasswordVisibility);
        }
        public RabbitControlOverviewViewModel(IBackgroundHandler backgroundHandler, IRabbitControlledManager deviceManager, IPiControlPublisher commandPublisher) : base(backgroundHandler)
        {
            _deviceManager    = deviceManager;
            _commandPublisher = commandPublisher;

            //StartPi1Command = new MvxAsyncCommand(OnStartPi1);
            StartAllPisCommand = new MvxAsyncCommand(OnStartAllPis);
            //StopPi1Command = new MvxAsyncCommand(OnStopPi1);
            StopAllPisCommand          = new MvxAsyncCommand(OnStopAllPis);
            BoontonStartupCommand      = new MvxAsyncCommand(OnBoontonStartup);
            BoontonCloseSensorsCommand = new MvxAsyncCommand(OnBoontonCloseSensors);
            BoontonResetSensorsCommand = new MvxAsyncCommand(OnBoontonResetSensors);

            _ = PollUpdates();
        }
 protected override void SetValueImpl(object target, object value)
 {
     command = (IMvxCommand)value;
     floatingActionButton.Click +=FloatingActionButtonOnClick;
 }
        private static void AddToLookup(IDictionary<string, List<IMvxCommand>> lookup, IMvxCommand command, string name)
        {
            if (string.IsNullOrEmpty(name))
                return;

            // Get collection
            List<IMvxCommand> commands;

            // If no collection exists, create a new one
            if (!lookup.TryGetValue(name, out commands))
            {
                commands = new List<IMvxCommand>();
                lookup[name] = commands;
            }

            // Protect against adding command twice
            if (!commands.Contains(command))
            {
                commands.Add(command);
            }
        }
 public void Add(IMvxCommand command, string name, string canExecuteName)
 {
     AddToLookup(this._commandLookup, command, name);
     AddToLookup(this._canExecuteLookup, command, canExecuteName);
 }
 private void SyncFireHandler(IMvxCommand handler)
 {
     if (handler != null)
     {
         var waitForHandler = new ManualResetEvent(false);
         ((Activity)Context).RunOnUiThread(
             () =>
             {
                 handler.Execute();
                 waitForHandler.Set();
             });
         waitForHandler.WaitOne();
     }
 }
 public MenuViewModel ()
 {
     HomeCommand = new MvxCommand(() => ShowViewModel<ExamplesViewModel>());
     SettingsCommand = new MvxCommand(() => ShowViewModel<SettingsViewModel>());
     HelpCommand = new MvxCommand(() => ShowViewModel<SettingsViewModel>());
 }        
 public override void SetValue(object value)
 {
     var command = value as IMvxCommand;
     _currentCommand = command;
 }