예제 #1
0
 private void InitSaveInvoiceCommand()
 {
     SaveInvoiceCommand = new DelegateCommand <object>(OnSaveInvoice, OnCanSaveInvoce);
     SaveInvoiceCommand.ObservesProperty(() => IsNotBusy);
     SaveInvoiceCommand.ObservesProperty(() => InvoiceBindProp);
     SaveInvoiceCommand.ObservesProperty(() => InvoiceBindProp.Items.Count);
 }
예제 #2
0
 private void InitSaveCommand()
 {
     SaveCommand = new DelegateCommand <object>(OnSave, CanExecuteSave);
     SaveCommand.ObservesProperty(() => IsNotBusy);
     SaveCommand.ObservesProperty(() => ItemBindProp.Name);
     SaveCommand.ObservesProperty(() => ItemBindProp.Value);
 }
예제 #3
0
 private void InitLoginCommand()
 {
     LoginCommand = new DelegateCommand <object>(OnLogin, CanLogin);
     LoginCommand.ObservesProperty(() => IsNotBusyBindProp);
     LoginCommand.ObservesProperty(() => EmailBindProp);
     LoginCommand.ObservesProperty(() => PassBindProp);
 }
예제 #4
0
 private void InitPayCommand()
 {
     PayCommand = new DelegateCommand <object>(OnPay, OnCanPay);
     PayCommand.ObservesProperty(() => IsNotBusy);
     PayCommand.ObservesProperty(() => InvoiceBindProp);
     PayCommand.ObservesProperty(() => InvoiceBindProp.Items.Count);
 }
예제 #5
0
 private void InitLoginCommand()
 {
     LoginCommand = new DelegateCommand <object>(OnLogin, CanExecuteLogin);
     LoginCommand.ObservesProperty(() => IsNotBusy);
     LoginCommand.ObservesProperty(() => UsernameBindProp);
     LoginCommand.ObservesProperty(() => PasswordBindProp);
 }
        public SignInViewModel(INavigationService navigationService, IUserService userService) :
            base(navigationService)
        {
            var c = System.Globalization.CultureInfo.CurrentUICulture;

            SignInCommand = new DelegateCommand(async() =>
            {
                HasLongActivity = true;
                var user        = await userService.SignInAsync(Login, Password);
                HasLongActivity = false;
                if (user != null)
                {
                    await navigationService.NavigateAsync("MainListView");
                }
                else
                {
                    UserDialogs.Instance.Alert(new AlertConfig()
                    {
                        Title    = TextResources.Error,
                        Message  = TextResources.UserNotFound,
                        OkText   = TextResources.Ok,
                        OnAction = () => Password = ""
                    });
                }
            },
                                                () => Login.Length != 0 && Password.Length != 0 && !HasLongActivity
                                                );

            SignInCommand.ObservesProperty(() => Login);
            SignInCommand.ObservesProperty(() => Password);
            SignInCommand.ObservesProperty(() => HasLongActivity);

            SignUpCommand = new DelegateCommand(() => navigationService.NavigateAsync("SignUpView"));
        }
예제 #7
0
        public LoginViewModel(INavigationService navigationService, ODataClient oDataClient, HttpClient httpClient, IPageDialogService pageDialogService, ISecurityService securityService)
        {
            LoginUsingCredentionals = new DelegateCommand(async() =>
            {
                try
                {
                    await securityService.LoginWithCredentials(UserName, Password);
                    await navigationService.NavigateAsync("/Nav/Main");
                }
                catch
                {
                    await pageDialogService.DisplayAlertAsync("Login failed", "Login failed", "Ok");
                    throw;
                }
            }, () => !string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password));

            LoginUsingCredentionals.ObservesProperty(() => UserName);
            LoginUsingCredentionals.ObservesProperty(() => Password);

            LoginUsingGooglePlus = new DelegateCommand(async() =>
            {
                try
                {
                    await securityService.Login(new { SignInType = "Google" });
                    await navigationService.NavigateAsync("/Nav/Main");
                }
                catch
                {
                    await pageDialogService.DisplayAlertAsync("Login failed", "Login failed", "Ok");
                    throw;
                }
            });
        }
