This class represents a button in the action bar in the Cloud Explorer UI.
Inheritance: Model
Exemple #1
0
        public CloudExplorerViewModel(SelectionUtils selectionUtils)
        {
            _selectionUtils = selectionUtils;

            // Contains the list of sources to display to the user, in the order they will
            // be displayed.

            _sources = new List <ICloudExplorerSource>
            {
                // The Google App Engine source.
                new GaeSource(this),

                // The Google Compute Engine source.
                new GceSource(this),

                // The Google Cloud Storage source.
                new GcsSource(this),

                // The Google Cloud SQL source.
                new CloudSQLSource(this),

                // The Google Publish/Subscription source.
                new PubsubSource(this),

                // The source to navigate to the cloud console.
                new CloudConsoleSource(),
            };

            var refreshButtonEnumerable = new ButtonDefinition[]
            {
                new ButtonDefinition
                {
                    Icon    = s_refreshIcon.Value,
                    ToolTip = Resources.CloudExplorerRefreshButtonToolTip,
                    Command = new ProtectedCommand(OnRefreshCommand),
                }
            };

            Buttons = Enumerable.Concat(refreshButtonEnumerable, _sources.SelectMany(x => x.Buttons));

            ManageAccountsCommand = new ProtectedCommand(OnManageAccountsCommand);

            CredentialsStore.Default.CurrentAccountChanged   += OnCurrentAccountChanged;
            CredentialsStore.Default.CurrentProjectIdChanged += OnCurrentProjectIdChanged;
            CredentialsStore.Default.Reset += OnReset;

            ResetCredentials();
        }
        public CloudExplorerViewModel(SelectionUtils selectionUtils)
        {
            _selectionUtils = selectionUtils;

            // Contains the list of sources to display to the user, in the order they will
            // be displayed.

            _sources = new List<ICloudExplorerSource>
            {
                // The Google App Engine source.
                new GaeSource(this),

                // The Google Compute Engine source.
                new GceSource(this),

                // The Google Cloud Storage source.
                new GcsSource(this),

                // The Google Cloud SQL source.
                new CloudSQLSource(this),

                // The source to navigate to the cloud console.
                new CloudConsoleSource(),
            };

            var refreshButtonEnumerable = new ButtonDefinition[]
            {
                new ButtonDefinition
                {
                    Icon = s_refreshIcon.Value,
                    ToolTip = Resources.CloudExplorerRefreshButtonToolTip,
                    Command = new ProtectedCommand(OnRefreshCommand),
                }
            };
            Buttons = Enumerable.Concat(refreshButtonEnumerable, _sources.SelectMany(x => x.Buttons));

            ManageAccountsCommand = new ProtectedCommand(OnManageAccountsCommand);

            CredentialsStore.Default.CurrentAccountChanged += OnCurrentAccountChanged;
            CredentialsStore.Default.CurrentProjectIdChanged += OnCurrentProjectIdChanged;
            CredentialsStore.Default.Reset += OnReset;

            ResetCredentials();
        }