public AdminViewModel() { PlanSingleton = PlanlægningSingleton.Instance; AddJobPersonCommand = new RelayCommand(AddNewJobPerson, null); RemoveJobPersonCommand = new RelayCommand(RemoveSelectedJobPerson, null); AddMenuCommand = new RelayCommand(AddNewMenu, null); RemoveMenuCommand = new RelayCommand(RemoveSelectedMenu, null); NyLåsCommand = new RelayCommand(AddNyLås, null); RemoveLåsCommand = new RelayCommand(RemoveLås, null); RydAltCommand = new RelayCommand(RydAlt, null); SelectedJob = new JobPerson(); SelectedMenu = new Menu(); Job = new JobPerson(); Menu = new Menu(); AddCBoxOptions(); }
public void AddNewJobPerson() { if (!String.IsNullOrEmpty(Job.JobPersonNavn) && !String.IsNullOrWhiteSpace(Job.JobPersonNavn)) { JobPerson tempJob = new JobPerson(); tempJob.JobDateTime = PlanSingleton.SingletonDateTime; tempJob.JobPersonNavn = Job.JobPersonNavn; tempJob.JobPersonOpgave = JobPersonCBoxOptions[SelectedIndex]; PlanSingleton.AddJobPerson(tempJob); SaveJobList_Async(); OutPutToUser = $"{tempJob.JobPersonNavn} er tildelt {tempJob.JobPersonOpgave}!"; } else { MessageDialog locked = new MessageDialog("Du skal skrive et navn!"); locked.Commands.Add(new UICommand { Label = "Ok" }); locked.ShowAsync().AsTask(); OutPutToUser = ""; } }