From 2d6d93b6da907b78fa10af1a7ecfd2d9a1aeb112 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Tue, 5 Sep 2017 14:23:35 -0400 Subject: [PATCH] Some clean up and tweaks to get the shell UI shown (finally). --- src/client/spark/App.xaml | 4 ++-- src/client/spark/ShellBootstrapper.cs | 4 ++++ src/client/spark/uicore/Images/Icons.cs | 2 +- src/client/spark/uicore/Shell/Login/LoginModel.cs | 2 +- src/client/spark_api/api/Channels/QuickBusClientChannel.cs | 3 +++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/client/spark/App.xaml b/src/client/spark/App.xaml index 9aecd8c31..905bdc147 100644 --- a/src/client/spark/App.xaml +++ b/src/client/spark/App.xaml @@ -11,14 +11,14 @@ - + None 200 30 diff --git a/src/client/spark/ShellBootstrapper.cs b/src/client/spark/ShellBootstrapper.cs index d4205b0aa..9abfff034 100644 --- a/src/client/spark/ShellBootstrapper.cs +++ b/src/client/spark/ShellBootstrapper.cs @@ -20,6 +20,10 @@ namespace mbts.ui.shell private Window _login; public ShellBootstrapper() { +#if DEBUG + native.NativeMethods.AllocConsole(); + Console.WriteLine("Alloced Console"); +#endif // Get the LoginModel instance on this thread to make sure it performs syncronous config initialization. var lm = LoginModel.instance; // Show the dialog on a background thread so animations aren't blocked during the main application startup diff --git a/src/client/spark/uicore/Images/Icons.cs b/src/client/spark/uicore/Images/Icons.cs index 5056d7cea..d7081ad05 100644 --- a/src/client/spark/uicore/Images/Icons.cs +++ b/src/client/spark/uicore/Images/Icons.cs @@ -10,7 +10,7 @@ namespace mbts.ui { public class Icons { - static readonly string base_uri = "pack://application:,,,/Images/Icons/"; + static readonly string base_uri = "pack://application:,,,/uicore/Images/Icons/"; private static ResourceDictionary _resources = (ResourceDictionary)Application.LoadComponent(new Uri("/uicore/Images/Vector/Icons.xaml", UriKind.RelativeOrAbsolute)); private static Uri uri(string filename) { diff --git a/src/client/spark/uicore/Shell/Login/LoginModel.cs b/src/client/spark/uicore/Shell/Login/LoginModel.cs index 6429e63d3..fd23194c1 100644 --- a/src/client/spark/uicore/Shell/Login/LoginModel.cs +++ b/src/client/spark/uicore/Shell/Login/LoginModel.cs @@ -78,7 +78,7 @@ namespace mbts.ui.shell return _username; } public string get_workspace() { - return _workspace; + return _workspace ?? ""; } public Task> workspaces_for(string user) { return _enum_workspace.get_workspaces(user); diff --git a/src/client/spark_api/api/Channels/QuickBusClientChannel.cs b/src/client/spark_api/api/Channels/QuickBusClientChannel.cs index 0aea58dea..1ef3f1f20 100644 --- a/src/client/spark_api/api/Channels/QuickBusClientChannel.cs +++ b/src/client/spark_api/api/Channels/QuickBusClientChannel.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Reactive.Linq; using System.IO; using System.Reactive.Disposables; +using mbts; namespace bts.api.core { @@ -17,6 +18,7 @@ namespace bts.api.core { public QuickbusClientChannel(ServiceContext context, string type_name, string qualifier) : base(context) { _client = ApiNativeMethods.api_client_create(context.native_context, type_name, qualifier); + System.Diagnostics.Trace.Assert(_client != IntPtr.Zero); } public override void Dispose() { @@ -48,6 +50,7 @@ namespace bts.api.core { tcs.TrySetResult(new Result(res.header.Code)); } }; + System.Diagnostics.Trace.Assert(_client != IntPtr.Zero, "Channel may have been disposed"); ApiNativeMethods.api_client_send(_client, buffer, buffer.Length, callback, IntPtr.Zero); tcs.Task.ContinueWith(_ => GC.KeepAlive(callback)); return tcs.Task;