예제 #8
0
 private void InitSaveCommand()
 {
     SaveCommand = new DelegateCommand <object>(OnSave, CanExecuteSave);
     SaveCommand.ObservesProperty(() => IsNotBusy);
     SaveCommand.ObservesProperty(() => TableBindProp.TableName);
     SaveCommand.ObservesProperty(() => TableBindProp.TableSize);
     SaveCommand.ObservesProperty(() => TableBindProp.TableType);
 }
예제 #9
0
 public AgregarProductoViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
     : base(navigationService)
 {
     _pageDialogService = pageDialogService;
     AgregarProducto    = new DelegateCommand(EjecutaAgregarProducto);
     AgregarProducto.ObservesProperty(() => Nombre);
     AgregarProducto.ObservesProperty(() => Codigo);
 }
예제 #10
0
        public AViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;

            UpdateCommand = new DelegateCommand(Execute, CanExecute);
            UpdateCommand.ObservesProperty(() => FirstName);
            UpdateCommand.ObservesProperty(() => LastName);
        }
 public MainWindowViewModel()
 {
     this.DateOfBirth = DateTime.Now;
     SaveCommand      = new DelegateCommand(SaveCustomer, IsValidModel);
     SaveCommand.ObservesProperty(() => Name);
     SaveCommand.ObservesProperty(() => Address);
     SaveCommand.ObservesProperty(() => DateOfBirth);
 }
 public ContactMePageViewModel(IPageDialogService pageDialog, INavigationService navigationService) : base(navigationService)
 {
     _pageDialog = pageDialog;
     SendCommand = new DelegateCommand(Send, CanSend);
     SendCommand.ObservesProperty(() => Email);
     SendCommand.ObservesProperty(() => Subject);
     SendCommand.ObservesProperty(() => Details);
     Validate();
 }
예제 #13
0
 private void InitAddMemberCommand()
 {
     AddMemberCommand = new DelegateCommand <object>(OnAddMember, CanAdd);
     AddMemberCommand.ObservesProperty(() => IsNotBusyBindProp);
     AddMemberCommand.ObservesProperty(() => NameMemberBindProp);
     AddMemberCommand.ObservesProperty(() => GenderMemberBindProp);
     AddMemberCommand.ObservesProperty(() => PhoneNumberMemberBindProp);
     AddMemberCommand.ObservesProperty(() => EmailBindProp);
 }
예제 #14
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainWindowViewModel()
        {
            // コマンドを定義
            StartScanCommand = new DelegateCommand(ExecuteStartScanCommand, CanExecuteStartScanCommand);
            StartScanCommand.ObservesProperty(() => SelectedCaptureDevice);
            StartScanCommand.ObservesProperty(() => IsBusy);

            // デバイス一覧取得
            DeviceList = CaptureDeviceList.Instance;
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="regionManager"></param>
        /// <param name="eventAggregator"></param>
        public LoginPageViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            // インタフェースを受け取る
            _regionManager   = regionManager;
            _eventAggregator = eventAggregator;

            // コマンドを定義
            LoginCommand = new DelegateCommand(ExecuteLogin, CanExecuteLogin);
            LoginCommand.ObservesProperty(() => UserID);
            LoginCommand.ObservesProperty(() => Password);
        }
예제 #16
0
 public EditEmployeeViewModel(IApplicationStateManager applicationStateManager,
                              IService <Employee> employeesService,
                              AbstractValidator <Employee> employeeValidator)
 {
     _applicationStateManager = applicationStateManager;
     _employeesService        = employeesService;
     _employeeValidator       = employeeValidator;
     PositionsNames           = typeof(Positions).GetEnumNames();
     SaveCommand = new DelegateCommand(OnSave, CanSave);
     SaveCommand.ObservesProperty(() => Name);
     SaveCommand.ObservesProperty(() => SelectedPosition);
     CancelCommand = new DelegateCommand(OnCancel);
 }
예제 #17
0
        public ReceiptListViewModel(IReceiptRepo repo)
        {
            // Initialisierung des Repositories
            _repo = repo;

            SearchCommand = new DelegateCommand(async () => await Search());
            SearchCommand.ObservesProperty(() => SearchTerm);

            ReceiptList = new List<Receipt>
            {
                new Receipt
                {
                    Title = "Rezept 1",
                    IsFavorit = false
                },
                new Receipt
                {
                    Title = "Rezept 2",
                    IsFavorit = false
                },
                new Receipt
                {
                    Title = "Rezept 3",
                    IsFavorit = true
                },
                new Receipt
                {
                    Title = "Rezept 4",
                    IsFavorit = false
                }
            };
        }
