コード例 #1
0
        public MacroManager(IInputSender inputSender)
        {
            _inputSender = inputSender;
            _macros = new ConcurrentDictionary<String, CycleMacro>();
            _macroGallery = new MacroGallery();
            _macroGallery.initialize();

            PersistenceContainer[] savedMacros = PersistenceUnitThread.persistenceUnit.loadContainersByType(typeof(CycleMacro).Name);
            foreach (PersistenceContainer currentPersistenceContainer in savedMacros)
            {
                CycleMacro newMacro = new CycleMacro();
                newMacro.UpdateCycleMacroByPersistenceContainer(currentPersistenceContainer);
                _macros.GetOrAdd(newMacro.Name, newMacro);
            }
        }
コード例 #2
0
        public MacroManager()
        {
            macros       = new ConcurrentDictionary <String, CycleMacro>();
            macroGallery = new MacroGallery();
            macroGallery.initialize();

            macroAddControl = new MacroAddControl();

            ownParentWindow   = App.overlay.addWindowToGrid(macroGallery, "Macros", false);
            macroCreateWindow = App.overlay.addWindowToGrid(macroAddControl, "Create new macro", false);
            App.overlay.addMenuItemToMenu("pack://application:,,,/Resources/macroMenuIcon.png", "Macros").Click += macroMenu_Click;

            PersistenceContainer[] savedMacros = PersistenceUnitThread.persistenceUnit.loadContainersByType(typeof(CycleMacro).Name);
            foreach (PersistenceContainer currentPersistenceContainer in savedMacros)
            {
                CycleMacro newMacro = new CycleMacro();
                newMacro.updateCycleMacroByPersistenceContainer(currentPersistenceContainer);
                macros.GetOrAdd(newMacro.name, newMacro);
            }
        }
コード例 #3
0
        public void removeMacro(CycleMacro macro)
        {
            CycleMacro deletedMacro;
            while (!_macros.TryRemove(macro.Name, out deletedMacro)) { }

            deletedMacro.DeletePersistence();

            _macroGallery.Dispatcher.Invoke((Action)(() =>
            {
                foreach (MacroItemModel currentInnerMacroItemModel in _macroGallery.macroItemModels)
                {
                    if (currentInnerMacroItemModel.MacroName == deletedMacro.Name)
                    {
                        _macroGallery.macroItemModels.Remove(currentInnerMacroItemModel);
                        break;
                    }
                }
            }));

        }
コード例 #4
0
 public void addMacro(CycleMacro macroToAdd)
 {
     macroToAdd.pause();
     macros.GetOrAdd(macroToAdd.name, macroToAdd);
     macroToAdd.persist();
 }
コード例 #5
0
 public void addMacro(CycleMacro macroToAdd)
 {
     macroToAdd.Pause();
     _macros.GetOrAdd(macroToAdd.Name, macroToAdd);
     macroToAdd.Persist();
 }