async private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (ControlsHelper.IsDesignMode(this)) return; // If mapping DInput device to XInput controller. if (MapDeviceToControllerMode) { IsHiddenColumn.Visibility = Visibility.Collapsed; IsEnabledColumn.Visibility = Visibility.Collapsed; } else { RefreshButton.Visibility = Visibility.Collapsed; ShowSystemDevicesButton.Visibility = Visibility.Collapsed; } _currentData = new ObservableCollectionInvoked<UserDevice>(); MainDataGrid.ItemsSource = _currentData; SettingsManager.UserDevices.Items.ListChanged += Items_ListChanged; await RefreshMapDeviceToList().ConfigureAwait(true); }
public PadItemControl() { InitHelper.InitTimer(this, InitializeComponent); if (ControlsHelper.IsDesignMode(this)) { return; } LeftTriggerPanel.HeaderText = "Left Trigger"; LeftTriggerPanel.TargetType = TargetType.LeftTrigger; RightTriggerPanel.HeaderText = "Right Trigger"; RightTriggerPanel.TargetType = TargetType.RightTrigger; LeftThumbXPanel.HeaderText = "X - Horizontal Axis"; LeftThumbXPanel.TargetType = TargetType.LeftThumbX; LeftThumbYPanel.HeaderText = "Y - Vertical Axis"; LeftThumbYPanel.TargetType = TargetType.LeftThumbY; RightThumbXPanel.HeaderText = "X - Horizontal Axis"; RightThumbXPanel.TargetType = TargetType.RightThumbY; RightThumbYPanel.HeaderText = "Y - Vertical Axis"; RightThumbYPanel.TargetType = TargetType.LeftThumbY; }
private void OptionsCacheUserControl_Load(object sender, EventArgs e) { if (ControlsHelper.IsDesignMode(this)) { return; } // To avoid validation problems, make sure to add DataBindings inside "Load" event and not inside Constructor. ControlsHelper.AddDataBinding(CacheDataWriteCheckBox, c => c.Checked, SettingsManager.Options, d => d.CacheDataWrite); ControlsHelper.AddDataBinding(CacheDataReadCheckBox, c => c.Checked, SettingsManager.Options, d => d.CacheDataRead); ControlsHelper.AddDataBinding(CacheDataGeneralizeCheckBox, c => c.Checked, SettingsManager.Options, d => d.CacheDataGeneralize); // Add cache audio format. ControlsHelper.AddDataBinding(CacheAudioConvertCheckBox, SettingsManager.Options, d => d.CacheAudioConvert); ControlsHelper.AddDataBinding(CacheAudioFormatComboBox, SettingsManager.Options, d => d.CacheAudioFormat); _CacheMessageFormat = CacheLabel.Text; var files = MainHelper.GetCreateCacheFolder().GetFiles("*.*", SearchOption.AllDirectories); var count = files.Count(); var size = SizeSuffix(files.Sum(x => x.Length), 1); CacheLabel.Text = string.Format(_CacheMessageFormat, count, size); }
async private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (ControlsHelper.IsDesignMode(this)) { return; } _currentData = null; SettingsManager.UserDevices.Items.ListChanged -= Items_ListChanged; SettingsManager.UserDevices.Items.ListChanged += Items_ListChanged; ShowSystemDevicesButton.Visibility = MapDeviceToControllerMode ? Visibility.Visible : Visibility.Collapsed; if (MapDeviceToControllerMode) { IsHiddenColumn.Visibility = Visibility.Collapsed; IsEnabledColumn.Visibility = Visibility.Collapsed; await RefreshMapDeviceToList().ConfigureAwait(true); } else { AttachDataSource(SettingsManager.UserDevices.Items); } }
public AxisMapUserControl() { InitializeComponent(); if (ControlsHelper.IsDesignMode(this)) { return; } InitPaintObjects(); // Initialize in constructor and not on "Load" event or it will reset AntiDeadZone value // inside DeadZoneControlsLink(...). updateTimer = new QueueTimer(500, 0); updateTimer.DoWork += updateTimer_DoWork; var maxValue = TargetType == TargetType.LeftTrigger || TargetType == TargetType.RightTrigger ? byte.MaxValue : short.MaxValue; deadzoneLink = new DeadZoneControlsLink(DeadZoneTrackBar, DeadZoneNumericUpDown, DeadZoneTextBox, maxValue); deadzoneLink.ValueChanged += deadzoneLink_ValueChanged; antiDeadzoneLink = new DeadZoneControlsLink(AntiDeadZoneTrackBar, AntiDeadZoneNumericUpDown, AntiDeadZoneTextBox, maxValue); antiDeadzoneLink.ValueChanged += deadzoneLink_ValueChanged; RefreshBackgroundImageAsync(); }
//const string aTokens64 = @"SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens"; private void CortanaForm_Load(object sender, EventArgs e) { if (ControlsHelper.IsDesignMode(this)) { return; } var lm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); var tokens = lm.OpenSubKey(mTokens32); if (tokens == null) { return; } var list = new List <KeyValuePair <string, string> >(); foreach (var name in tokens.GetSubKeyNames()) { var token = tokens.OpenSubKey(name); var value = (string)token.GetValue(null); var item = new KeyValuePair <string, string>(name, value); var voicePath = string.Format("{0}", token.GetValue("VoicePath")); if (string.IsNullOrEmpty(voicePath)) { continue; } var path = Environment.ExpandEnvironmentVariables(voicePath) + ".APM"; if (!System.IO.File.Exists(path)) { continue; } list.Add(item); token.Dispose(); } tokens.Dispose(); lm.Dispose(); MobileVoiceComboBox.DataSource = list; MobileVoiceComboBox.DisplayMember = "Value"; MobileVoiceComboBox.ValueMember = "Key"; }
public CloudControl() { InitializeComponent(); if (ControlsHelper.IsDesignMode(this)) { return; } //TasksTimer.Queue.AsynchronousInvoke = true; MainDataGrid.AutoGenerateColumns = false; // Enable task timer. var scheduler = TaskScheduler.FromCurrentSynchronizationContext(); Global.CloudClient.StartServer(scheduler); // Display cloud queue results. EnableDataSource(true); // Start monitoring tasks queue. QueueMonitorTimer = new System.Timers.Timer(); QueueMonitorTimer.Interval = 500; QueueMonitorTimer.Elapsed += QueueMonitorTimer_Elapsed; QueueMonitorTimer.Start(); UpdateButtons(); }
public MainWindow() { ControlsHelper.InitInvokeContext(); // Disable some functionality in Visual Studio Interface design mode. if (!ControlsHelper.IsDesignMode(this)) { PreviewKeyDown += MainWindow_PreviewKeyDown; Closing += MainWindow_Closing; } InitializeComponent(); if (ControlsHelper.IsDesignMode(this)) { return; } StartHelper.Initialize(); InitiInterfaceUpdate(); // Check if app version changed. var o = SettingsManager.Options; var appVersion = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().Version.ToString(); AppVersionChanged = o.AppVersion != appVersion; o.AppVersion = appVersion; }
public PadItemControl() { InitHelper.InitTimer(this, InitializeComponent); if (ControlsHelper.IsDesignMode(this)) { return; } // Hide in this version. XInputTabPage.Visibility = Visibility.Collapsed; // Other options. LeftTriggerPanel.HeaderText = "Left Trigger"; LeftTriggerPanel.TargetType = TargetType.LeftTrigger; RightTriggerPanel.HeaderText = "Right Trigger"; RightTriggerPanel.TargetType = TargetType.RightTrigger; LeftThumbXPanel.HeaderText = "X - Horizontal Axis"; LeftThumbXPanel.TargetType = TargetType.LeftThumbX; LeftThumbYPanel.HeaderText = "Y - Vertical Axis"; LeftThumbYPanel.TargetType = TargetType.LeftThumbY; RightThumbXPanel.HeaderText = "X - Horizontal Axis"; RightThumbXPanel.TargetType = TargetType.RightThumbY; RightThumbYPanel.HeaderText = "Y - Vertical Axis"; RightThumbYPanel.TargetType = TargetType.LeftThumbY; }
public AmazonPollyUserControl() { InitializeComponent(); if (ControlsHelper.IsDesignMode(this)) { return; } AccessKeyTextBox.Text = SettingsManager.Options.AmazonAccessKey; SecretKeyTextBox.Text = SettingsManager.Options.AmazonSecretKey; AccessKeyTextBox.TextChanged += AccessKeyTextBox_TextChanged; SecretKeyTextBox.TextChanged += SecretKeyTextBox_TextChanged; var regions = RegionEndpoint.EnumerableAllRegions .OrderBy(x => x.ToString()) .ToArray(); RegionComboBox.DataSource = regions; var region = regions.FirstOrDefault(x => x.SystemName == SettingsManager.Options.AmazonRegionSystemName); if (region == null) { region = regions.FirstOrDefault(x => x.ToString().Contains("EU West") && x.ToString().Contains("London")); } if (region == null) { region = regions.FirstOrDefault(x => x.ToString().Contains("EU West")); } if (region == null) { region = regions.FirstOrDefault(); } if (region != null) { RegionComboBox.SelectedItem = region; } RegionComboBox.SelectedIndexChanged += RegionComboBox_SelectedIndexChanged; //AmazonEnabledCheckBox.DataBindings.Add(nameof(AmazonEnabledCheckBox.Checked), SettingsManager.Options, nameof(SettingsManager.Options.AmazonEnabled)); }
public MainBodyControl() { InitializeComponent(); if (ControlsHelper.IsDesignMode(this)) { return; } PadIcons = new ContentControl[] { Pad1TabIcon, Pad2TabIcon, Pad3TabIcon, Pad4TabIcon, }; PadColors = new Color[4]; PadControls = new PadControl[] { Pad1Panel, Pad2Panel, Pad3Panel, Pad4Panel, }; Global.UpdateControlFromStates += Global_UpdateControlFromStates; }
public CacheOptionsUserControl() { InitializeComponent(); if (ControlsHelper.IsDesignMode(this)) { return; } ControlsHelper.BindEnum <CacheFileFormat>(CacheAudioFormatComboBox, "{2}"); CacheAudioChannelsComboBox.DataSource = (AudioChannel[])Enum.GetValues(typeof(AudioChannel)); // Audio Sample Rate. CacheAudioSampleRateComboBox.DataSource = new int[] { 8000, 11025, 22050, 44100, 48000 }; // Audio Bits Per Sample. CacheAudioBitsPerSampleComboBox.DataSource = new int[] { 8, 16, 24 }; // 32 kbit/s – generally acceptable only for speech // 96 kbit/s – generally used for speech or low-quality streaming // 128 or 160 kbit/s – mid-range bitrate quality // 192 kbit/s – medium quality bitrate // 256 kbit/s – a commonly used high-quality bitrate // 320 kbit/s – highest level supported by the MP3 standard CacheAudioAverageBitsPerSecondComboBox.DataSource = new int[] { 32000, 64000, 96000, 128000, 192000, 256000, 320000 }; // Block Alignment = Bytes per Sample x Number of Channels // For example, the block alignment value for 16-bit PCM format mono audio is 2 (2 bytes per sample x 1 channel). For 16-bit PCM format stereo audio, the block alignment value is 4. CacheAudioBlockAlignComboBox.DataSource = new int[] { 1, 2, 4 }; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (ControlsHelper.IsDesignMode(this)) { return; } StartHelper.OnClose += (sender1, e1) => Close(); StartHelper.OnRestore += (sender1, e1) => Global._TrayManager.RestoreFromTray(true); AppHelper.InitializeHidGuardian(); if (string.IsNullOrEmpty(System.Threading.Thread.CurrentThread.Name)) { System.Threading.Thread.CurrentThread.Name = "MainFormThread"; } Global.DHelper.DevicesUpdated += DHelper_DevicesUpdated; Global.DHelper.UpdateCompleted += DHelper_UpdateCompleted; Global.DHelper.FrequencyUpdated += DHelper_FrequencyUpdated; Global.DHelper.StatesRetrieved += DHelper_StatesRetrieved; Global.DHelper.XInputReloaded += DHelper_XInputReloaded; MainBodyPanel.SettingsPanel._ParentControl = MainPanel._bwm; MainBodyPanel.SettingsPanel.MainDataGrid.SelectionMode = System.Windows.Controls.DataGridSelectionMode.Extended; MainBodyPanel.SettingsPanel.InitPanel(); // NotifySettingsChange will be called on event suspension and resume. SettingsManager.Current.NotifySettingsStatus = NotifySettingsStatus; // NotifySettingsChange will be called on setting changes. SettingsManager.Current.SettingChanged += Current_SettingChanged; SettingsManager.Summaries.Items.ListChanged += Summaries_ListChanged; XInputMaskScanner.FileInfoCache.Load(); UpdateTimer = new System.Timers.Timer { AutoReset = false, Interval = DefaultPoolingInterval }; UpdateTimer.Elapsed += UpdateTimer_Elapsed; SettingsTimer = new System.Timers.Timer { AutoReset = false, Interval = 500 }; SettingsTimer.Elapsed += SettingsTimer_Elapsed; CleanStatusTimer = new System.Timers.Timer { AutoReset = false, Interval = 3000 }; CleanStatusTimer.Elapsed += CleanStatusTimer_Elapsed; Title = EngineHelper.GetProductFullName(); MainBodyPanel.ShowProgramsTab(SettingsManager.Options.ShowProgramsTab); MainBodyPanel.ShowSettingsTab(SettingsManager.Options.ShowSettingsTab); MainBodyPanel.ShowDevicesTab(SettingsManager.Options.ShowDevicesTab); // Start Timers. UpdateTimer.Start(); JocysCom.ClassLibrary.Win32.NativeMethods.CleanSystemTray(); // If enabling first time and application version changed then... ErrorsHelper.InitErrorsHelper(AppVersionChanged, MainPanel.StatusErrorsLabel, MainPanel.StatusErrorsIcon, MainPanel); var game = SettingsManager.CurrentGame; if (SettingsManager.Options.HidGuardianConfigureAutomatically) { // Enable Reconfigure HID Guardian. var changed = SettingsManager.AutoHideShowMappedDevices(game); var mappedInstanceGuids = SettingsManager.GetMappedDevices(game?.FileName, true) .Select(x => x.InstanceGuid).ToArray(); AppHelper.SynchronizeToHidGuardian(mappedInstanceGuids); } }