Exemplo n.º 1
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            taskPaneControl1 = new OutlookConnectorPane();
            IConnectorMainView connectorExplorer = ((System.Windows.Forms.Integration.ElementHost)taskPaneControl1.Controls[0]).Child as IConnectorMainView;

            ApplicationContext.SetApplicationManager(new OutlookConnectorManager(this.Application, connectorExplorer));

            ApplicationContext.Current.ConnectorExplorer.InitializedDate = new DateTime(DateTime.Now.Ticks);
            taskPaneValue = this.CustomTaskPanes.Add(taskPaneControl1, "Sobiens Office Connector");
            taskPaneValue.VisibleChanged      += new EventHandler(taskPaneValue_VisibleChanged);
            taskPaneValue.DockPositionChanged += new EventHandler(taskPaneValue_DockPositionChanged);
            taskPaneControl1.SizeChanged      += new EventHandler(taskPaneControl1_SizeChanged);
            taskPaneControl1.Resize           += new EventHandler(taskPaneControl1_Resize);

            ApplicationBaseState applicationState = StateManager.GetInstance().ConnectorState.GetApplicationState(ApplicationContext.Current.GetApplicationType());

            taskPaneValue.DockPosition = StateManager.GetInstance().GetMsoPaneDockPosition(applicationState.DockPosition);
            taskPaneControl1.Width     = applicationState.ConnectorWidth;
            taskPaneControl1.Height    = applicationState.ConnectorHeight;
            taskPaneValue.Visible      = applicationState.ConnectorOpen;

            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(inspectors_NewInspector);

            //this.Application.Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            //SetSPOCButton();

            foreach (Outlook.Inspector inspector in inspectors)
            {
                inspectors_NewInspector(inspector);
            }

            ConfigurationManager.GetInstance().DownloadAdministrationXml(RefreshControls);
        }
Exemplo n.º 2
0
        void taskPaneValue_DockPositionChanged(object sender, EventArgs e)
        {
            CustomTaskPane       pane             = (CustomTaskPane)sender;
            ApplicationBaseState applicationState = StateManager.GetInstance().ConnectorState.GetApplicationState(ApplicationContext.Current.GetApplicationType());

            applicationState.DockPosition = StateManager.GetInstance().GetConnectorPaneDockPosition(pane.DockPosition);
            StateManager.GetInstance().SaveState();
        }
Exemplo n.º 3
0
        void taskPaneControl1_SizeChanged(object sender, EventArgs e)
        {
            OutlookConnectorPane pane             = (OutlookConnectorPane)sender;
            ApplicationBaseState applicationState = StateManager.GetInstance().ConnectorState.GetApplicationState(ApplicationContext.Current.GetApplicationType());

            applicationState.ConnectorWidth  = pane.Width;
            applicationState.ConnectorHeight = pane.Height;
            StateManager.GetInstance().SaveState();
        }
Exemplo n.º 4
0
 void taskPaneControl1_SizeChanged(object sender, EventArgs e)
 {
     if (ApplicationContext.Current.ConnectorExplorer.InitializedDate.AddSeconds(10) < DateTime.Now)
     {
         OutlookConnectorPane pane             = (OutlookConnectorPane)sender;
         ApplicationBaseState applicationState = StateManager.GetInstance().ConnectorState.GetApplicationState(ApplicationContext.Current.GetApplicationType());
         applicationState.ConnectorWidth  = pane.Width;
         applicationState.ConnectorHeight = pane.Height;
         StateManager.GetInstance().SaveState();
     }
 }