예제 #1
0
 public void RestoreCommandBars()
 {
     try
     {
         int count1 = this.InternalWordApp.ActiveWindow.Application.CommandBars.Count;
         for (int index1 = 1; index1 <= count1; ++index1)
         {
             try
             {
                 string name = this.InternalWordApp.ActiveWindow.Application.CommandBars[(object)index1].Name;
                 if (name == "Standard")
                 {
                     int count2 = this.InternalWordApp.ActiveWindow.Application.CommandBars[(object)index1].Controls.Count;
                     for (int index2 = 1; index2 <= 2; ++index2)
                     {
                         this.InternalWordApp.ActiveWindow.Application.CommandBars[(object)index1].Controls[(object)index2].Enabled = true;
                     }
                 }
                 try
                 {
                     if (name == "Menu Bar")
                     {
                         int count2 = this.InternalWordApp.ActiveWindow.Application.CommandBars[(object)index1].Controls.Count;
                         for (int index2 = 1; index2 <= count2; ++index2)
                         {
                             if (this.InternalWordApp.ActiveWindow.Application.CommandBars[(object)index1].Controls[(object)index2].Caption.ToLower().Contains("file"))
                             {
                                 IEnumerator enumerator = ((CommandBarPopup)this.InternalWordApp.ActiveWindow.Application.CommandBars[(object)index1].Controls[(object)index2]).get_Controls().GetEnumerator();
                                 try
                                 {
                                     while (enumerator.MoveNext())
                                     {
                                         CommandBarControl commandBarControl = (CommandBarControl)enumerator.Current;
                                         if (this.ShouldDisableItem(commandBarControl.get_Caption()))
                                         {
                                             commandBarControl.set_Enabled(true);
                                         }
                                     }
                                     break;
                                 }
                                 finally
                                 {
                                     IDisposable disposable = enumerator as IDisposable;
                                     if (disposable != null)
                                     {
                                         disposable.Dispose();
                                     }
                                 }
                             }
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                 }
             }
             catch (Exception ex)
             {
                 int num = (int)MessageBox.Show(ex.ToString());
             }
         }
     }
     catch
     {
     }
 }