private async void btnEc2Stop_Click(object sender, EventArgs e) { var helper = new AwsUtilities.EC2Helper( GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color); var instanceIds = new List <string>(); foreach (DataGridViewRow row in gvEc2Instances.Rows) { if (row.Cells[5].Value != null && (bool)row.Cells[5].Value) { instanceIds.Add(row.Cells[1].Value.ToString()); } } var confirmResult = MessageBox.Show( string.Format("Are you sure to stop EC2 instances: '{0}'?", string.Join(", ", instanceIds), "Confirm Stop EC2 Instances", MessageBoxButtons.YesNo)); if (confirmResult == DialogResult.Yes) { await helper.StopEc2Instances(instanceIds); } }
private async Task PopulateEc2Instances() { //gvEc2Instances.DataSource = null; var helper = new AwsUtilities.EC2Helper( GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color); var selectRegion = ((KeyValuePair <string, string>)ddlEC2Region.SelectedItem).Key; var lstInstances = new List <SA_Ec2Instance>(); if (selectRegion == "All Regions") { //var lstRegions = Regions.GetRegionList(); //foreach (var region in lstRegions) //{ // lstInstances.AddRange(await helper.GetEc2InsatancesList(region.Key)); //} lstInstances = await helper.GetEc2InsatancesList(null); } else { lstInstances = await helper.GetEc2InsatancesList(((KeyValuePair <string, string>)ddlEC2Region.SelectedItem).Key); } if (cboxStateFilter.Checked) { gvEc2Instances.DataSource = lstInstances.FindAll(o => o.State == "running"); } else { gvEc2Instances.DataSource = lstInstances; } //gvEc2Instances.Sort(gvEc2InstancesColState, System.ComponentModel.ListSortDirection.Ascending); }
private async Task PopulateSnapshots() { var helper = new AwsUtilities.EC2Helper( GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color); gvSnapshots.DataSource = await helper.GetAllSnapshots(); }