Fixed black caret in ComboBoxEditableTextBox.

This commit is contained in:
ruri
2019-05-25 17:16:49 +02:00
parent ad44543e41
commit be8bb2465c
2 changed files with 69 additions and 68 deletions
+68 -68
View File
@@ -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<CProxy>("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<CProxy>("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<CProxy>("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<CProxy>("proxies").Update(proxy);
}
}
#endregion
public void AddProxies(string fileName, ProxyType type, List<string> lines)
@@ -392,6 +392,7 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="SelectionBrush" Value="{StaticResource TextBoxFocusedBrush}" />
<Setter Property="SelectionOpacity" Value="0.4" />
<Setter Property="CaretBrush" Value="{DynamicResource ForegroundMain}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">