Ejemplo n.º 1
0
        public void addMacroEntryTest_eventhandler()
        {
            string mementoname = "testmemento";

            PluginManagerTest.TestHelper(new string[] { "PF_Invert.dll" });
            Oqat.ViewModel.PluginManager_Accessor pluginManager = new Oqat.ViewModel.PluginManager_Accessor();
            pluginManager.addMemento("Invert", new Memento(mementoname, new PF_Invert.Invert().getMemento()));

            Macro_Accessor target = new Macro_Accessor();
            object sender = null;
            MementoEventArgs e = new MementoEventArgs(mementoname, "Invert");
            target.addMacroEntry(sender, e);

            Assert.AreEqual(1, target.rootEntry.macroEntries.Count, "No macroentry was added.");
            Assert.AreEqual(mementoname, target.rootEntry.macroEntries[0].mementoName, "Macroentry not added by event.");
        }
Ejemplo n.º 2
0
        private MacroEntry constructMacroFromMementoArg(MementoEventArgs e)
        {
            IPlugin plToConstrFrom = PluginManager.pluginManager.getPlugin<IPlugin>(e.pluginKey);
            if (plToConstrFrom == null)
                throw new ArgumentException("Given plugin name either does not refer to a existing plugin or is blacklisted.");

            PluginType entryType = PluginManager.pluginManager.getPlugin<IPlugin>(e.pluginKey).type;
            MacroEntry entryToAdd = null;
            if (entryType != PluginType.IMacro)
            {
                entryToAdd = new MacroEntry(e.pluginKey, entryType, e.mementoName);
                entryToAdd.frameCount = this.rootEntry.frameCount;
            }
            else
            {
                var tmpMem = PluginManager.pluginManager.getMemento(e.pluginKey, e.mementoName);
                if (tmpMem == null)
                    throw new ArgumentException("Given parameters do not refer to a existing memento.");
                if(tmpMem.state != rootEntry)
                    entryToAdd = tmpMem.state as MacroEntry;
            }

            return entryToAdd;
        }
Ejemplo n.º 3
0
 public void setMemento(object sender, MementoEventArgs e)
 {
     setMemento(e.memento);
 }
Ejemplo n.º 4
0
        private void addMacroEntry(MementoEventArgs e, MacroEntry father, int index = -1)
        {
            var entryToAdd = constructMacroFromMementoArg(e);

            if ((entryToAdd.type == PluginType.IMacro) && (this.rootEntry.macroEntries.Count() == 0))
                addMacroEntry(entryToAdd, null);

            else
                addMacroEntry(entryToAdd, father, index);
        }
Ejemplo n.º 5
0
 // delegate void removeMacroEntry(MacroEntry entry);
 public void addMacroEntry(object sender, MementoEventArgs e)
 {
     addMacroEntry(e, rootEntry);
 }