Beispiel #1
0
        public AddItem_ViewModel(RegionManager regionManager, IToDoList_Service toDoListService)
        {
            _regionManager       = regionManager;
            _ToDoItemListService = toDoListService;

            _newItem = new ToDoItem();


            //ItemSelectedCommand = new DelegateCommand<ToDoItem>(ItemSelected);

            //GoForwardCommand = new DelegateCommand(GoForward, CanGoForward);
            GoBackCommand = new DelegateCommand(GoBack);
            //SaveCommand = new DelegateCommand(SaveItem, CanSaveItem);
            SaveCommand = new DelegateCommand(SaveItem);

            saveDirty = false;
        }
        public ItemDetail_ViewModel(IToDoList_Service toDoListService)
        {
            _toDoItemListService = toDoListService;

            TempItem = new ToDoItem();
            //this.ItemsCV = CollectionViewSource.GetDefaultView(ToDoItemList);

            //< ToDoItem > = IObservable<ToDoItem>(SelectedItem);
            GoBackCommand    = new DelegateCommand(GoBack);
            CompletedCommand = new DelegateCommand(CompleteItem);
            SaveCommand      = new DelegateCommand(SaveItem);

            ConfirmationRequest = new InteractionRequest <IConfirmation>();
            ConfirmationCommand = new DelegateCommand(RaiseConfirmation);
            // ConfirmationCommand = new DelegateCommand(RaiseConfirmation);

            confirmNavigationCommmand.RegisterCommand(ConfirmationCommand);
            //confirmNavigationCommmand.RegisterCommand(GoBackCommand);

            //contentDirty = false;
        }
Beispiel #3
0
        //public bool IsDateValid { get { return todoitem.dueDate < DateTime.Now; } }

        //public ItemList_ViewModel()
        //{

        //}

        public ItemList_ViewModel(RegionManager regionManager, IToDoList_Service toDoListService)
        {
            //View discovery
            //this.regionManager.RegisterViewWithRegion("ContentRegion", typeof(ItemList_View));

            _regionManager       = regionManager;
            _ToDoItemListService = toDoListService;
            _ToDoItemList        = toDoListService.GetToDoList();

            //ItemSelectedCommand = new DelegateCommand<ToDoItem>(ItemSelected);
            _filterString = "";
            //_filterString = "Search Text...";


            // Initialize the CollectionView for the underlying model
            // and track the current selection.
            this.ItemsCV = CollectionViewSource.GetDefaultView(ToDoItemList);
            //this.ItemsCV = new ListCollectionView(ToDoItemList);
            this.ItemsCV.CurrentChanged += ItemSelected; //new EventHandler(this.ItemSelected); //SelectedItemChanged
            this.ItemsCV.Filter          = SearchFilter;
            SelectedItem = this.ItemsCV.CurrentItem as ToDoItem;

            //Command to navigate to AddItem_View
            GoAddItemCommand = new DelegateCommand(GoAddItem, () => true);
            //Command to navigate to ItemDetail_View
            GoStatsCommand = new DelegateCommand(GoForward, CanGoForward);
            //GoMessage, () => true);
            GoSelectCommand = new DelegateCommand(GoForward, CanGoForward);

            GoDetailCommand   = new DelegateCommand(GoItemDetails, () => true);  //CanGoForward
            GoDeleteCommand   = new DelegateCommand(GoItemDelete, () => true);
            GoCompleteCommand = new DelegateCommand(GoItemComplete, () => true); //CanGoForward

            //GoStatsCommand = new DelegateCommand(() => new IMessage("My Test Message", "A test title"),
            //                ()=>true);

            //this.eventAggregator.GetEvent<PubSubEvent<int>>().Subscribe(this.ItemSelectedEvent, true);
        }