Beispiel #1
0
        public Settings(SimulatorSettings settings)
        {
            InitializeComponent();

            _settings = settings;

            nudInterval.Value = settings.Interval / 1000;
            nudSkip.Value     = settings.SkipRecord;
            if (settings.TimeStrategy == TimeStrategy.KeepOriginal)
            {
                rbKeepOriginal.Checked = true;
            }
            else
            {
                rbSpeedup.Checked = true;
            }

            if (settings.BatchType == BatchType.CreateTime)
            {
                rbBatchCreateTime.Checked = true;
            }
            else
            {
                rbBatchStartTime.Checked = true;
            }

            if (settings.GpsDataSortBy == GpsDataSortBy.RowID)
            {
                rbSortByRowID.Checked = true;
            }
            else
            {
                rbSortByStartTime.Checked = true;
            }
        }
Beispiel #2
0
        private void LoadSettings()
        {
            IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.Machine | IsolatedStorageScope.Assembly, null, null);

            if (!isoStore.FileExists(_settingsFileName))
            {
                return;
            }

            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(_settingsFileName, FileMode.Open, isoStore))
            {
                using (StreamReader reader = new StreamReader(isoStream))
                {
                    var xmlpath = reader.ReadLine().Replace("xmlpath=", "");
                    txtGpsXmlFile.Text = xmlpath;

                    var connString = reader.ReadLine().Replace("connectionstring=", "");
                    txtConnectionString.Text = connString;

                    var simulatorSettingsString = reader.ReadLine().Replace("settings=", "");
                    using (MemoryStream stream = new MemoryStream())
                    {
                        byte[] bytes = Convert.FromBase64String(simulatorSettingsString);
                        stream.Write(bytes, 0, bytes.Length);
                        stream.Position = 0;
                        var formatter = new BinaryFormatter();
                        _settings = (SimulatorSettings)formatter.Deserialize(stream);
                    }
                }
            }
        }