示例#1
0
 // attached in ctor to trigger taskpane visibility has been changed and update the checkbutton in the ribbon ui for show/hide taskpane
 private void TaskPane_VisibleStateChange(Office._CustomTaskPane CustomTaskPaneInst)
 {
     if (null != RibbonUI) // may no ribbon supported
     {
         RibbonUI.InvalidateControl("paneVisibleToogleButton");
     }
 }
示例#2
0
 // Taskpane visibility has been changed. We upate the checkbutton in the ribbon ui for show/hide taskpane
 protected override void TaskPaneVisibleStateChanged(Office._CustomTaskPane customTaskPaneInst)
 {
     if (null != RibbonUI)
     {
         RibbonUI.InvalidateControl("PaneVisibleToogleButton");
     }
 }
 /// <summary>
 /// Raise the VisibleChanged event
 /// </summary>
 internal void RaiseVisibleChanged(Office._CustomTaskPane pane)
 {
     if (null != _visibleStateChange)
     {
         _visibleStateChange(pane);
     }
 }
示例#4
0
 public void OnConnection(ICOMObject application, Office._CustomTaskPane parentPane, object[] customArguments)
 {
     if (customArguments.Length > 0)
     {
         ParentAddin = customArguments[0] as Addin;
     }
 }
 /// <summary>
 /// Raise the DockPositionStateChange event
 /// </summary>
 internal void RaiseDockPositionStateChanged(Office._CustomTaskPane pane)
 {
     if (null != _dockPositionStateChange)
     {
         _dockPositionStateChange(pane);
     }
 }
        /// <summary>
        /// Raise the DockPositionStateChange event
        /// </summary>
        internal void RaiseDockPositionStateChanged(Office._CustomTaskPane pane)
        {
            var handler = _visibleStateChange;

            if (null != handler)
            {
                handler(pane);
            }
        }
示例#7
0
 // attached in ctor to trigger taskpane visibility has been changed and update the checkbutton in the ribbon ui for show/hide taskpane
 private void TaskPane_VisibleStateChange(Office._CustomTaskPane CustomTaskPaneInst)
 {
     // ouer taskpane visibility has been changed. we send a message to the host application
     // and say please refresh the checkbutton state. now the host application want call ouer OnGetPressedPanelToggle method to update the checkstate.
     if (null != RibbonUI)
     {
         RibbonUI.InvalidateControl("paneVisibleToogleButton");
     }
 }
示例#8
0
 private void AttributePane_DockPositionStateChange(Office._CustomTaskPane CustomTaskPaneInst)
 {
     try
     {
         CallTaskPaneDockPositionStateChange(CustomTaskPaneInst);
     }
     catch (Exception exception)
     {
         Factory.Console.WriteException(exception);
     }
 }
示例#9
0
 private void AttributePane_VisibleStateChange(NetOffice.OfficeApi._CustomTaskPane CustomTaskPaneInst)
 {
     try
     {
         CallTaskPaneVisibleStateChange(CustomTaskPaneInst);
     }
     catch (Exception exception)
     {
         Factory.Console.WriteException(exception);
     }
 }
