예제 #1
0
        private void ShowProp(int index)
        {
            MacroManager mm  = MacroPlugin.Instance.MacroManager;
            MacroModule  mod = mm.GetModule(index);

            /*
             * Keys key = Keys.None;
             * IDictionaryEnumerator ie = _keyToModule.GetEnumerator();
             * while (ie.MoveNext()) {
             *  if (ie.Value == mod) {
             *      key = (Keys)(ie.Key);
             *      break;
             *  }
             * }
             */
            ModuleProperty dlg = new ModuleProperty(this, mod);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                mm.ReplaceModule(mm.GetModule(index), dlg.Module);
                ListViewItem li = _list.Items[index];
                li.Text             = dlg.Module.Title;
                li.SubItems[1].Text = dlg.Module.Path;
                //li.SubItems[2].Text = UILibUtil.KeyString(dlg.ShortCut);
                li.SubItems[2].Text = GetInfoString(dlg.Module);

                AdjustUI();
            }
        }
예제 #2
0
        private void OnRunButtonClicked(object sender, EventArgs args)
        {
            MacroManager mm = MacroPlugin.Instance.MacroManager;

            mm.SetMacroEventListener(this);
            mm.Execute(this, mm.GetModule(_list.SelectedItems[0].Index));
        }
예제 #3
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance       = this;
            _stringResource = new StringResource("Poderosa.Macro.strings", typeof(MacroPlugin).Assembly);
            _instance.PoderosaWorld.Culture.AddChangeListener(_stringResource);

            IPluginManager pm = poderosa.PluginManager;

            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _macroManager = new MacroManager();

            _macroListCommand = new MacroListCommand();
            _coreServices.CommandManager.Register(_macroListCommand);

            pm.FindExtensionPoint("org.poderosa.menu.tool").RegisterExtension(new MacroMenuGroup());

            _coreServices.PreferenceExtensionPoint.RegisterExtension(_macroManager);

            ISessionManager sessionManager = poderosa.PluginManager.FindPlugin("org.poderosa.core.sessions", typeof(ISessionManager)) as ISessionManager;

            if (sessionManager != null)
            {
                sessionManager.AddSessionListener(_sessionBinder);
            }
        }
예제 #4
0
        private void OnDeleteButtonClicked(object sender, EventArgs args)
        {
            MacroManager mm  = MacroPlugin.Instance.MacroManager;
            MacroModule  mod = mm.GetModule(_list.SelectedItems[0].Index);

            mm.RemoveModule(mod);
            _list.Items.Remove(_list.SelectedItems[0]);
            //_macroOrderUpdated = true;
            AdjustUI();
        }
예제 #5
0
        private void OnAddButtonClicked(object sender, EventArgs args)
        {
            ModuleProperty dlg = new ModuleProperty(this, null);
            MacroManager   mm  = MacroPlugin.Instance.MacroManager;

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                AddListItem(dlg.Module);
                mm.AddModule(dlg.Module);
                //if(dlg.ShortCut!=Keys.None) _keyToModule.Add(dlg.ShortCut, dlg.Module);
                AdjustUI();
            }
        }
예제 #6
0
        private void OnUpButtonClicked(object sender, EventArgs args)
        {
            int n = _list.SelectedItems[0].Index;

            if (n == 0)
            {
                return;
            }

            MacroManager mm = MacroPlugin.Instance.MacroManager;
            ListViewItem li = _list.Items[n];

            _list.Items.RemoveAt(n);
            _list.Items.Insert(n - 1, li);
            MacroModule mod = mm.GetModule(n);

            mm.RemoveAt(n);
            mm.InsertModule(n - 1, mod);
            //_macroOrderUpdated = true;
        }
예제 #7
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;
            _stringResource = new StringResource("Poderosa.Macro.strings", typeof(MacroPlugin).Assembly);
            _instance.PoderosaWorld.Culture.AddChangeListener(_stringResource);

            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _macroManager = new MacroManager();

            _macroListCommand = new MacroListCommand();
            _coreServices.CommandManager.Register(_macroListCommand);

            pm.FindExtensionPoint("org.poderosa.menu.tool").RegisterExtension(new MacroMenuGroup());

            _coreServices.PreferenceExtensionPoint.RegisterExtension(_macroManager);

            ISessionManager sessionManager = poderosa.PluginManager.FindPlugin("org.poderosa.core.sessions", typeof(ISessionManager)) as ISessionManager;
            if (sessionManager != null) {
                sessionManager.AddSessionListener(_sessionBinder);
            }
        }
예제 #8
0
        private void OnStopButtonClicked(object sender, EventArgs args)
        {
            MacroManager mm = MacroPlugin.Instance.MacroManager;

            mm.StopMacro();
        }