public static AemInstance GetActionInstance(Object pSender)
{
AemInstance instance = null;
if (pSender is AemInstance) {
instance = (AemInstance)pSender;
}
else if (pSender is MenuItem) {
instance = (AemInstance)((MenuItem)pSender).Tag;
}
if (instance == null && Program.AemManagerForm.Visible) {
instance = Program.AemManagerForm.SelectedInstanceInListview;
}
return instance;
}