示例#1
0
        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;
        }
示例#2
0
 public MainForm()
 {
     InitializeComponent();
     Settings = Serializer.DeserializeSettings();
     if (Settings == null)
         Settings = new Settings();
 }
 public MainWindow()
 {
     InitializeComponent();
     //Settings = Serializer.DeserializeSettings();
     if (Settings == null)
         Settings = new Settings();
 }
示例#4
0
 public void Init()
 {
     Drawing = new DnaDrawing();
     Drawing.Init();
     Settings = new Settings();
     ErrorLevel = double.MaxValue;
     LastSavedFitness = double.MaxValue;
 }
示例#5
0
        public static void Serialize(Settings settings)
        {
            if (string.IsNullOrEmpty(Application.LocalUserAppDataPath))
                return;

            string fileName = Application.LocalUserAppDataPath + "\\Settings.xml";
            Serialize(settings, fileName);
        }
示例#6
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Settings settings = Serializer.DeserializeSettings(FileUtil.GetOpenFileName(FileUtil.XmlExtension));
     if (settings != null)
     {
         Settings = settings;
     }
 }
示例#7
0
        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)
            {
            }
        }