private bool SetSplinesAndFilled(Settings settings, bool splines, bool filled) { bool muted = false; if (splines) { if (filled) { muted = settings.MuteCurveFillPolygon; } else { muted = settings.MuteCurvePolygon; } } else { if (filled) { muted = settings.MuteLineFillPolygon; } else { muted = settings.MuteLinePolygon; } } if (muted) return false; Splines = splines; Filled = filled; return true; }
public MainForm() { InitializeComponent(); Settings = Serializer.DeserializeSettings(); if (Settings == null) Settings = new Settings(); }
public MainWindow() { InitializeComponent(); //Settings = Serializer.DeserializeSettings(); if (Settings == null) Settings = new Settings(); }
public void Init() { Drawing = new DnaDrawing(); Drawing.Init(); Settings = new Settings(); ErrorLevel = double.MaxValue; LastSavedFitness = double.MaxValue; }
public static void Serialize(Settings settings) { if (string.IsNullOrEmpty(Application.LocalUserAppDataPath)) return; string fileName = Application.LocalUserAppDataPath + "\\Settings.xml"; Serialize(settings, fileName); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { Settings settings = Serializer.DeserializeSettings(FileUtil.GetOpenFileName(FileUtil.XmlExtension)); if (settings != null) { Settings = settings; } }
public static void Serialize(Settings settings, string fileName) { if (fileName == null) return; try { var serializer = new XmlSerializer(settings.GetType()); using (var writer = new FileStream(fileName, FileMode.Create)) { serializer.Serialize(writer, settings); } } catch (Exception) { } }