public void DefaultInitialisesActionsHandlers()
 {
     ActionHandlerFactory.Reset();
     ActionHandlerFactory.PluginFolder = null;
     Assert.That(
         ActionHandlerFactory.Default.ActionHandlers,
         Is.Not.Empty);
 }
Пример #2
0
        private static Lazy <ActionHandler, IActionHandlerMetadata> InitialiseMockHandler(string actionName)
        {
            ActionHandlerFactory.Reset();
            ActionHandlerFactory.Default = new ActionHandlerFactory();
            var metadataMock = new Mock <IActionHandlerMetadata>(MockBehavior.Strict);

            metadataMock.Setup(metadata => metadata.Name).Returns(actionName);
            var expected = new Lazy <ActionHandler, IActionHandlerMetadata>(metadataMock.Object);

            return(expected);
        }
        public void DefaultIgnoresNonExistantDirectory()
        {
            ActionHandlerFactory.Reset();
            ActionHandlerFactory.PluginFolder = Path.Combine(
                Path.GetTempPath(),
                "CCNetTesting");
            if (Directory.Exists(ActionHandlerFactory.PluginFolder))
            {
                Directory.Delete(ActionHandlerFactory.PluginFolder, true);
            }

            Assert.That(
                ActionHandlerFactory.Default.ActionHandlers,
                Is.Not.Empty);
        }
Пример #4
0
 public void RetrieveHandlerReturnsNullIfNotFound()
 {
     try
     {
         var expected = InitialiseMockHandler("testAction");
         ActionHandlerFactory.Default.ActionHandlers.Add(expected);
         var controller = new DynamicController();
         var actual     = controller.RetrieveHandler("garbage");
         Assert.That(actual, Is.Null);
     }
     finally
     {
         ActionHandlerFactory.Reset();
     }
 }
Пример #5
0
        public void RibbonLoad(Office.IRibbonUI ribbonUi)
        {
            ActionHandlerFactory         = new ActionHandlerFactory();
            EnabledHandlerFactory        = new EnabledHandlerFactory();
            LabelHandlerFactory          = new LabelHandlerFactory();
            SupertipHandlerFactory       = new SupertipHandlerFactory();
            ImageHandlerFactory          = new ImageHandlerFactory();
            ContentHandlerFactory        = new ContentHandlerFactory();
            PressedHandlerFactory        = new PressedHandlerFactory();
            CheckBoxActionHandlerFactory = new CheckBoxActionHandlerFactory();

            DisableFormatTab     = new Boolean();
            ShouldCompressImages = new Boolean();

            _ribbon = ribbonUi;
        }
Пример #6
0
        //Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1

        public void RibbonLoad(Office.IRibbonUI ribbonUi)
        {
            ActionHandlerFactory         = new ActionHandlerFactory();
            EnabledHandlerFactory        = new EnabledHandlerFactory();
            LabelHandlerFactory          = new LabelHandlerFactory();
            SupertipHandlerFactory       = new SupertipHandlerFactory();
            ImageHandlerFactory          = new ImageHandlerFactory();
            ContentHandlerFactory        = new ContentHandlerFactory();
            PressedHandlerFactory        = new PressedHandlerFactory();
            CheckBoxActionHandlerFactory = new CheckBoxActionHandlerFactory();

            _ribbon = ribbonUi;

            SetVoicesFromInstalledOptions();
            SetCoreVoicesToSelections();
        }
Пример #7
0
        public void RetrieveHandlerIgnoresCase()
        {
            var actionName = "testAction";

            try
            {
                var expected = InitialiseMockHandler(actionName);
                ActionHandlerFactory.Default.ActionHandlers.Add(expected);
                var controller = new DynamicController();
                var actual     = controller.RetrieveHandler(actionName.ToUpperInvariant());
                Assert.That(actual, Is.SameAs(expected));
            }
            finally
            {
                ActionHandlerFactory.Reset();
            }
        }
Пример #8
0
 public void Init(HttpApiServer server)
 {
     this.Server        = server;
     this.HandleFactory = Server.ActionFactory;
 }
Пример #9
0
 public void OnAction(Office.IRibbonControl control)
 {
     ActionFramework.Common.Interface.ActionHandler actionHandler = ActionHandlerFactory.CreateInstance(control.Id, control.Tag);
     actionHandler.Execute(control.Id);
 }
Пример #10
0
        //Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1

        public void RibbonLoad(Office.IRibbonUI ribbonUi)
        {
            ActionHandlerFactory = new ActionHandlerFactory();
            LabelHandlerFactory = new LabelHandlerFactory();
            SupertipHandlerFactory = new SupertipHandlerFactory();
            ImageHandlerFactory = new ImageHandlerFactory();

            _ribbon = ribbonUi;

            SetVoicesFromInstalledOptions();
            SetCoreVoicesToSelections();
        }
Пример #11
0
        public void OnAction(Office.IRibbonControl control)
        {
            var actionHandler = ActionHandlerFactory.CreateInstance(control.Id, control.Tag);

            actionHandler.Execute(control.Id);
        }