Example #1
0
        public EditShoppingListViewModel(INavigationService navigationService, IDialogService dialogService)
        {
            //Service
            this.navigationService = navigationService;
            this.dialogService     = dialogService;

            //Commands
            EditShoppingListCommand = new DependentRelayCommand(Edit, IsDataValid, this, () => ListName, () => SelectedShop);
            CancelCommand           = new RelayCommand(Cancel);
        }
        public AddShoppingListItemViewModel(INavigationService navigationService, IDialogService dialogService)
        {
            // Services
            this.navigationService = navigationService;
            this.dialogService     = dialogService;

            // Commands
            AddItemCommand    = new DependentRelayCommand(CreateItem, IsDataValid, this, () => Name, () => AmountAndMeasure);
            DeleteItemCommand = new RelayCommand(DeleteItem);

            // Initialize all Fields with standard values
            InitializeFields();
        }
        public LoadFormDependentRelayCommandWrapper(Type formType, Func<bool> canExecute = null, params INotifyPropertyChanged[] changeableObjects)
        {
            var constructor = formType.GetConstructors().First();
            Command = new DependentRelayCommand(parameter =>
                      	{
                            if (_form == null)
                            {
                                _form = (Window) constructor.Invoke(new object[] { });
                                _form.Show();
                            }
                            else
                                _form.Focus();

                            _form.Closed += (o, e) => { _form = null; };
                      	},canExecute,changeableObjects);
        }
Example #4
0
        public EditShopViewModel(INavigationService navigationService, IDialogService dialogService)
        {
            // Services
            this.navigationService = navigationService;
            this.dialogService     = new DialogService();

            // Commands
            DoneCommand   = new DependentRelayCommand(Edit, IsDataValid, this, () => Name, () => Location);
            CancelCommand = new RelayCommand(Cancel);

            // Get regional-specific values for the Radius out of the Resource-File
            MinimumRadius   = 0.05;
            MaximumRadius   = 1;
            RadiusStepValue = 0.05;
            TickFrequency   = 0.2;
        }
Example #5
0
        public MainPageViewModel(INavigationService navigationService, IDialogService dialogService)
        {
            // Services
            this.navigationService = navigationService;
            this.dialogService     = dialogService;

            // Commands
            AddShopCommand            = new RelayCommand(GoToAddShopPage);
            EditShopCommand           = new RelayCommand(GoToEditShopPage);
            DeleteShopCommand         = new RelayCommand(GoToDeleteShop);
            DetailsShopCommand        = new RelayCommand(GoToDetailsShop);
            AddShoppingListCommand    = new DependentRelayCommand(GoToAddShoppingListPage, AreShopsCreated, this, () => Shops);
            DeleteShoppingListCommand = new RelayCommand(GoToDeleteShoppingList);
            EditShoppingListCommand   = new RelayCommand(GoToEditShoppingListPage);

            // Load data
            shopsFilename         = "shops.json";
            shoppingListsFilename = "lists.json";

            LoadShops();
            LoadShoppingLists();
        }
Example #6
0
 public LoginController(object data) : base(data)
 {
     DoLoginCommand = new DependentRelayCommand(Login, Validate, this, () => Username, () => Password);
     //_loginValidator = new LoginValidator();
 }
Example #7
0
 /// <summary>
 /// Initializes the commands.
 /// </summary>
 private void InitializeCommands()
 {
     cmdMessageSend = new DependentRelayCommand(SendMessage, CanSendMessage,
                                                this, () => UserMessageInput, () => ClientAddress);
 }