예제 #1
0
파일: MacroTest.cs 프로젝트: PSE-2012/MMWTV
        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.");
        }
예제 #2
0
파일: Macro.cs 프로젝트: PSE-2012/MMWTV
        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;
        }
예제 #3
0
파일: Macro.cs 프로젝트: PSE-2012/MMWTV
 public void setMemento(object sender, MementoEventArgs e)
 {
     setMemento(e.memento);
 }
예제 #4
0
파일: Macro.cs 프로젝트: PSE-2012/MMWTV
        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);
        }
예제 #5
0
파일: Macro.cs 프로젝트: PSE-2012/MMWTV
 // delegate void removeMacroEntry(MacroEntry entry);
 public void addMacroEntry(object sender, MementoEventArgs e)
 {
     addMacroEntry(e, rootEntry);
 }