public DlgLaunchNewInstance(ZAwsEc2Controller controller, ZAwsAmi ami, ZAwsSecGroup secGroup, ZAwsKeyPair keyPair) { Ami = ami; SecGroup = secGroup; KeyPair = keyPair; Controller = controller; InitializeComponent(); }
private void buttonLaunchEc2Instance_Click(object sender, EventArgs e) { ZAwsAmi ami = null; ZAwsSecGroup secGroup = null; ZAwsKeyPair keyPair = null; foreach (ListViewItem item in awsListView.SelectedItems) { if (item.Tag.GetType() == typeof(ZAwsAmi)) { if (ami != null) { return; } ami = (ZAwsAmi)item.Tag; } if (item.Tag.GetType() == typeof(ZAwsSecGroup)) { if (secGroup != null) { return; } secGroup = (ZAwsSecGroup)item.Tag; } if (item.Tag.GetType() == typeof(ZAwsKeyPair)) { if (keyPair != null) { return; } keyPair = (ZAwsKeyPair)item.Tag; } } if (ami == null || secGroup == null || keyPair == null) { return; } new DlgLaunchNewInstance(controller, ami, secGroup, keyPair).ShowDialog(); }