Ejemplo n.º 1
0
        private async void ThisAddIn_Startup(object sender, EventArgs e)
        {
            try
            {
                // Sometimes outlook raises this event multiple times (seems to be a bug)
                if (ComponentContainer != null)
                {
                    return;
                }

                XmlConfigurator.Configure();
                s_logger.Info("Startup entered.");

                ComponentContainer = new ComponentContainer(Application);
                ComponentContainer.SynchronizationFailedWhileReportsFormWasNotVisible += ComponentContainer_SynchronizationFailedWhileReportsFormWasNotVisible;
                ComponentContainer.StatusChanged            += ComponentContainer_StatusChanged;
                ((ApplicationEvents_Event)Application).Quit += ThisAddIn_Quit;

                _explorers              = Application.Explorers;
                _explorers.NewExplorer += Explorers_NewExplorer;

                AddToolBarIfRequired();

                ComponentContainer.EnsureSynchronizationContext();

                s_logger.Info("Initializing component container.");
                await ComponentContainer.Initialize();

                s_logger.Info("Startup exiting.");
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.DisplayException(x, s_logger);
            }
        }
Ejemplo n.º 2
0
 private void ToolBarBtn_Status_OnClick(CommandBarButton Ctrl, ref bool CancelDefault)
 {
     try
     {
         ComponentContainer.EnsureSynchronizationContext();
         _componentContainer.ShowProfileStatuses();
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
Ejemplo n.º 3
0
 private async void ToolBarBtn_GeneralOptions_OnClick()
 {
     try
     {
         ComponentContainer.EnsureSynchronizationContext();
         await _componentContainer.ShowGeneralOptionsAsync();
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
 private async void GeneralOptionsButton_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ComponentContainer.EnsureSynchronizationContext();
         await ThisAddIn.ComponentContainer.ShowGeneralOptionsAsync();
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
 private void AboutButton_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ComponentContainer.EnsureSynchronizationContext();
         ThisAddIn.ComponentContainer.ShowAbout();
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
 private void ToolBarBtn_Reports_OnClick(CommandBarButton Ctrl, ref bool CancelDefault)
 {
     try
     {
         ComponentContainer.EnsureSynchronizationContext();
         ThisAddIn.ComponentContainer.ShowReports();
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
 private void ReportsButton_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ComponentContainer.EnsureSynchronizationContext();
         ReportsButton.Image = Resources.SyncReport;
         ThisAddIn.ComponentContainer.ShowReports();
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
Ejemplo n.º 8
0
 private void ManualSynchronize()
 {
     try
     {
         _toolBarBtnSyncNow.Enabled = false;
         try
         {
             ComponentContainer.EnsureSynchronizationContext();
             _componentContainer.SynchronizeNowAsync();
         }
         finally
         {
             _toolBarBtnSyncNow.Enabled = true;
         }
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }
Ejemplo n.º 9
0
 private void SynchronizeNowButton_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         SynchronizeNowButton.Enabled = false;
         try
         {
             ComponentContainer.EnsureSynchronizationContext();
             ThisAddIn.ComponentContainer.SynchronizeNowAsync();
         }
         finally
         {
             SynchronizeNowButton.Enabled = true;
         }
     }
     catch (Exception x)
     {
         ExceptionHandler.Instance.DisplayException(x, s_logger);
     }
 }