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));
        }
Exemple #2
0
 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),
     };
 }