示例#10
0
 public void CTPFactoryAvailable(object CTPFactoryInst)
 {
     try
     {
         Office.ICTPFactory     ctpFactory = new NetOffice.OfficeApi.ICTPFactory(_accessApplication, CTPFactoryInst);
         Office._CustomTaskPane taskPane   = ctpFactory.CreateCTP(typeof(Addin).Assembly.GetName().Name + ".SampleControl", "NetOffice Sample Pane(CS35)", Type.Missing);
         taskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
         taskPane.Width        = 300;
         taskPane.Visible      = true;
         _sampleControl        = taskPane.ContentControl as SampleControl;
         ctpFactory.Dispose();
     }
     catch (Exception exception)
     {
         string message = string.Format("An error occured.{0}{0}{1}", Environment.NewLine, exception.Message);
         MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#11
0
        /// <summary>
        /// ICustomTaskPaneConsumer implementation
        /// </summary>
        /// <param name="CTPFactoryInst">factory proxy from host application</param>
        public virtual void CTPFactoryAvailable(object CTPFactoryInst)
        {
            try
            {
                if (null != CTPFactoryInst)
                {
                    TaskPaneFactory = new NetOffice.OfficeApi.ICTPFactory(Application, CTPFactoryInst);
                    foreach (TaskPaneInfo item in TaskPanes)
                    {
                        string title = item.Title;
                        Office._CustomTaskPane taskPane = TaskPaneFactory.CreateCTP(item.Type.FullName, title);
                        item.Pane     = taskPane;
                        item.IsLoaded = true;

                        ITaskPane pane = taskPane.ContentControl as ITaskPane;
                        if (null != pane)
                        {
                            TaskPaneInstances.Add(pane);
                            object[] argumentArray = new object[0];

                            if (item.Arguments != null)
                            {
                                argumentArray = item.Arguments;
                            }

                            pane.OnConnection(Application, argumentArray);
                        }

                        foreach (KeyValuePair <string, object> property in item.ChangedProperties)
                        {
                            if (property.Key != "Title")
                            {
                                taskPane.GetType().InvokeMember(property.Key, BindingFlags.SetProperty, null, taskPane, new object[] { property.Value });
                            }
                        }
                    }
                }
            }
            catch (NetRunTimeSystem.Exception exception)
            {
                NetOffice.DebugConsole.WriteException(exception);
                RaiseErrorHandlerMethod(ErrorMethodKind.CTPFactoryAvailable, exception);
            }
        }
示例#12
0
 private void CallTaskPaneDockPositionStateChange(NetOffice.OfficeApi._CustomTaskPane customTaskPaneInst)
 {
     try
     {
         foreach (TaskPaneInfo item in TaskPanes)
         {
             if (item.Pane == customTaskPaneInst)
             {
                 try
                 {
                     ITaskPane target = item.Pane.ContentControl as ITaskPane;
                     if (null != target && item.Pane == customTaskPaneInst)
                     {
                         try
                         {
                             target.OnDockPositionChanged(item.Pane.DockPosition);
                         }
                         catch (Exception exception)
                         {
                             Factory.Console.WriteException(exception);
                         }
                     }
                 }
                 catch (Exception exception)
                 {
                     Factory.Console.WriteException(exception);
                 }
             }
         }
         TaskPaneDockStateChanged(customTaskPaneInst);
     }
     catch (Exception exception)
     {
         Factory.Console.WriteException(exception);
     }
 }
示例#13
0
 private void CallTaskPaneVisibleStateChange(NetOffice.OfficeApi._CustomTaskPane customTaskPaneInst)
 {
     try
     {
         foreach (TaskPaneInfo item in Parent.TaskPanes)
         {
             if (item.Pane.UnderlyingObject == customTaskPaneInst.UnderlyingObject)
             {
                 try
                 {
                     ITaskPane target = item.Pane.ContentControl as ITaskPane;
                     if (null != target)
                     {
                         try
                         {
                             target.OnVisibleStateChanged(item.Pane.Visible);
                         }
                         catch (Exception exception)
                         {
                             Factory.Console.WriteException(exception);
                         }
                     }
                 }
                 catch (Exception exception)
                 {
                     Factory.Console.WriteException(exception);
                 }
             }
         }
         TaskPaneVisibleStateChanged(customTaskPaneInst);
     }
     catch (Exception exception)
     {
         Factory.Console.WriteException(exception);
     }
 }
示例#14
0
 private void CallTaskPaneVisibleStateChange(NetOffice.OfficeApi._CustomTaskPane customTaskPaneInst)
 {
     try
     {
         foreach (TaskPaneInfo item in TaskPanes)
         {
             if (item.Pane == customTaskPaneInst)
             {
                 try
                 {
                     ITaskPane target = item.Pane.ContentControl as ITaskPane;
                     if (null != target && item.Pane == customTaskPaneInst)
                     {
                         try
                         {
                             target.OnVisibleStateChanged(item.Pane.Visible);
                         }
                         catch (NetRuntimeSystem.Exception exception)
                         {
                             Factory.Console.WriteException(exception);
                         }
                     }
                 }
                 catch (NetRuntimeSystem.Exception exception)
                 {
                     Factory.Console.WriteException(exception);
                 }
             }
         }
         TaskPaneVisibleStateChanged(customTaskPaneInst);
     }
     catch (NetRuntimeSystem.Exception exception)
     {
         Factory.Console.WriteException(exception);
     }
 }
示例#15
0
 private void TaskPane_VisibleStateChange(_CustomTaskPane CustomTaskPaneInst)
 {
 }
示例#16
0
文件: Addin.cs 项目: vebin/NetOffice
 private void TaskPane_VisibleStateChange(Office._CustomTaskPane CustomTaskPaneInst)
 {
 }
示例#17
0
 public virtual void DockPositionStateChange(NetOffice.OfficeApi._CustomTaskPane customTaskPaneInst)
 {
     InvokerService.InvokeInternal.ExecuteMethod(this, "DockPositionStateChange", customTaskPaneInst);
 }
示例#18
0
 /// <summary>
 /// Called after any position changes but not for size changes
 /// </summary>
 /// <param name="customTaskPaneInst">pane instance</param>
 protected internal virtual void TaskPaneDockStateChanged(NetOffice.OfficeApi._CustomTaskPane customTaskPaneInst)
 {
 }
示例#19
0
 public void OnConnection(NetOffice.WordApi.Application application, NetOffice.OfficeApi._CustomTaskPane parentPane, object[] customArguments)
 {
     application.WindowSelectionChangeEvent += new NetOffice.WordApi.Application_WindowSelectionChangeEventHandler(Application_WindowSelectionChangeEvent);
 }
示例#20
0
 public void CTPFactoryAvailable(object CTPFactoryInst)
 {
     try
     {
         _myCtpFactory = new NetOffice.OfficeApi.ICTPFactory(_excelApplication, CTPFactoryInst);
         _myPane = _myCtpFactory.CreateCTP("ExcelAddinCSharp.SampleControl", "NetOffice Sample Pane(C#)", Type.Missing);
         _myPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
         _myPane.Visible = true;
         _myControl = _myPane.ContentControl as SampleControl;
         _taskPanePassed = true;
     }
     catch (Exception throwedException)
     {
         _taskPanePassed = false;
         string details = string.Format("{1}{1}Details:{1}{1}{0}", throwedException.Message, Environment.NewLine);
         Console.WriteLine(details);
     }
 }