public ProductViewModel() { mgr = new InventoryEntities(); product = new ObservableCollection <Product>(); _commands = new CommandMap(); _commands.AddCommand("Add", x => Add(), x => !CanSave()); _commands.AddCommand("Save", x => Save(), x => CanSave()); _commands.AddCommand("Cancel", x => Cancel(), x => CanSave()); _commands.AddCommand("Delete", x => Delete(), x => !CanSave()); _commands.AddCommand("Close", x => Close(), x => !CanSave()); LoadData(); }
private ModuleInfo LoadModuleInternal(ModuleInfo module) { _moduleDefs.Add(module); foreach (var command in module.Commands) { _map.AddCommand(command); } foreach (var submodule in module.Submodules) { LoadModuleInternal(submodule); } return(module); }
public frmProspects_VM() { mgr = new TestsEntities(); prospects = new ObservableCollection <Prospect>(); _commands = new CommandMap(); _commands.AddCommand("Find", x => FindaP()); _commands.AddCommand("Add", x => Add()); _commands.AddCommand("Edit", x => Edit()); _commands.AddCommand("Delete", x => Delete(), x => CanDelete()); _commands.AddCommand("Save", x => Save()); _commands.AddCommand("Cancel", x => Cancel()); }
public StudentViewModel() { studentList = new ObservableCollection <Student.Data.Models.Student>(); studentsRepository = new StudentsRepository(); _commands = new CommandMap(); _commands.AddCommand("Add", x => Add(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("Save", x => Save(), x => CanSave()); _commands.AddCommand("Cancel", x => Cancel(), x => CanSave()); _commands.AddCommand("Delete", x => Delete(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("Close", x => Close(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("New", x => New(), x => CanNew() /*!CanSave()*/); LoadDataAsync().Wait(); StudentListEditMode = EditMode.Update; }
public StudentListViewModel() { studentList = new ObservableCollection <Student.Data.Models.Student>(); studentService = new StudentService(new DefaultHttpClientAccessor()); _commands = new CommandMap(); _commands.AddCommand("Add", x => Add(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("Save", x => Save(), x => CanSave()); _commands.AddCommand("Cancel", x => Cancel(), x => CanSave()); _commands.AddCommand("Delete", x => Delete(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("Close", x => Close(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("New", x => New(), x => CanNew() /*!CanSave()*/); LoadDataAsync(); StudentListEditMode = EditMode.Update; }
public StudentListViewModel(IStudentService studentService) { this.studentService = studentService; studentList = new MTObservableCollection <Student>(); _commands = new CommandMap(); _commands.AddCommand("Add", x => AddAsync().GetAwaiter().GetResult(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("Save", x => SaveAsync().GetAwaiter().GetResult(), x => CanSave()); _commands.AddCommand("Cancel", x => CancelAsync().GetAwaiter().GetResult(), x => CanSave()); _commands.AddCommand("Delete", x => DeleteAsync().GetAwaiter().GetResult(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("Close", x => Close(), x => CanAdd() /*!CanSave()*/); _commands.AddCommand("New", x => New(), x => CanNew() /*!CanSave()*/); LoadDataAsync().GetAwaiter().GetResult(); StudentListEditMode = EditMode.Update; }
public void AddCommand(CommandEvent e) { map.AddCommand(e); }