Skip to content

Commit 75f9ec6

Browse files
committed
Fix bugs and proxy issues
1 parent 99d247c commit 75f9ec6

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

Ink Canvas/MainWindow.xaml.cs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,26 +219,30 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
219219

220220
//检查
221221
new Thread(new ThreadStart(() => {
222-
string response = GetWebClient("http://e.wxriw.cn:1957");
223-
if (response.Contains("Special Version"))
222+
try
224223
{
225-
if (response.Contains("<notice>"))
224+
string response = GetWebClient("http://e.wxriw.cn:1957");
225+
if (response.Contains("Special Version"))
226226
{
227-
string str = Strings.Mid(response, response.IndexOf("<notice>") + 9);
228-
if (str.Contains("<notice>"))
227+
if (response.Contains("<notice>"))
229228
{
230-
str = Strings.Left(str, str.IndexOf("<notice>")).Trim();
231-
if (str.Length > 0)
229+
string str = Strings.Mid(response, response.IndexOf("<notice>") + 9);
230+
if (str.Contains("<notice>"))
232231
{
233-
Application.Current.Dispatcher.Invoke(() =>
232+
str = Strings.Left(str, str.IndexOf("<notice>")).Trim();
233+
if (str.Length > 0)
234234
{
235-
GroupBoxMASEZVersion.Visibility = Visibility.Visible;
236-
TextBlockMASEZNotice.Text = str;
237-
});
235+
Application.Current.Dispatcher.Invoke(() =>
236+
{
237+
GroupBoxMASEZVersion.Visibility = Visibility.Visible;
238+
TextBlockMASEZNotice.Text = str;
239+
});
240+
}
238241
}
239242
}
240243
}
241244
}
245+
catch { }
242246
})).Start();
243247

244248
//加载设置
@@ -411,13 +415,13 @@ private void ColorSwitchCheck()
411415
if (Main_Grid.Background == Brushes.Transparent)
412416
{
413417
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
414-
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
415418
if (currentMode == 1)
416419
{
417420
currentMode = 0;
418421
GridBackgroundCover.Visibility = Visibility.Hidden;
419422
}
420423
}
424+
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
421425
}
422426

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

1047+
myrq.Proxy = null;
10431048
myrq.KeepAlive = false;
10441049
myrq.Timeout = 30 * 1000;
10451050
myrq.Method = "Get";

0 commit comments

Comments
 (0)