corrade-vassal – Diff between revs 5 and 7
?pathlinks?
Rev 5 | Rev 7 | |||
---|---|---|---|---|
Line -... | Line 1... | |||
- | 1 | /////////////////////////////////////////////////////////////////////////// |
||
- | 2 | // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // |
||
- | 3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
||
- | 4 | // rights of fair usage, the disclaimer and warranty conditions. // |
||
- | 5 | /////////////////////////////////////////////////////////////////////////// |
||
- | 6 | |
||
1 | using System; |
7 | using System; |
|
2 | using System.Collections.Generic; |
8 | using System.Collections.Generic; |
|
3 | using System.ComponentModel; |
9 | using System.ComponentModel; |
|
4 | using System.Data; |
10 | using System.Data; |
|
5 | using System.Drawing; |
11 | using System.Drawing; |
|
6 | using System.IO; |
12 | using System.IO; |
|
7 | using System.Linq; |
13 | using System.Linq; |
|
- | 14 | using System.Net.Sockets; |
||
- | 15 | using System.Reflection; |
||
8 | using System.Text; |
16 | using System.Text; |
|
9 | using System.Threading; |
17 | using System.Threading; |
|
10 | using System.Threading.Tasks; |
18 | using System.Threading.Tasks; |
|
11 | using System.Windows.Forms; |
19 | using System.Windows.Forms; |
|
12 | using System.Xml.Serialization; |
20 | using System.Xml.Serialization; |
|
Line 419... | Line 427... | |||
419 | { |
427 | { |
|
420 | Vassal.vassalForm.RegionRestartDelayBox.Text = mainForm.RegionRestartDelay.Text; |
428 | Vassal.vassalForm.RegionRestartDelayBox.Text = mainForm.RegionRestartDelay.Text; |
|
421 | } |
429 | } |
|
422 | })); |
430 | })); |
|
423 | })); |
431 | })); |
|
- | 432 | // Spawn a thread to check Corrade's connection status. |
||
- | 433 | new Thread(() => |
||
- | 434 | { |
||
- | 435 | TcpClient tcpClient = new TcpClient(); |
||
- | 436 | try |
||
- | 437 | { |
||
- | 438 | System.Uri uri = new System.Uri(Vassal.vassalConfiguration.HTTPServerURL); |
||
- | 439 | tcpClient.Connect(uri.Host, uri.Port); |
||
- | 440 | // port open |
||
- | 441 | Vassal.vassalForm.BeginInvoke((MethodInvoker)(() => { Vassal.vassalForm.Tabs.Enabled = true; })); |
||
- | 442 | // set the loading spinner |
||
- | 443 | Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); |
||
- | 444 | System.IO.Stream file = |
||
- | 445 | thisAssembly.GetManifestResourceStream("Vassal.img.loading.gif"); |
||
- | 446 | switch (file != null) |
||
- | 447 | { |
||
- | 448 | case true: |
||
- | 449 | Vassal.vassalForm.BeginInvoke((MethodInvoker)(() => |
||
- | 450 | { |
||
- | 451 | Vassal.vassalForm.RegionAvatarsMap.SizeMode = PictureBoxSizeMode.CenterImage; |
||
- | 452 | Vassal.vassalForm.RegionAvatarsMap.Image = Image.FromStream(file); |
||
- | 453 | Vassal.vassalForm.RegionAvatarsMap.Refresh(); |
||
- | 454 | })); |
||
- | 455 | break; |
||
- | 456 | } |
||
- | 457 | } |
||
- | 458 | catch (Exception) |
||
- | 459 | { |
||
- | 460 | // port closed |
||
- | 461 | Vassal.vassalForm.BeginInvoke((MethodInvoker)(() => { Vassal.vassalForm.Tabs.Enabled = false; })); |
||
- | 462 | } |
||
- | 463 | }) |
||
- | 464 | { IsBackground = true }.Start(); |
||
424 | } |
465 | } |
|
425 | } |
466 | } |
|
426 | } |
467 | } |