From be8bb2465c5b0c762f7ba5bb18b5dd3570169479 Mon Sep 17 00:00:00 2001 From: ruri Date: Sat, 25 May 2019 17:16:49 +0200 Subject: [PATCH] Fixed black caret in ComboBoxEditableTextBox. --- OpenBullet/Pages/Main/ProxyManager.xaml.cs | 136 ++++++++++---------- OpenBullet/Themes/MetroDark/Styles.WPF.xaml | 1 + 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/OpenBullet/Pages/Main/ProxyManager.xaml.cs b/OpenBullet/Pages/Main/ProxyManager.xaml.cs index bb542cd..f8101c1 100644 --- a/OpenBullet/Pages/Main/ProxyManager.xaml.cs +++ b/OpenBullet/Pages/Main/ProxyManager.xaml.cs @@ -38,74 +38,6 @@ namespace OpenBullet vm.UpdateProperties(); } - private void CheckCountry(CProxy proxy) - { - try - { - using (var request = new HttpRequest()) - { - request.ConnectTimeout = (int)vm.Timeout; - var response = request.Get("http://ip-api.com/csv/" + proxy.Host); - var csv = response.ToString(); - var split = csv.Split(','); - - var country = "Unknown"; - - if (split[0] == "success") - country = split[1]; - - proxy.Country = country.Replace("\"", ""); - - using (var db = new LiteDatabase(Globals.dataBaseFile)) - { - db.GetCollection("proxies").Update(proxy); - } - - Globals.LogInfo(Components.ProxyManager, "Checked country for proxy '" + proxy.Proxy + "' with result '" + proxy.Country + "'"); - } - - } - catch (Exception ex) - { - Globals.LogError(Components.ProxyManager, "Failted to check country for proxy '" + proxy.Proxy + $"' - {ex.Message}"); - } - } - - private void CheckProxy(CProxy proxy) - { - var before = DateTime.Now; - try - { - using (var request = new HttpRequest()) - { - request.Proxy = proxy.GetClient(); - request.Proxy.ConnectTimeout = (int)vm.Timeout * 1000; - request.Proxy.ReadWriteTimeout = (int)vm.Timeout * 1000; - request.ConnectTimeout = (int)vm.Timeout * 1000; - request.KeepAliveTimeout = (int)vm.Timeout * 1000; - request.ReadWriteTimeout = (int)vm.Timeout * 1000; - var response = request.Get(vm.TestURL); - var source = response.ToString(); - - App.Current.Dispatcher.Invoke(new Action(() => proxy.Ping = (int)(DateTime.Now - before).TotalMilliseconds)); - - App.Current.Dispatcher.Invoke(new Action(() => proxy.Working = source.Contains(vm.SuccessKey) ? ProxyWorking.YES : ProxyWorking.NO)); - - Globals.LogInfo(Components.ProxyManager, "Proxy '" + proxy.Proxy + $"' responded in {proxy.Ping} ms"); - } - } - catch (Exception ex) - { - Globals.LogInfo(Components.ProxyManager, "Proxy '" + proxy.Proxy + $"' failed to respond - {ex.Message}"); - App.Current.Dispatcher.Invoke(new Action(() => proxy.Working = ProxyWorking.NO)); - } - - using (var db = new LiteDatabase(Globals.dataBaseFile)) - { - db.GetCollection("proxies").Update(proxy); - } - } - #region Start Button private void checkButton_Click(object sender, RoutedEventArgs e) { @@ -210,6 +142,74 @@ namespace OpenBullet semaphore.Release(); } } + + private void CheckCountry(CProxy proxy) + { + try + { + using (var request = new HttpRequest()) + { + request.ConnectTimeout = (int)vm.Timeout; + var response = request.Get("http://ip-api.com/csv/" + proxy.Host); + var csv = response.ToString(); + var split = csv.Split(','); + + var country = "Unknown"; + + if (split[0] == "success") + country = split[1]; + + App.Current.Dispatcher.Invoke(new Action(() => proxy.Country = country.Replace("\"", ""))); + + using (var db = new LiteDatabase(Globals.dataBaseFile)) + { + db.GetCollection("proxies").Update(proxy); + } + + Globals.LogInfo(Components.ProxyManager, "Checked country for proxy '" + proxy.Proxy + "' with result '" + proxy.Country + "'"); + } + + } + catch (Exception ex) + { + Globals.LogError(Components.ProxyManager, "Failted to check country for proxy '" + proxy.Proxy + $"' - {ex.Message}"); + } + } + + private void CheckProxy(CProxy proxy) + { + var before = DateTime.Now; + try + { + using (var request = new HttpRequest()) + { + request.Proxy = proxy.GetClient(); + request.Proxy.ConnectTimeout = (int)vm.Timeout * 1000; + request.Proxy.ReadWriteTimeout = (int)vm.Timeout * 1000; + request.ConnectTimeout = (int)vm.Timeout * 1000; + request.KeepAliveTimeout = (int)vm.Timeout * 1000; + request.ReadWriteTimeout = (int)vm.Timeout * 1000; + var response = request.Get(vm.TestURL); + var source = response.ToString(); + + App.Current.Dispatcher.Invoke(new Action(() => proxy.Ping = (int)(DateTime.Now - before).TotalMilliseconds)); + + App.Current.Dispatcher.Invoke(new Action(() => proxy.Working = source.Contains(vm.SuccessKey) ? ProxyWorking.YES : ProxyWorking.NO)); + + Globals.LogInfo(Components.ProxyManager, "Proxy '" + proxy.Proxy + $"' responded in {proxy.Ping} ms"); + } + } + catch (Exception ex) + { + Globals.LogInfo(Components.ProxyManager, "Proxy '" + proxy.Proxy + $"' failed to respond - {ex.Message}"); + App.Current.Dispatcher.Invoke(new Action(() => proxy.Working = ProxyWorking.NO)); + } + + using (var db = new LiteDatabase(Globals.dataBaseFile)) + { + db.GetCollection("proxies").Update(proxy); + } + } #endregion public void AddProxies(string fileName, ProxyType type, List lines) diff --git a/OpenBullet/Themes/MetroDark/Styles.WPF.xaml b/OpenBullet/Themes/MetroDark/Styles.WPF.xaml index 8c372e7..c4b3d84 100644 --- a/OpenBullet/Themes/MetroDark/Styles.WPF.xaml +++ b/OpenBullet/Themes/MetroDark/Styles.WPF.xaml @@ -392,6 +392,7 @@ +