Exemple #1
0
        private bool ManagerAddOns(bool manage)
        {
            bool changed = false;

            using (AddOnManagerForm dmf = new AddOnManagerForm())
            {
                dmf.Init(manage, this.Icon);

                dmf.EditActionFile    += Dmf_OnEditActionFile;  // only used when manage = false
                dmf.EditGlobals       += Dmf_OnEditGlobals;
                dmf.CreateActionFile  += Dmf_OnCreateActionFile;
                dmf.CheckActionLoaded += Dmf_checkActionLoaded;

                dmf.ShowDialog(discoveryform);

                if (dmf.changelist.Count > 0)
                {
                    actionrunasync?.TerminateAll();
                    AudioQueueSpeech?.StopAll();
                    AudioQueueWave?.StopAll();

                    ReLoad(false);      // reload from disk, new ones if required, refresh old ones and keep the vars
                    CheckWarn();

                    string changes = "", updates = "", removes = "";
                    foreach (KeyValuePair <string, string> kv in dmf.changelist)
                    {
                        if (kv.Value.Contains("+"))
                        {
                            changes += kv.Key + ";";
                            if (kv.Value.Contains("++"))
                            {
                                updates += kv.Key + ";";
                            }
                        }

                        if (kv.Value.Equals("-"))
                        {
                            discoveryform.RemoveMenuItemsFromAddOns(kv.Key);
                            removes += kv.Key + ";";
                        }
                    }

                    ActionRun(ActionEventEDList.onInstall, null, new Variables(new string[] { "InstallList", changes, "UpdateList", updates, "RemoveList", removes }));

                    ActionConfigureKeys();

                    changed = true;
                }
            }

            return(changed);
        }
        private void RunManageAddOns(bool manage)
        {
            using (AddOnManagerForm dmf = new AddOnManagerForm())
            {
                dmf.Init(manage, this.Icon);

                dmf.EditActionFile    += Dmf_OnEditActionFile;  // only used when manage = false
                dmf.EditGlobals       += Dmf_OnEditGlobals;
                dmf.CreateActionFile  += Dmf_OnCreateActionFile;
                dmf.CheckActionLoaded += Dmf_checkActionLoaded;

                dmf.ShowDialog(discoveryform);

                if (dmf.changelist.Count > 0)
                {
                    actionrunasync.TerminateAll();
                    AudioQueueSpeech.StopAll();
                    AudioQueueWave.StopAll();

                    ReLoad(false);      // reload from disk, new ones if required, refresh old ones and keep the vars
                    CheckWarn();

                    string changes = "";
                    foreach (KeyValuePair <string, string> kv in dmf.changelist)
                    {
                        if (kv.Value.Equals("+"))
                        {
                            changes += kv.Key + ";";
                        }
                        if (kv.Value.Equals("-"))
                        {
                            discoveryform.RemoveMenuItemsFromAddOns(kv.Key);
                        }
                    }

                    ActionRun(ActionEventEDList.onInstall, null, new ConditionVariables("InstallList", changes));
                }
            }
        }