public static CustomTaskPane CreateCustomTaskPane(string controlProgId, string title, object parent)
        {
            ICTPFactory    factory = GetCTPFactory();
            CustomTaskPane newCTP  = factory.CreateCTP(controlProgId, title, parent);

            _customTaskPanes.Add(new WeakReference(newCTP));   // TODO: Only removed when add-in is unloaded...???
            return(newCTP);
        }
        public static CustomTaskPane CreateCustomTaskPane(string controlProgId, string title, object parent)
        {
            ICTPFactory    factory = GetCTPFactory();
            CustomTaskPane newCTP  = factory.CreateCTP(controlProgId, title, parent);

            _customTaskPanes.Add(newCTP);
            return(newCTP);
        }
        public TaskPanesRepositoryFactory(object application, object ctpFactoryInst, Func <IContainer> containerGetter,
                                          Func <object> taskPaneWindowGetter, Func <int?> taskPaneWindowKeyGetter, Func <string> taskPaneIdentifierGetter)
        {
            this.containerGetter          = containerGetter;
            this.taskPaneWindowGetter     = taskPaneWindowGetter;
            this.taskPaneWindowKeyGetter  = taskPaneWindowKeyGetter;
            this.taskPaneIdentifierGetter = taskPaneIdentifierGetter;

            ctpFactory = new ICTPFactory(
                parentObject: application as NetOffice.ICOMObject,
                comProxy: ctpFactoryInst);
        }
 public override void OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref Array custom)
 {
     // Unloading custom taks panes prevents the crash on Excel 2010 64-bit.
     CustomTaskPaneFactory.UnloadCustomTaskPanes();
     CustomTaskPaneFactory.DetachAddIn();
     if (Factory != null)
     {
         Marshal.ReleaseComObject(Factory);
         Factory = null;
     }
     base.OnDisconnection(RemoveMode, ref custom);
 }
Пример #5
0
        public TaskPanesFactory(int windowKey, ICTPFactory ctpFactory, IRegionManager hostRegionManager,
                                object taskPaneWindow, Type contentType)
        {
            progId = ComExtensions.GetProgId(
                hostType: typeof(PrismTaskPanesHost),
                contentType: contentType);

            if (Type.GetTypeFromProgID(progId) == default)
            {
                throw new HostNotRegisteredException();
            }

            this.windowKey         = windowKey;
            this.ctpFactory        = ctpFactory;
            this.hostRegionManager = hostRegionManager;
            this.taskPaneWindow    = taskPaneWindow;
        }
Пример #6
0
 public override void OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref Array custom)
 {
     // Unloading custom task panes prevents the crash on Excel 2010 64-bit.
     CustomTaskPaneFactory.UnloadCustomTaskPanes();
     CustomTaskPaneFactory.DetachAddIn();
     if (Factory != null)
     {
         Marshal.ReleaseComObject(Factory);
         Factory = null;
     }
     base.OnDisconnection(RemoveMode, ref custom);
 }
Пример #7
0
 // For CustomTaskPane stuff
 // TODO: ActiveX -> WPF without Windows.Forms....?
 public void CTPFactoryAvailable(ICTPFactory CTPFactoryInst)
 {
     Factory = CTPFactoryInst;
 }
 // For CustomTaskPane stuff
 // TODO: ActiveX -> WPF without Windows.Forms....?
 public void CTPFactoryAvailable(ICTPFactory CTPFactoryInst)
 {
     Factory = CTPFactoryInst;
 }
Пример #9
0
 public void CTPFactoryAvailable(ICTPFactory ctpFactoryInst)
 {
     _ctpFactory = ctpFactoryInst;
 }
Пример #10
0
 //http://shulerent.com/2011/01/23/adding-task-panes-in-a-office-add-in-when-using-idtextensibility2/
 public void CTPFactoryAvailable(ICTPFactory CTPFactoryInst)
 {
     // Store the CTP Factory for future use. You need this to display
     // Custom Task Panes
     myCtpFactory = CTPFactoryInst;
 }