private void startServerButton_Click(object sender, RoutedEventArgs e)
{
if (server != null)
{
if (server.isRunning)
{
startServerButton.Content = "...Stopping";
ServerStatusItem.Content = "Server Stopping...";
ServerStatusTextBlock.Text = "Stopping...";
//Force the status tab to redraw before stopping the server
StatusTab.InvalidateVisual();
ForceGUIUpdate();
System.Threading.Thread.Sleep(100);
uptimeUpdateTimer.Stop();
server.stopServer();
startServerButton.Content = "Start";
ServerStatusItem.Content = "Server Stopped";
ServerStatusTextBlock.Text = "Stopped";
RunTimeTextBlock.Text = "0";
}
else
{
//The server doesn't actually start until the callback from the voice core
startServerButton.IsEnabled = false;
startServerButton.Content = "...Starting"; //For some screwy reason, it reverses where the periods are on the button, which is why they are first here
ServerStatusItem.Content = "Server Starting...";
ServerStatusTextBlock.Text = "Starting...";
server.launchServer();
serverStartTime = DateTime.Now;
uptimeUpdateTimer.Start();
}
}
}