void terminate_Click(object sender, RoutedEventArgs e) { try { ContextMenu cm = (ContextMenu)ContextMenu.ItemsControlFromItemContainer((MenuItem)e.OriginalSource); CEc2Instance ins = (CEc2Instance)((FrameworkElement)(((Panel)(cm.PlacementTarget)).Children[0])).DataContext; MessageBoxResult result = MessageBox.Show( "You are about to terminate the selected instance. Are you sure you want to continue?", "Terminate Instance", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No); if (result == MessageBoxResult.No) { return; } if (!string.IsNullOrEmpty(ins.instanceId)) { CEc2Service serv = new CEc2Service(); serv.terminate(ins.instanceId); } else { MessageBox.Show("No instance ID available"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void fetchCommunityAmis() { if (_commAmis == null || _commAmis.Count == 0) { CEc2Service serv = new CEc2Service(); _commAmis = serv.describeImages(null); } }
void fetchMyAmis() { if (_myAmis == null || _myAmis.Count == 0) { CEc2Service serv = new CEc2Service(); _myAmis = serv.describeImages("self"); } }
private void fetchInforThread() { bool exception = false; try { CEc2Service serv = new CEc2Service(); if (_securityGroups.Count == 0) { List <string> sgs = serv.descrbibeSecurityGroups(); foreach (string sg in sgs) { _securityGroups.Add(sg); } } if (_keyPairs.Count == 0) { List <string> kps = serv.descrbibeKeyPairs(); foreach (string kp in kps) { _keyPairs.Add(kp); } } if (_zones.Count == 0) { List <string> zs = serv.descrbibeZones(); foreach (string z in zs) { _zones.Add(z); } } } catch (Exception ex) { MessageBox.Show(ex.Message); exception = true; } Dispatcher.Invoke(new StopProgressbarCallback(disableProgressBar)); if (exception == true) { Dispatcher.Invoke(new DisableLaunchButton(disableLaunchButton)); } }
public void getInstances() { try { if (_instances.Count == 0) { CEc2Service serv = new CEc2Service(); List <CEc2Instance> list = serv.describeInstances(); foreach (CEc2Instance inst in list) { _instances.Add(inst); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } _dashboard.Dispatcher.Invoke(new StopProgressbarCallback(_dashboard.disableProgressBar)); this.Dispatcher.Invoke(new SetBorderThickNessCallback(setBorderThickNess)); fectchingInstance = false; }