Esempio n. 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);
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 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;
                    }
                }
            }));

        }
Esempio n. 4
0
 public void addMacro(CycleMacro macroToAdd)
 {
     macroToAdd.pause();
     macros.GetOrAdd(macroToAdd.name, macroToAdd);
     macroToAdd.persist();
 }
Esempio n. 5
0
 public void addMacro(CycleMacro macroToAdd)
 {
     macroToAdd.Pause();
     _macros.GetOrAdd(macroToAdd.Name, macroToAdd);
     macroToAdd.Persist();
 }