public void Load(OpenStackAPI OSAPI, OSContainer container, OSFolder folder) { this.OSAPI = OSAPI; this.OSContainer = container; this.OSFolder = folder; HubicDriveForm form = this.GetForm(); this.Items.Clear(); form.downloadToolButton.Enabled = true; ListViewItem item; ListViewItem.ListViewSubItem[] subItems; OSFile file; foreach (KeyValuePair <string, OSFile> entry in this.OSFolder.Files) { file = entry.Value; item = new ListViewItem(file.Name, 1); item.Tag = file; subItems = new ListViewItem.ListViewSubItem[] { new ListViewItem.ListViewSubItem(item, file.Size), new ListViewItem.ListViewSubItem(item, file.LastModified) }; item.SubItems.AddRange(subItems); this.Items.Add(item); } this.Enabled = true; }
private void DeleteContainerToolStripButton_Click(object sender, EventArgs e) { OSContainer container = containersComboBox.GetSelectedContainer(); ConfirmationForm cForm = new ConfirmationForm("Do you really want to delete the container " + container.Name, containersComboBox.Delete); cForm.Show(); }
public void Load(OpenStackAPI OSAPI, OSContainer container, bool reload = false) { this.OSAPI = OSAPI; this.OSContainer = container; if (this.Nodes.Count == 0 || reload) { this.Nodes.Clear(); TreeNode node = new TreeNode(this.OSContainer.Name); node.Name = this.OSContainer.Name; node.Tag = new OSFolder("", "", "0", "", ""); this.Nodes.Add(node); } this.Enabled = true; this.SelectedNode = this.Nodes[this.OSContainer.Name]; }
public async void Load(OpenStackAPI OSAPI, bool reload = false) { this.OSAPI = OSAPI; HubicDriveForm form = this.GetForm(); form.GetConnectionStatus().SetStatus("Status: reading containers...", true); OSContainer container; if (this.OSContainers == null || reload) { this.Items.Clear(); JArray jsonObjects = await this.OSAPI.GetObjects(); this.OSContainers = new Dictionary <string, OSContainer>(); for (int i = 0; i < jsonObjects.Count; i++) { container = new OSContainer( jsonObjects[i]["count"].ToString(), jsonObjects[i]["bytes"].ToString(), jsonObjects[i]["name"].ToString() ); this.OSContainers.Add(container.Name, container); if (container.Name.IndexOf("_segments") != -1) { continue; } this.Items.Add(container.Name); } } this.Enabled = true; this.SelectedIndex = this.FindStringExact("default"); form.GetConnectionStatus().SetStatus("Status: connected"); }
public async void Create(string name) { HubicDriveForm form = this.GetForm(); form.GetConnectionStatus().SetStatus("Status: creating container " + name + "...", true); if (!await OSAPI.CreateObject(name)) { MessageBox.Show("Failed creating the container " + name, "Communication error", MessageBoxButtons.OK, MessageBoxIcon.Error); form.GetConnectionStatus().SetStatus("Status: connected"); return; } OSContainer container = new OSContainer("0", "0", name); this.OSContainers.Add(name, container); this.Items.Add(name); this.SelectedItem = name; form.GetConnectionStatus().SetStatus("Status: connected"); }