private void LoadLanguage() { UpdateTitle(); foreach (var c in ViewUtils.FindVisualChildren <Label>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <Button>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <GroupBox>(this)) { c.Header = I18N.GetString(c.Header.ToString()); } TextBlock1.Text = I18N.GetString(TextBlock1.Text); }
private void LoadLanguage() { UpdateTitle(); foreach (var c in ViewUtils.FindVisualChildren <Label>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <Button>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <GroupBox>(this)) { c.Header = I18N.GetString(c.Header.ToString()); } ProxyTypeComboBox.Items.Add(I18N.GetString(@"Socks5(support UDP)")); ProxyTypeComboBox.Items.Add(I18N.GetString(@"Http tunnel")); ProxyTypeComboBox.Items.Add(I18N.GetString(@"TCP Port tunnel")); foreach (var value in Enum.GetValues(typeof(LoadBalance))) { var str = value.ToString(); _balanceIndexMap.Add(str); BalanceComboBox.Items.Add(I18NUtil.GetAppStringValue(str)); } }
private void Window_Loaded(object sender, RoutedEventArgs _) { LoadLanguage(); _controller.ConfigChanged += controller_ConfigChanged; ValueChanged += PortSettingsWindow_ValueChanged; foreach (var c in ViewUtils.FindVisualChildren <TextBox>(this)) { //Not Child of NumberUpDown if (c.Name.EndsWith(@"TextBox")) { c.TextChanged += (o, e) => { ValueChanged?.Invoke(this, new EventArgs()); }; } } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Checked += (o, e) => { ValueChanged?.Invoke(this, new EventArgs()); }; c.Unchecked += (o, e) => { ValueChanged?.Invoke(this, new EventArgs()); }; } foreach (var c in ViewUtils.FindVisualChildren <ComboBox>(this)) { c.SelectionChanged += (o, e) => { ValueChanged?.Invoke(this, new EventArgs()); }; } foreach (var c in ViewUtils.FindVisualChildren <NumberUpDown>(this)) { c.ValueChanged += (o, e) => { ValueChanged?.Invoke(this, new EventArgs()); }; } LoadCurrentConfiguration(); ApplyButton.IsEnabled = false; }
private void LoadLanguage() { Title = I18N.GetString(@"Subscribe Settings"); foreach (var c in ViewUtils.FindVisualChildren <Label>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <Button>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } }
private void LoadLanguage() { UpdateTitle(); foreach (var c in ViewUtils.FindVisualChildren <Label>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <Button>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <GroupBox>(this)) { c.Header = I18N.GetString(c.Header.ToString()); } ProxyTypeComboBox.Items.Add(I18N.GetString(@"Socks5(support UDP)")); ProxyTypeComboBox.Items.Add(I18N.GetString(@"Http tunnel")); ProxyTypeComboBox.Items.Add(I18N.GetString(@"TCP Port tunnel")); BalanceComboBox.Items.Add(@"OneByOne"); BalanceComboBox.Items.Add(@"Random"); BalanceComboBox.Items.Add(@"FastDownloadSpeed"); BalanceComboBox.Items.Add(@"LowLatency"); BalanceComboBox.Items.Add(@"LowException"); BalanceComboBox.Items.Add(@"SelectedFirst"); BalanceComboBox.Items.Add(@"Timer"); for (var i = 0; i < BalanceComboBox.Items.Count; ++i) { var str = BalanceComboBox.Items[i].ToString(); _balanceIndexMap[i] = str; BalanceComboBox.Items[i] = I18N.GetString(str); } }
private void Window_Loaded(object sender, RoutedEventArgs _) { UpdateTitle(); LoadItems(); _controller.ConfigChanged += controller_ConfigChanged; foreach (var c in ViewUtils.FindVisualChildren <TextBox>(this)) { //Not Child of NumberUpDown if (c.Name.EndsWith(@"TextBox")) { c.TextChanged += (o, e) => { ApplyButton.IsEnabled = true; }; } } foreach (var c in ViewUtils.FindVisualChildren <PasswordBox>(this)) { c.PasswordChanged += (o, e) => { ApplyButton.IsEnabled = true; }; } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Checked += (o, e) => { ApplyButton.IsEnabled = true; }; c.Unchecked += (o, e) => { ApplyButton.IsEnabled = true; }; } foreach (var c in ViewUtils.FindVisualChildren <ComboBox>(this)) { c.SelectionChanged += (o, e) => { ApplyButton.IsEnabled = true; }; } foreach (var c in ViewUtils.FindVisualChildren <NumberUpDown>(this)) { c.ValueChanged += (o, e) => { ApplyButton.IsEnabled = true; }; } //Fix Width foreach (var c in ViewUtils.FindVisualChildren <GroupBox>(this)) { c.MaxWidth = c.ActualWidth; c.MinWidth = c.ActualWidth; } LoadCurrentConfiguration(); ApplyButton.IsEnabled = false; }
private void LoadLanguage() { Title = I18N.GetString(@"Port Settings"); foreach (var c in ViewUtils.FindVisualChildren <Label>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <Button>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <CheckBox>(this)) { c.Content = I18N.GetString(c.Content.ToString()); } foreach (var c in ViewUtils.FindVisualChildren <GroupBox>(this)) { c.Header = I18N.GetString(c.Header.ToString()); } TypeComboBox.DisplayMemberPath = "Text"; TypeComboBox.SelectedValuePath = "Value"; var items = new[] { new { Text = I18N.GetString("Port Forward"), Value = PortMapType.Forward }, new { Text = I18N.GetString("Force Proxy"), Value = PortMapType.ForceProxy }, new { Text = I18N.GetString("Proxy With Rule"), Value = PortMapType.RuleProxy } }; TypeComboBox.ItemsSource = items; TypeComboBox.SelectedIndex = 0; }