예제 #1
0
        public void CreateDerivedPreset()
        {
            MachineModel activeModel = ActiveMachine;

            MachinePreset basePreset = ActivePreset.Clone();

            CC.Settings.WriteToSettings(basePreset.Settings);

            CotangentUI.GetStringFromDialog("Create New Preset",
                                            "Enter the name of new Preset to be derived from \"" + basePreset.Settings.Identifier + "\"", null,
                                            (name) => { return(string.IsNullOrEmpty(name) == false && name.Contains('\"') == false); },
                                            (name, obj) => {
                MachinePreset derived = MachineDB.CreateDerivedPreset(activeModel, basePreset, name);
                SelectPreset(derived);
                // will cause refresh of presets list
                OnPrinterSelectionModified?.Invoke(ActiveManufacturer, ActiveMachine);
            },
                                            () => {
                SelectPreset(basePreset);
            }
                                            );
        }
예제 #2
0
        public void CreateDerivedMachine()
        {
            MachineModel activeModel = ActiveMachine;

            MachinePreset defaultPreset = MachineDB.DefaultPresetForModel(ActiveMachine);

            CotangentUI.GetStringFromDialog("Create New Machine",
                                            "Enter the name of new Machine to be derived from \"" + activeModel.Name + "\"", null,
                                            (name) => { return(string.IsNullOrEmpty(name) == false && name.Contains('\"') == false); },
                                            (name, obj) => {
                try {
                    MachineModel newModel = MachineDB.CreateDerivedMachine(ActiveManufacturer, ActiveMachine, defaultPreset, name);
                    OnPrinterSelectionModified?.Invoke(null, null);
                    SelectMachine(newModel);
                } catch (Exception e) {
                    DebugUtil.Log("CreateDerivedMachine:  " + e.Message);
                }
            },
                                            () => {
                SelectMachine(ActiveMachine);
            }
                                            );
        }