Esempio n. 1
0
        public MainForm()
        {
            InitializeComponent();
            // установим фильтр для отлова клавиатурных сообщений
            Application.AddMessageFilter(this);

            // locale
            foreach (var locale in Enum.GetValues(typeof(LocaleEnum)))
            {
                var name = DisplayNameAttribute.GetName(locale);
                cbLocale.Items.Add(name);
            }

            _settings = LocalSettings.Load();
            FillFormValuesFromSettings();

            // устанавливаем обработчики на мышь для
            // создания событий по свайпам
            ucScreen.MouseDown  += WatchScreen_MouseDown;
            ucScreen.MouseUp    += WatchScreen_MouseUp;
            ucScreen.MouseMove  += WatchScreen_MouseMove;
            ucScreen.MouseLeave += WatchScreen_MouseLeave;

            // информация о версии
            var version = Assembly.GetEntryAssembly()?.GetName().Version;

            base.Text = $"Bip Emulator v{version.Major}.{version.Minor}";
        }
Esempio n. 2
0
 private LocaleEnum GetCurrentLocale()
 {
     foreach (LocaleEnum locale in Enum.GetValues(typeof(LocaleEnum)))
     {
         if (DisplayNameAttribute.GetName(locale).Equals(cbLocale.SelectedItem))
         {
             return(locale);
         }
     }
     return(LocaleEnum.ru_RU);
 }
Esempio n. 3
0
        /// <summary>
        /// Заполняем значения элементов формы параметрами из сохраненных настроек
        /// </summary>
        private void FillFormValuesFromSettings()
        {
            nudHeartRate.Value = _settings.HeartRate;
            cbHeartRateMeasurementComplited.Checked = _settings.HeartRateMeasurementCompleted;
            tbLatitude.Text  = _settings.Latitude.ToString("F6");
            tbLongitude.Text = _settings.Longitude.ToString("F6");
            tbAltitude.Text  = _settings.Altitude.ToString("F2");
            cbGeoLocationMeasurementComplited.Checked = _settings.GeoLocationMeasurementCompleted;
            nudPressure.Value = _settings.Pressure;
            cbPressureMeasurementComplited.Checked = _settings.PressureMeasurementCompleted;
            cbLocale.SelectedItem = DisplayNameAttribute.GetName(_settings.Locale);
            tbFontFilename.Text   = _settings.FontFilename;
            tbSystemResFile.Text  = _settings.SystemResourceFilename;
            tbUserResFile.Text    = _settings.UserResourceFilename;
            ucScreen.Colors       = _settings.Colors;

            cbLocale.SelectedItem = DisplayNameAttribute.GetName(_settings.Locale);

            if (File.Exists(tbFontFilename.Text))
            {
                ucScreen.SetFontFile(tbFontFilename.Text);
            }
        }