コード例 #1
0
        private void AddProcessButton_Click(object sender, RoutedEventArgs e)
        {
            ProcessAdder c = new ProcessAdder();

            c.ShowDialog();

            if (c.ProcessDataGrid.SelectedItem != null)
            {
                CompileProcess ChosenProcess = (CompileProcess)c.ProcessDataGrid.SelectedItem;
                ChosenProcess.Metadata.DoRun = true;

                if (!ConfigurationManager.PresetMapDictionary[ConfigurationManager.CurrentPresetMap].ContainsKey(ChosenProcess.Name))
                {
                    ConfigurationManager.PresetMapDictionary[ConfigurationManager.CurrentPresetMap].Add(ChosenProcess.Name, new ObservableCollection <ConfigItem>());

                    ConfigurationManager.SavePresetsMaps();

                    // processes in mapfiles.json
                    CompilingManager.MapFiles[ConfigurationManager.CurrentPresetMap].Processes.Add(ChosenProcess.Name, new MapProcess());
                    PersistenceManager.ForceMapFilesWrite();
                }
            }

            AnalyticsManager.ModifyPresetMap();

            UpdateParameterTextBox();
            UpdateProcessList();

            if (processModeEnabled)
            {
                OrderManager.UpdateOrder();
            }
        }
コード例 #2
0
        private void AddParameterButton_Click(object sender, RoutedEventArgs e)
        {
            if (selectedProcess != null)
            {
                //Skip Paramater Adder for Custom Process
                if (selectedProcess.Name == "CUSTOM")
                {
                    ConfigurationManager.PresetMapDictionary[ConfigurationManager.CurrentPresetMap][selectedProcess.Name].Add((ConfigItem)selectedProcess.ParameterList[0].Clone());
                }
                else
                {
                    ParameterAdder c = new ParameterAdder(selectedProcess.ParameterList);
                    c.ShowDialog();

                    if (c.ChosenItem != null)
                    {
                        if (c.ChosenItem.CanBeUsedMoreThanOnce)
                        {
                            // .clone() removes problems with parameters sometimes becoming linked
                            ConfigurationManager.PresetMapDictionary[ConfigurationManager.CurrentPresetMap][selectedProcess.Name].Add((ConfigItem)c.ChosenItem.Clone());
                        }
                        else if (!ConfigurationManager.PresetMapDictionary[ConfigurationManager.CurrentPresetMap][selectedProcess.Name].Contains(c.ChosenItem))
                        {
                            ConfigurationManager.PresetMapDictionary[ConfigurationManager.CurrentPresetMap][selectedProcess.Name].Add(c.ChosenItem);
                        }

                        ConfigurationManager.SaveProcesses();
                        ConfigurationManager.SaveParameters(selectedProcess);
                    }
                }

                AnalyticsManager.ModifyPresetMap();

                UpdateParameterTextBox();
            }
        }