private void DeleteSelectedBlob() { Dialog.ConfirmYesOrNo("Are you sure you want ot delete blob " + (Grid.SelectedItem as CloudBlob).Name + "?", () => { var operation = new ProgressOperation() { Message = "Deleting blob ".ToConsoleString() + (Grid.SelectedItem as CloudBlob).Name.ToConsoleString(ConsoleColor.Yellow), State = OperationState.InProgress }; Application.MessagePump.QueueAsyncAction((Grid.SelectedItem as CloudBlob).DeleteAsync(), (tp) => { if (tp.Exception != null) { operation.State = OperationState.Failed; operation.Details = tp.Exception.ToString().ToConsoleString(); operation.Message = "Failed to delete blob ".ToConsoleString() + (Grid.SelectedItem as CloudBlob).Name.ToConsoleString(ConsoleColor.Yellow); } else { operation.State = OperationState.Completed; operation.Message = "Finished deleting blob ".ToConsoleString() + (Grid.SelectedItem as CloudBlob).Name.ToConsoleString(ConsoleColor.Yellow); } if (Application != null && PageStack.CurrentPage == this) { PageStack.TryRefresh(); } }); }); }
private void ForgetSelectedStorageAccount() { var selectedAccount = Grid.SelectedItem as StorageAccountInfo; Dialog.ConfirmYesOrNo("Are you sure you want to forget storage account " + selectedAccount.AccountName, () => { (Grid.DataSource as MemoryDataSource).Items.Remove(selectedAccount); StorageAccountInfo.Save((Grid.DataSource as MemoryDataSource).Items); PageStack.TryRefresh(); }); }
private void UploadBlob() { Dialog.ShowTextInput("Choose file".ToConsoleString(), (f) => { var operation = new ProgressOperation() { Message = "Uploading file ".ToConsoleString() + f.ToConsoleString(), State = OperationState.Scheduled }; ProgressOperationManager.Operations.Add(operation); if (File.Exists(f.ToString()) == false) { operation.State = OperationState.Failed; operation.Message = "File not found - ".ToConsoleString() + f; } else { Dialog.ShowTextInput("Enter blob prefix".ToConsoleString(), (pre) => { var blobPath = System.IO.Path.Combine(pre.ToString(), System.IO.Path.GetFileName(f.ToString())); var blob = container.GetBlockBlobReference(blobPath); Application.MessagePump.QueueAsyncAction(blob.UploadFromFileAsync(f.ToString(), FileMode.Open), (t) => { if (t.Exception != null) { operation.State = OperationState.Failed; operation.Message = operation.Message = "Failed to upload file ".ToConsoleString() + f.ToConsoleString(); operation.Details = t.Exception.ToString().ToConsoleString(); } else { operation.State = OperationState.Completed; operation.Message = operation.Message = "Finished uploading file ".ToConsoleString() + f.ToConsoleString(); if (Application != null && PageStack.CurrentPage == this) { PageStack.TryRefresh(); } } }); }, () => { operation.State = OperationState.CompletedWithWarnings; operation.Message = "Cancelled uploading file ".ToConsoleString() + f.ToConsoleString(); }); } }); }
private void DeleteSelectedContainer() { Dialog.ConfirmYesOrNo("Are you sure you want ot delete container " + (Grid.SelectedItem as ContainerRecord).Name + "?", () => { var container = currentStorageAccount.CreateCloudBlobClient().GetContainerReference((Grid.SelectedItem as ContainerRecord).Name); Application.MessagePump.QueueAsyncAction(container.DeleteAsync(), (tp) => { if (Application != null && PageStack.CurrentPage == this) { PageStack.TryRefresh(); } }); }); }
private void DeleteSelectedTable() { Dialog.ConfirmYesOrNo("Are you sure you want ot delete table " + (Grid.SelectedItem as CloudTable).Name + "?", () => { var table = currentStorageAccount.CreateCloudTableClient().GetTableReference((Grid.SelectedItem as CloudTable).Name); var t = table.DeleteAsync(); t.ContinueWith((tPrime) => { if (Application != null) { PageStack.TryRefresh(); } }); }); }
private void AddTable() { Dialog.ShowTextInput("Enter table name".ToConsoleString(), (name) => { if (name != null) { var t = currentStorageAccount.CreateCloudTableClient().GetTableReference(name.ToString()).CreateAsync(); t.ContinueWith((tPrime) => { if (Application != null) { PageStack.TryRefresh(); } }); } }); }
private void AddContainer() { Dialog.ShowTextInput("Enter container name".ToConsoleString(), (name) => { if (name != null) { var t = currentStorageAccount.CreateCloudBlobClient().GetContainerReference(name.ToString()).CreateAsync(); Application.MessagePump.QueueAsyncAction(t, (tp) => { if (Application != null) { PageStack.TryRefresh(); } }); } }); }