Пример #1
0
        private void modifyInstanceTypeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InstanceConfigFrm itypesForm = new InstanceConfigFrm();
            List <string>     EC2Types   = new List <string> {
            };

            EC2Types = MyAWSService.GetListOfEC2Types();


            itypesForm.Show();
        }
Пример #2
0
        private void newInstanceLikeThisWithChangesToolStripMenuItem_Click(object sender, EventArgs e)
        // new instance + change type
        {
            AWSServices.EC2Instance selectedobj;
            InstanceConfigFrm       itypeConfigForm = new InstanceConfigFrm();

            string ReturnMsg = "";
            string instId    = "";

            itypeConfigForm.ShowDialog();



            string itype     = itypeConfigForm.InstTypeslistBox.GetItemText(itypeConfigForm.InstTypeslistBox.SelectedItem);
            string pubiptxt  = itypeConfigForm.PubIPcomboBox.Text;
            string myami     = itypeConfigForm.AMItextBox.Text;
            string newSG     = itypeConfigForm.SGtextBox.Text;
            string keyName   = itypeConfigForm.KeytextBox.Text;
            string privateIP = itypeConfigForm.PrivateIPtextBox.Text;
            string nametag   = itypeConfigForm.InstNametextBox.Text;
            string subnetid  = itypeConfigForm.SubnetIdtextBox.Text;

            int rootDiskSize;

            if (itypeConfigForm.RoodDiskSizetextBox.Text.Length != 0)
            {
                rootDiskSize = int.Parse(itypeConfigForm.RoodDiskSizetextBox.Text);
            }
            else
            {
                rootDiskSize = 0;
            }

            bool pubipbool = false;

            if (pubiptxt == "True")
            {
                pubipbool = true;
            }
            else
            {
                pubipbool = false;
            }



            foreach (ListViewItem lvitem in EC2listView.SelectedItems)
            {
                instId = lvitem.SubItems[0].Text;

                selectedobj = ec2obj_list.Find(ec2inst => ec2inst.getid() == instId);
                if (myami.Length == 0)
                {
                    myami = selectedobj.getAmiId();
                }

                if (keyName.Length == 0)
                {
                    keyName = selectedobj.getKeyName();
                }

                if (itype.Length == 0)
                {
                    itype = selectedobj.getType();
                }

                if (subnetid.Length == 0)
                {
                    subnetid = selectedobj.getSubnetId();
                }


                ReturnMsg = MyAWSService.lunchInstance(ec2, myami, subnetid, keyName, itype, selectedobj.getSG(), pubipbool, selectedobj.getVpcId(), newSG, privateIP, nametag, rootDiskSize);
            }



            if (ReturnMsg != "Done")
            {
                MessageBox.Show("Problem: " + ReturnMsg);
            }
            refreshToolStripMenuItem_Click(sender, e);
        }