private void OnMenuItemClick(object sender, System.EventArgs e)
        {
            SnapInDescriptor descriptor = null;

            try
            {
                ListViewItem item = _listView.SelectedItems[0];
                if (item != null)
                {
                    descriptor = item.Tag as SnapInDescriptor;
                }
            }
            catch (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }

            MenuItem menuItem = sender as MenuItem;

            if (menuItem != null)
            {
                if (menuItem == menuItemStart)
                {
                    if (descriptor != null)
                    {
                        SnapInHostingEngine.StartWithProgress(descriptor);
                    }
                }

                if (menuItem == menuItemStop)
                {
                    if (descriptor != null)
                    {
                        SnapInHostingEngine.StopWithProgress(descriptor);
                    }
                }

                if (menuItem == menuItemReinstall)
                {
                    if (descriptor != null)
                    {
                        SnapInHostingEngine.ReinstallWithProgress(descriptor);
                    }
                }

                if (menuItem == menuItemUninstall)
                {
                    if (descriptor != null)
                    {
                        SnapInHostingEngine.StopAndUninstallWithProgress(descriptor);
                    }
                }

                if (menuItem == menuItemProperties)
                {
                    if (descriptor != null)
                    {
                        SnapInDescriptorPropertyWindow window = new SnapInDescriptorPropertyWindow(descriptor);
                        window.ShowDialog(this);
                    }
                }
            }
        }
 private void buttonStop_Click(object sender, System.EventArgs e)
 {
     SnapInHostingEngine.StopWithProgress(_descriptor);
     this.UpdateButtonsBasedOnAdvice();
 }