Skip to content

Commit

Permalink
Fix bugs and proxy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
WXRIW committed Sep 18, 2021
1 parent 99d247c commit 75f9ec6
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions Ink Canvas/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,26 +219,30 @@ private void Window_Loaded(object sender, RoutedEventArgs e)

//检查
new Thread(new ThreadStart(() => {
string response = GetWebClient("http://e.wxriw.cn:1957");
if (response.Contains("Special Version"))
try
{
if (response.Contains("<notice>"))
string response = GetWebClient("http://e.wxriw.cn:1957");
if (response.Contains("Special Version"))
{
string str = Strings.Mid(response, response.IndexOf("<notice>") + 9);
if (str.Contains("<notice>"))
if (response.Contains("<notice>"))
{
str = Strings.Left(str, str.IndexOf("<notice>")).Trim();
if (str.Length > 0)
string str = Strings.Mid(response, response.IndexOf("<notice>") + 9);
if (str.Contains("<notice>"))
{
Application.Current.Dispatcher.Invoke(() =>
str = Strings.Left(str, str.IndexOf("<notice>")).Trim();
if (str.Length > 0)
{
GroupBoxMASEZVersion.Visibility = Visibility.Visible;
TextBlockMASEZNotice.Text = str;
});
Application.Current.Dispatcher.Invoke(() =>
{
GroupBoxMASEZVersion.Visibility = Visibility.Visible;
TextBlockMASEZNotice.Text = str;
});
}
}
}
}
}
catch { }
})).Start();

//加载设置
Expand Down Expand Up @@ -411,13 +415,13 @@ private void ColorSwitchCheck()
if (Main_Grid.Background == Brushes.Transparent)
{
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
if (currentMode == 1)
{
currentMode = 0;
GridBackgroundCover.Visibility = Visibility.Hidden;
}
}
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
}

private void BtnColorBlack_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -1040,6 +1044,7 @@ public static string GetWebClient(string url)
{
HttpWebRequest myrq = (HttpWebRequest)WebRequest.Create(url);

myrq.Proxy = null;
myrq.KeepAlive = false;
myrq.Timeout = 30 * 1000;
myrq.Method = "Get";
Expand Down

0 comments on commit 75f9ec6

Please sign in to comment.