예제 #18
0
 public PVViewModel(ICC cc, IEventAggregator _e)
 {
     PC = new DelegateCommand(e, c);
     PC.ObservesProperty(() => IC);
     cc.CCS.RegisterCommand(PC);
     ea = _e;
 }
예제 #19
0
 public LVViewModel(ICC cc, IEventAggregator _e)
 {
     PC = new DelegateCommand(e, c);
     PC.ObservesProperty(() => IC);
     cc.CCS.RegisterCommand(PC);
     ea = _e;
     ev = ea.GetEvent <EA>();
     hs(true);
 }
예제 #20
0
 public ListAccountsPageViewModel(IConfiguration configuration)
 {
     _configuration       = configuration;
     _bypassSslHandler    = new BypassSslValidationClientHandler();
     _client              = new HttpClient(_bypassSslHandler);
     AccountTappedCommand = new DelegateCommand <object>(AccountTapped);
     DeleteAccountCommand = new DelegateCommand(DeleteAccount, IsAuthorizedToDeleteAccount);
     DeleteAccountCommand.ObservesProperty(() => IdPassportInputValue);
 }
예제 #21
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="regionManager"></param>
        /// <param name="eventAggregator"></param>
        public ConfigureUsersPageViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            // インタフェースを受け取る
            _regionManager   = regionManager;
            _eventAggregator = eventAggregator;

            // コマンドを定義
            CreateNewCommand = new DelegateCommand(ExecuteCreateNewCommand);
            UpdateCommand    = new DelegateCommand(ExecuteUpdateCommand, CanExecuteUpdateCommand);
            UpdateCommand.ObservesProperty(() => SelectedUser);
            UpdateCommand.ObservesProperty(() => SelectedUser.Name);
            DeleteCommand = new DelegateCommand(ExecuteDeleteCommand, CanExecuteDeleteCommand);
            DeleteCommand.ObservesProperty(() => SelectedUser);
            GoBackCommand = new DelegateCommand(ExecuteGoBackCommand);

            RefreshUsers();
            SelectedUser = new User();
        }
예제 #22
0
        public LoginViewModel(IRegionManager regionManager, IUserService userService, IDialogService dialogService,
                              IMessageResourceManager messageResourceManager)
        {
            //inject login service
            _regionManager          = regionManager;
            _userService            = userService;
            _dialogService          = dialogService;
            _messageResourceManager = messageResourceManager;

            LoginCommand = new DelegateCommand(Login, CanLogin);
            LoginCommand.ObservesProperty(() => Username);
        }
예제 #23
0
        public MainPageViewModel(Services.INorthwindService northwindService, INavigationService navigationService)
        {
            this.northwindService  = northwindService;
            this.navigationService = navigationService;

            northwindService.GetCustomersAsync()
            .ContinueWith(antc => this.Customers = antc.Result,
                          System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext());

            addNewCommand       = new DelegateCommand(AddNewCustomer);
            editCustomerCommand = new DelegateCommand(EditCustomer, IsCustomerAvailable);
            editCustomerCommand.ObservesProperty(() => this.SelectedCustomer);
            deleteCustomerCommand = new DelegateCommand(DeleteCustomer, IsCustomerAvailable);
            deleteCustomerCommand.ObservesProperty(() => this.SelectedCustomer);
            detailsCommand = new DelegateCommand(ShowDetails);
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="regionManager"></param>
        /// <param name="eventAggregator"></param>
        public LotteryPageViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            // インタフェースを受け取る
            _regionManager   = regionManager;
            _eventAggregator = eventAggregator;
            _eventAggregator.GetEvent <MessageSentEvent>().Subscribe(SelectedUsersReceived);

            // コマンドを定義
            StopCommand = new DelegateCommand(ExecuteStopCommand, CanExecuteStopCommand);
            StopCommand.ObservesProperty(() => IsStopped);
            GoBackCommand = new DelegateCommand(ExecuteGoBackCommand);

            Result = new List <User>(SelectedUsers);

            // 抽選開始
            Loaded();
        }
