public HomeViewModel() { _context.Database.EnsureCreated(); _context.Plants.Load(); _context.Locations.Load(); _context.Areas.Load(); IList <Location> locations = _context.Locations.Local.ToObservableCollection(); IList <Area> areas = _context.Areas.Local.ToObservableCollection(); IList <Plant> plants = _context.Plants.Local.ToObservableCollection(); List <Object> allS = (from x in plants select(Object) x).ToList(); allS.AddRange((from x in locations select(Object) x).ToList()); allS.AddRange((from x in areas select(Object) x).ToList()); HomeView = CollectionViewSource.GetDefaultView(allS); groupByLocationCommand = new GroupByLocationCommand(this); //OrderGroupCommand.cs groupByAreaCommand = new GroupByAreaCommand(this); removeGroupCommand = new RemoveGroupCommand(this); saveButtonCommand = new SaveButtonCommand(this); deleteButtonCommand = new DeleteButtonCommand(this); HomeView.GroupDescriptions.Add(new PropertyGroupDescription("AreaName")); HomeView.GroupDescriptions.Add(new PropertyGroupDescription("LocationName")); }
public void RefreshInterfaceButtons() { if (SaveButtonCommand != null) { SaveButtonCommand.RaiseCanExecuteChanged(); } if (DegreExplorationMinusCommand != null) { DegreExplorationMinusCommand.RaiseCanExecuteChanged(); } if (DegreExplorationPlusCommand != null) { DegreExplorationPlusCommand.RaiseCanExecuteChanged(); } }
public SavePageViewModel() { Sbc = new SaveButtonCommand(this); }