public SettingsViewModel(IAccesibleFolders accesibleFolders, ISettingsStore settingsStore, IVirtualDashboardRepository virtualDashboardRepository) { this.settingsStore = settingsStore; this.virtualDashboardRepository = virtualDashboardRepository; AddFolder = ReactiveCommand.CreateFromTask(accesibleFolders.Add); disposable = accesibleFolders.Folders .Connect() .Transform(x => new FolderViewModel(x, accesibleFolders)) .Bind(out folders) .Subscribe(); UnitPack = UnitPacks.FirstOrDefault(pack => pack.Id == StringUnitPack) ?? UnitPacks.First(); this.WhenAnyValue(x => x.UnitPack).Subscribe(x => StringUnitPack = UnitPack.Id); dashboardPreview = this.WhenAnyValue(x => x.VirtualDashboard, x => x.UnitPack, (vd, up) => SettingsSampleData.CreatePreviewViewModel(up, vd)).ToProperty(this, x => x.DashboardPreview); }
public FolderViewModel(Folder folder, IAccesibleFolders accesibleFolders) { this.folder = folder; Delete = ReactiveCommand.CreateFromTask(() => accesibleFolders.Delete(folder)); }