예제 #25
0
        public MainViewModel(ICustomersService customersService)
        {
            this.customersService = customersService;
            status = "Loading";
            this.customersService.GetCustomersAsync()
            .ContinueWith(antc => Customers = antc.Result);

            addNewCommand       = new DelegateCommand(AddNewCustomer);
            editCustomerCommand = new DelegateCommand <Customer>(EditCustomer, CanEditCustomer);
            editCustomerCommand.ObservesProperty(() => this.SelectedCustomer);
            deleteCustomerCommand = new DelegateCommand <Customer>(DeleteCustomer, CanDeleteCustomer);
            deleteCustomerCommand.ObservesProperty(() => this.SelectedCustomer);
            detailsCommand = new DelegateCommand <Customer>(ShowDetails);

            customerUpdateInteraction  = new InteractionRequest <Confirmation>();
            customerDetailsInteraction = new InteractionRequest <Notification>();
        }
예제 #26
0
        public ReceiptListViewModel(IReceiptRepo repo, INavigationService navigationService,
                                    IApiService apiService)
        {
            if (repo == null)
            {
                throw new ArgumentNullException(nameof(repo));
            }

            // Initialisierung des Repositories
            _repo         = repo;
            _navService   = navigationService;
            _apiService   = apiService;
            SearchCommand = new DelegateCommand(async() => await Search());
            SearchCommand.ObservesProperty(() => SearchTerm);

            AddNewCommand = new DelegateCommand(async() => await AddNew());

            EditCommand = new DelegateCommand <Receipt>(async receipt => await Edit(receipt));
        }
예제 #27
0
        public TrialPageViewModel(INavigationService navigationService) : base(navigationService)
        {
            _navigationService = navigationService;
            User = new Users();

            //Validation
            RequestTrialCommand = new DelegateCommand(SaveTrialData, ValidateTrialData);
            RequestTrialCommand.ObservesProperty(() => User.CompanyName);
            RequestTrialCommand.ObservesProperty(() => User.Email);
            RequestTrialCommand.ObservesProperty(() => User.FirstName);
            RequestTrialCommand.ObservesProperty(() => User.LastName);
            RequestTrialCommand.ObservesProperty(() => User.Gender);
            RequestTrialCommand.ObservesProperty(() => User.PhoneNumber);
        }
예제 #28
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="regionManager"></param>
        /// <param name="eventAggregator"></param>
        public TopPageViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            // インタフェースを受け取る
            _regionManager   = regionManager;
            _eventAggregator = eventAggregator;

            // コマンドを定義
            AddUserToSelectedUsersCommand = new DelegateCommand(ExecuteAddUserToSelectedUsersCommand, CanExecuteAddUserToSelectedUsersCommand);
            AddUserToSelectedUsersCommand.ObservesProperty(() => SelectedUserInAllUsers);
            RemoveUserFromSelectedUsersCommand = new DelegateCommand(ExecuteRemoveUserFromSelectedUsersCommand, CanExecuteRemoveUserFromSelectedUsersCommand);
            RemoveUserFromSelectedUsersCommand.ObservesProperty(() => SelectedUserInSelectedUsers);
            StartCommand = new DelegateCommand(ExecuteStartCommand, CanExecuteStartCommand);
            StartCommand.ObservesProperty(() => SelectedUsers.Count);
            ConfigureUsersCommand = new DelegateCommand(ExecuteConfigureUsersCommand);
            ShowHistoriesCommand  = new DelegateCommand(ExecuteShowHistoriesCommand, CanExecuteShowHistoriesCommand);
            ShowHistoriesCommand.ObservesProperty(() => Sessions.Count);

            AllUsers = UsersDataStore.GetUsers();
            Sessions = SessionsDataStore.GetSessions();
        }
 public MyViewModel()
 {
     MyCommand = new DelegateCommand(MyCommandMethod, CanExecuteMyCommandMethod);
     MyCommand.ObservesProperty((() => myproperty1));
     MyCommand.ObservesProperty((() => myproperty2));
 }
예제 #30
0
 private void InitSaveCommand()
 {
     SaveCommand = new DelegateCommand <object>(OnSave, CanExecuteSave);
     SaveCommand.ObservesProperty(() => IsNotBusy);
     SaveCommand.ObservesProperty(() => SelectedItems);
 }