using System; using System.ComponentModel; using System.Windows; using System.Windows.Forms; namespace Launcher_Client { public partial class Vote : Window { Boolean HasVoted; Timer VoteTimer; public Vote() { InitializeComponent(); Title = String.Format("Vote For {0}", Properties.Settings.Default.ServerName); } private void Window_Initialized(Object Sender, EventArgs Arguments) { Browser.Source = new Uri("http://topofgames.com/index.php?do=votes&id=75601"); VoteTimer = new Timer(); VoteTimer.Tick += VoteTimer_Tick; VoteTimer.Start(); } private void VoteTimer_Tick(Object Sender, EventArgs Arguments) { if (URLCheck()) { HasVoted = true; VoteTimer.Stop(); Close(); } } private Boolean URLCheck() { if (Browser.Source == new Uri("http://topofgames.com")) { return true; } else if (Browser.Source == new Uri("http://topofgames.com/index.php")) { return true; } return false; } private void Window_Closing(object sender, CancelEventArgs e) { if (HasVoted) { } else { Environment.Exit(0); } } } }