Skip to content

Commit

Permalink
Merge branch 'hotfix/serverUpdateFix'
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonscott committed May 13, 2014
2 parents b456dda + f823c44 commit 82ab72d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CadenceHost/Helpers/Cadence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static class Cadence
{
public static readonly String ServerUri = "http://cadence-bu.cloudapp.net/servers";
public static readonly String PulseUri = "http://cadence-bu.cloudapp.net/pulses";
public static readonly String ServerUriUpdate = "http://cadence-bu.cloudapp.net/servers/" + Properties.Settings.Default.ServerID;
public static readonly String ServerUriUpdate = "http://cadence-bu.cloudapp.net/servers/" + Properties.Settings.Default.ServerGUID;
public static readonly String Username = "[email protected]";
public static readonly String Password = "Cadenc3!";

Expand Down
55 changes: 32 additions & 23 deletions CadenceHost/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,34 +139,38 @@ private void OnPresenceError(PubnubClientError obj)
/// </summary>
private void AddNewServer()
{
var dataToSend = new NameValueCollection
try
{
{"servergroup_id", "0"},
{"name", Environment.MachineName},
{"available_disk", _statsHelper.GetTotalDiskStorage()},
{"available_ram", _statsHelper.GetTotalRamSize()},
{"cpu_speed", _statsHelper.GetCpuFrequency().ToString(CultureInfo.InvariantCulture)},
{"os_name", _statsHelper.GetOsName()},
{"os_version", _statsHelper.GetOsVersion()},
{"guid", Settings.Default.ServerGUID}
};
//Creates the server and responds with the ID
var serverId = Cadence.CreateServer(dataToSend);

Settings.Default.ServerID = serverId;
Settings.Default.Save();
var dataToSend = new NameValueCollection
{
{"servergroup_id", "0"},
{"name", Environment.MachineName},
{"available_disk", _statsHelper.GetTotalDiskStorage()},
{"available_ram", _statsHelper.GetTotalRamSize()},
{"cpu_speed", _statsHelper.GetCpuFrequency().ToString(CultureInfo.InvariantCulture)},
{"os_name", _statsHelper.GetOsName()},
{"os_version", _statsHelper.GetOsVersion()},
{"guid", Settings.Default.ServerGUID}
};
//Creates the server and responds with the ID
var serverId = Cadence.CreateServer(dataToSend);

Settings.Default.ServerID = serverId;
Settings.Default.Save();

_serverId = Settings.Default.ServerID;
_serverId = Settings.Default.ServerID;
}
catch (Exception)
{
}
}

private void OnPresenceConnect(object obj)
{
throw new NotImplementedException();
}

private void OnUserPresence(object obj)
{
throw new NotImplementedException();
}

private void AddDebugInfo(string info)
Expand All @@ -179,21 +183,26 @@ private void AddDebugInfo(string info)
});
}

/// <summary>
/// Allows the entire window to be dragged no matter at which point the mouse is down
/// </summary>
/// <param name="sender">Object that sent the event</param>
/// <param name="e">Event Arguments</param>
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
DragMove();
}

private void OnWindowClosing(object sender, CancelEventArgs e)
{
//pn.PresenceUnsubscribe<string>("test", OnUserPresence, OnPresenceConnect, OnPresenceDisconnect, OnPresenceError);
}

private void OnPresenceDisconnect(object obj)
{
}

/// <summary>
/// Stops the pulsing timer
/// </summary>
/// <param name="sender">Object that sent the event</param>
/// <param name="e">Event Arguments</param>
private void OnStatusClick(object sender, RoutedEventArgs e)
{
if (_isRunning)
Expand Down

0 comments on commit 82ab72d

Please sign in to comment.