Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/hugsy/CFB
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Feb 9, 2020
2 parents 836830e + 1818923 commit af29ffc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
17 changes: 13 additions & 4 deletions GUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,19 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)

if (shell.AppFrame.Content == null)
{
var localSettings = ApplicationData.Current.LocalSettings;
var homePageIndex = localSettings.Values["HomePage"]!=null ? (int)localSettings.Values["HomePage"] : 0;
var defaultPageName = App.HomePageList[homePageIndex];
var defaultPage = Type.GetType($"GUI.Views.{defaultPageName}");
Type defaultPage;

try
{
var localSettings = ApplicationData.Current.LocalSettings;
var homePageIndex = localSettings.Values["HomePage"] != null ? (int)localSettings.Values["HomePage"] : 0;
var defaultPageName = App.HomePageList[homePageIndex];
defaultPage = Type.GetType($"GUI.Views.{defaultPageName}");
}
catch (Exception)
{
defaultPage = Type.GetType($"GUI.Views.{nameof(MonitoredIrpsPage)}");
}

// On launch the app frame content will be empty,
// so redirect to the default page (monitored irps)
Expand Down
7 changes: 5 additions & 2 deletions GUI/Models/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ public ConnectionManager()

private void ReinitializeSocket()
{
uri = new Uri(ApplicationData.Current.LocalSettings.Values["IrpBrokerLocation"].ToString());
var IrpLocation = ApplicationData.Current.LocalSettings.Values.ContainsKey("IrpBrokerLocation") ?
ApplicationData.Current.LocalSettings.Values["IrpBrokerLocation"].ToString() :
Models.DefaultSettings.IrpBrokerUri;
uri = new Uri(IrpLocation);
ClientSocket = new StreamSocket();
ClientSocket.Control.KeepAlive = true;
//ClientSocket.Control.NoDelay = false;
ClientSocket.Control.NoDelay = false;
_Status = BrokerConnectionStatus.Disconnected;
}

Expand Down
6 changes: 6 additions & 0 deletions GUI/Models/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public static class Constants
/// </summary>
public const string ProjectIssueUrl = @"https://github.com/hugsy/cfb/issues";

}


public static class DefaultSettings
{
public const string IrpBrokerUri = "tcp://127.0.0.1:1337";

}
}

0 comments on commit af29ffc

Please sign in to comment.