/// <summary> /// Creates a new Viewmodel. /// </summary> /// <param name="parent"></param> /// <param name="EditMode">If set to to true, the fields contains values from the current company</param> public EditCompanyViewModel(BackstageViewModel parent, bool EditMode) { ParentViewModel = parent; this.EditMode = EditMode; if (EditMode) BackstageTabItem = new EditContentTabItem() { DataContext = this }; else BackstageTabItem = new ContentTabItem() { DataContext = this }; CompanyInformation = new Core.Models.CompanyInformation(); CompanySettings = new Core.Models.CompanySettings(); }
public async Task LoadData() { if (EditMode) { CompanyInformation = ParentViewModel.ParentViewModel.Database.CurrentCompany; CompanySettings = (Biller.Core.Models.CompanySettings)(await ParentViewModel.ParentViewModel.Database.AllStorageableItems(new Biller.Core.Models.CompanySettings())).FirstOrDefault(); if (CompanySettings == null) CompanySettings = new Biller.Core.Models.CompanySettings(); } else { CompanyInformation = new Core.Models.CompanyInformation(); CompanySettings = new Core.Models.CompanySettings(); } }