void deploy_Click(object sender, RoutedEventArgs e) { ContextMenu cm = (ContextMenu)ContextMenu.ItemsControlFromItemContainer((MenuItem)e.OriginalSource); CEc2Instance ins = (CEc2Instance)((FrameworkElement)(((Panel)(cm.PlacementTarget)).Children[0])).DataContext; if (ins != null) { AppDeployment pw = new AppDeployment(_dashboard); pw.instance = ins; pw.Show(); } }
private void deploy_Click(object sender, RoutedEventArgs e) { try { InstanceList inslist = this.clientR.Children[0] as InstanceList; if (inslist != null) { if (inslist.instancesLV.SelectedItem != null) { CEc2Instance inst = inslist.instancesLV.SelectedItem as CEc2Instance; if (inst != null) { AppDeployment pw = new AppDeployment(this); pw.instance = inst; pw.Show(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }