protected void OnDesignerClosed(object source, EventArgs args)
 {
   Cursor = Cursors.WaitCursor;
   MpeDesigner designer = (MpeDesigner) tabManager.SelectedTab.Tag;
   if (tabManager.SelectedTab.Title.EndsWith("*"))
   {
     MpeSaveForm form = new MpeSaveForm(new MpeDesigner[1] {designer}, tabImageList);
     DialogResult result = form.ShowDialog(this);
     if (result == DialogResult.Cancel)
     {
       Cursor = Cursors.Default;
       return;
     }
     else if (result == DialogResult.Yes)
     {
       OnMenuSave(source, args);
     }
     else if (result == DialogResult.No)
     {
       designer.Cancel();
     }
   }
   selectedDesignerIndex = -1;
   tabManager.TabPages.Remove(tabManager.SelectedTab);
   try
   {
     designer.Destroy();
     if (designer is MpeHelpBrowser)
     {
       helpBrowser = null;
     }
   }
   catch (Exception e)
   {
     MpeLog.Debug(e);
     MpeLog.Error(e);
   }
   if (tabManager.TabPages.Count == 0)
   {
     tabManager.ShowClose = false;
   }
   Cursor = Cursors.Default;
 }
 protected void OnMenuClose(object source, EventArgs e)
 {
   if (skinExplorer.IsSkinLoaded == false)
   {
     return;
   }
   if (DialogResult.No ==
       MessageBox.Show(this, "Are you sure you want to close the current skin?", "Close Confirmation",
                       MessageBoxButtons.YesNo, MessageBoxIcon.Question))
   {
     cancelCommand = true;
     return;
   }
   MpeDesigner[] designers = GetModifiedDesigners();
   if (designers.Length > 0)
   {
     MpeSaveForm form = new MpeSaveForm(designers, tabImageList);
     DialogResult result = form.ShowDialog(this);
     if (result == DialogResult.Cancel)
     {
       return;
     }
     else if (result == DialogResult.Yes)
     {
       for (int i = 0; i < form.SelectedDesigners.Length; i++)
       {
         try
         {
           form.SelectedDesigners[i].Save();
         }
         catch (Exception ee)
         {
           MpeLog.Debug(ee);
           MpeLog.Error(ee);
         }
       }
     }
     else if (result == DialogResult.No)
     {
       for (int i = 0; i < form.SelectedDesigners.Length; i++)
       {
         try
         {
           form.SelectedDesigners[i].Cancel();
         }
         catch (Exception ee)
         {
           MpeLog.Debug(ee);
           MpeLog.Error(ee);
         }
       }
     }
   }
   try
   {
     selectedDesignerIndex = -1;
     for (int i = 0; i < tabManager.TabPages.Count; i++)
     {
       MpeDesigner designer = (MpeDesigner) tabManager.TabPages[i].Tag;
       designer.Destroy();
     }
     tabManager.TabPages.Clear();
   }
   catch
   {
     //
   }
   skinExplorer.CloseSkin();
   fileMenu.MenuCommands["&Close"].Enabled = false;
   Text = "MediaPortalEditor";
   MpeLog.Info("Skin closed");
 }
 protected void OnClosing(object sender, CancelEventArgs e)
 {
   MpeDesigner[] designers = GetModifiedDesigners();
   if (designers.Length == 0)
   {
     Cursor = Cursors.Default;
     return;
   }
   MpeSaveForm form = new MpeSaveForm(designers, tabImageList);
   DialogResult result = form.ShowDialog(this);
   if (result == DialogResult.Cancel)
   {
     e.Cancel = true;
     return;
   }
   else if (result == DialogResult.Yes)
   {
     for (int i = 0; i < form.SelectedDesigners.Length; i++)
     {
       try
       {
         form.SelectedDesigners[i].Save();
       }
       catch (Exception ee)
       {
         MpeLog.Debug(ee);
         MpeLog.Error(ee);
       }
     }
   }
   else if (result == DialogResult.No)
   {
     for (int i = 0; i < form.SelectedDesigners.Length; i++)
     {
       try
       {
         form.SelectedDesigners[i].Cancel();
       }
       catch (Exception ee)
       {
         MpeLog.Debug(ee);
         MpeLog.Error(ee);
       }
     }
   }
 }