public DatabaseNodeViewModel( AccountNodeViewModel account, CosmosDatabase database, IDatabaseContext context, DatabaseCommands databaseCommands, ContainerCommands containerCommands, IViewModelFactory viewModelFactory, IMessenger messenger) { Account = account; Id = database.Id; Context = context; _viewModelFactory = viewModelFactory; Commands = new[] { new CommandViewModel("Create container", containerCommands.CreateCommand, this), CommandViewModel.Separator(), new CommandViewModel("Refresh", RefreshCommand), CommandViewModel.Separator(), new CommandViewModel("Create database", databaseCommands.CreateCommand, Account), new CommandViewModel("Edit database", databaseCommands.EditCommand, this), new CommandViewModel("Delete database", databaseCommands.DeleteCommand, this), }; messenger.Subscribe(this).To <ContainerCreatedMessage>((vm, message) => vm.OnContainerCreated(message)); messenger.Subscribe(this).To <ContainerDeletedMessage>((vm, message) => vm.OnContainerDeleted(message)); }
public AccountNodeViewModel( CosmosAccount account, IAccountContext context, AccountFolderNodeViewModel?parent, AccountCommands accountCommands, DatabaseCommands databaseCommands, IViewModelFactory viewModelFactory, IMessenger messenger, IClientPool clientPool) { Id = account.Id; Context = context; Parent = parent; _viewModelFactory = viewModelFactory; _clientPool = clientPool; _name = account.Name; Commands = new[] { new CommandViewModel("Create database", databaseCommands.CreateCommand, this), CommandViewModel.Separator(), new CommandViewModel("Refresh", RefreshCommand), CommandViewModel.Separator(), new CommandViewModel("Add account", accountCommands.AddCommand, Parent), new CommandViewModel("Edit account", accountCommands.EditCommand, this), new CommandViewModel("Remove account", accountCommands.RemoveCommand, this), }; messenger.Subscribe(this).To <AccountEditedMessage>((vm, message) => vm.OnAccountEdited(message)); messenger.Subscribe(this).To <DatabaseCreatedMessage>((vm, message) => vm.OnDatabaseCreated(message)); messenger.Subscribe(this).To <DatabaseDeletedMessage>((vm, message) => vm.OnDatabaseDeleted(message)); }
public TriggersFolderNodeViewModel( IContainerContext containerContext, NonLeafTreeNodeViewModel parent, ScriptCommands <CosmosTrigger> commands, IViewModelFactory viewModelFactory) : base("Triggers", containerContext, parent, viewModelFactory) { Commands = new[] { new CommandViewModel($"New trigger", commands.CreateCommand, this), CommandViewModel.Separator(), new CommandViewModel("Refresh", RefreshCommand) }; }
public UserDefinedFunctionsFolderNodeViewModel( IContainerContext containerContext, NonLeafTreeNodeViewModel parent, ScriptCommands <CosmosUserDefinedFunction> commands, IViewModelFactory viewModelFactory) : base("User-defined functions", containerContext, parent, viewModelFactory) { Commands = new[] { new CommandViewModel($"New user-defined function", commands.CreateCommand, this), CommandViewModel.Separator(), new CommandViewModel("Refresh", RefreshCommand), }; }
public StoredProceduresFolderNodeViewModel( IContainerContext context, NonLeafTreeNodeViewModel parent, ScriptCommands <CosmosStoredProcedure> commands, IViewModelFactory viewModelFactory) : base("Stored procedures", context, parent, viewModelFactory) { Commands = new[] { new CommandViewModel($"New stored procedure", commands.CreateCommand, this), CommandViewModel.Separator(), new CommandViewModel("Refresh", RefreshCommand) }; }
public ContainerNodeViewModel( DatabaseNodeViewModel database, CosmosContainer container, IContainerContext context, ContainerCommands containerCommands, IViewModelFactory viewModelFactory) { Database = database; Id = container.Id; Context = context; _containerCommands = containerCommands; _viewModelFactory = viewModelFactory; Commands = new[] { new CommandViewModel("New query sheet", containerCommands.NewQuerySheetCommand, this, isDefault: true), CommandViewModel.Separator(), new CommandViewModel("Refresh", RefreshCommand), CommandViewModel.Separator(), new CommandViewModel("Create container", containerCommands.CreateCommand, Database), new CommandViewModel("Edit container", containerCommands.EditCommand, this), new CommandViewModel("Delete container", containerCommands.DeleteCommand, this), }; }