コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        private void _InitSettings()
        {
            // Fill cultures.
            foreach (var cultureName in Properties.Settings.Default.SupportedCultures)
            {
                int separatorIndex = cultureName.IndexOf(COMMA);
                string value = cultureName.Substring(0, separatorIndex);
                string key = cultureName.Substring(separatorIndex + 1,
                    cultureName.Length - separatorIndex - 1);

                _cultures.Add(key, value);
            }

            // Add cultures to select control.
            foreach (var key in _cultures.Keys)
            {
                LanguagesSelectControl.Items.Add(key);
            }

            // Add commands.
            foreach (var keyItem in Properties.Settings.Default.Context.Keys)
            {
                string key = keyItem.ToString();
                if (key != null && key.StartsWith(COMMAND_TEXT))
                {
                    string commandValue = key.Remove(0, COMMAND_TEXT.Length);

                    var newCommand = new Command(commandValue, Properties.Settings.Default.Context[keyItem].ToString());
                    //_commands.Add(newCommand);
                    CommandsListView.Items.Add(newCommand);
                }
            }
            // Set selection to controls.
            TemporaryFolderPath.Text = Properties.Settings.Default.TempFolder;
            LogFilePath.Text = Properties.Settings.Default.DefaultLogFile;
            LanguagesSelectControl.SelectedValue = Properties.Settings.Default.SelectedCulture;

            AutomaticallySaveTextCheckBox.IsChecked = Properties.Settings.Default.AutomaticallySaveText;
            AutomaticallySaveTextCheckBox.Checked += AutomaticallySaveTextCheckBox_Checked;
            AutomaticallySaveTextCheckBox.Unchecked += AutomaticallySaveTextCheckBox_Unchecked;

            _availableDevices = DeviceValidator.GetDevices();

            // Fill combo box with devices names
            if (_availableDevices.Count > 0)
            {
                foreach (var deviceName in _availableDevices)
                {
                    // If device name is empty, this is common case of DEFAULT device. Set appropriate name.
                    if (deviceName == SPACE && !DeviceSelectControl.Items.Contains(DEFAULT_DEVICE_NAME))
                    {
                        DeviceSelectControl.Items.Add(DEFAULT_DEVICE_NAME);
                    }
                    else // otherwise set name as is.
                    {
                        DeviceSelectControl.Items.Add(deviceName);
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Check if any recording device is on.
 /// </summary>
 private bool _IsMicrophoneOn()
 {
     return (DeviceValidator.GetDevicesCount() > 0);
 }