public StorageAccountsPage() { Grid.DataSource = new MemoryDataSource() { Items = new List <object>(StorageAccountInfo.Load()) }; Grid.VisibleColumns.Add(new ColumnViewModel(nameof(StorageAccountInfo.AccountName).ToConsoleString(Theme.DefaultTheme.H1Color))); Grid.VisibleColumns.Add(new ColumnViewModel(nameof(StorageAccountInfo.Key).ToConsoleString(Theme.DefaultTheme.H1Color))); Grid.VisibleColumns.Add(new ColumnViewModel(nameof(StorageAccountInfo.UseHttps).ToConsoleString(Theme.DefaultTheme.H1Color))); Grid.NoDataMessage = "No storage accounts"; Grid.KeyInputReceived.SubscribeForLifetime(HandleGridDeleteKeyPress, this.LifetimeManager); addButton = CommandBar.Add(new Button() { Text = "Add account", Shortcut = new KeyboardShortcut(ConsoleKey.A, ConsoleModifiers.Alt) }); deleteButton = CommandBar.Add(new Button() { Text = "Forget account", CanFocus = false, Shortcut = new KeyboardShortcut(ConsoleKey.F, ConsoleModifiers.Alt) }); CommandBar.Add(new NotificationButton(ProgressOperationManager)); addButton.Activated.SubscribeForLifetime(AddStorageAccount, LifetimeManager); deleteButton.Activated.SubscribeForLifetime(ForgetSelectedStorageAccount, LifetimeManager); Grid.SelectedItemActivated += NavigateToStorageAccount; Grid.SubscribeForLifetime(nameof(Grid.SelectedItem), SelectedItemChanged, this.LifetimeManager); }
protected override void OnLoad() { base.OnLoad(); var accountName = RouteVariables["account"]; var accountInfo = (from account in StorageAccountInfo.Load() where account.AccountName == accountName select account).FirstOrDefault(); currentStorageAccount = new CloudStorageAccount(new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(accountName, accountInfo.Key), accountInfo.UseHttps); Grid.DataSource = new ContainerListDataSource(currentStorageAccount.CreateCloudBlobClient(), Application.MessagePump); }
protected override void OnLoad() { base.OnLoad(); var accountName = RouteVariables["account"]; var tableName = RouteVariables["table"]; var accountInfo = (from account in StorageAccountInfo.Load() where account.AccountName == accountName select account).FirstOrDefault(); currentStorageAccount = new CloudStorageAccount(new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(accountName, accountInfo.Key), accountInfo.UseHttps); table = currentStorageAccount.CreateCloudTableClient().GetTableReference(tableName); Grid.DataSource = new TableEntityDataSource(currentStorageAccount.CreateCloudTableClient().GetTableReference(tableName), Application); Grid.DataSource.DataChanged += OnDataLoad; }