public DocumentViewModel(Document model)
        {
            AddSheet      = new RelayCommand(AddSheetExecute);
            SwitchToSheet = new RelayCommand <int>(SwtichToSheetExecute);

            this.model = model;

            if (model.OpenSheet != null)
            {
                OpenSheet = new SheetViewModel(model.OpenSheet);
            }

            foreach (var sheetData in model.Data.Sheets)
            {
                RegisterSheet(new SheetViewModel(Sheet.Of(sheetData)));
            }
        }
        void AddSheetExecute()
        {
            var vm = new SheetViewModel(model.AddSheet());

            RegisterSheet(vm);
        }
 private void SwtichToSheetExecute(int sheetID)
 {
     model.SwitchToSheet(sheetID);
     OpenSheet = new SheetViewModel(model.OpenSheet);
     RaisePropertyChanged(nameof(OpenSheet));
 }
 private void RegisterSheet(SheetViewModel sheet)
 {
     Sheets.Add(sheet);
 }