aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-11-26 14:19:06 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-11-26 14:19:06 +0200
commit6fb22273d15ed476ccbd3820de6af9bc0deee793 (patch)
tree35c40b14471bbc191d12a1dafcd807ec16aacb87 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent10a9435c7fece43c588addb744952d92596a8f5b (diff)
downloadTango-6fb22273d15ed476ccbd3820de6af9bc0deee793.tar.gz
Tango-6fb22273d15ed476ccbd3820de6af9bc0deee793.zip
Implemented Application Initialization Error and Handling.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingErrorViewVM.cs43
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs11
2 files changed, 54 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingErrorViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingErrorViewVM.cs
new file mode 100644
index 000000000..3c05e3690
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingErrorViewVM.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Commands;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Navigation;
+
+namespace Tango.PPC.UI.ViewModels
+{
+ public class LoadingErrorViewVM : PPCViewModel, INavigationObjectReceiver<Exception>
+ {
+ private String _error;
+ public String Error
+ {
+ get { return _error; }
+ set { _error = value; RaisePropertyChangedAuto(); }
+ }
+
+ public RelayCommand RestartCommand { get; set; }
+
+ public LoadingErrorViewVM()
+ {
+ RestartCommand = new RelayCommand(Restart);
+ }
+
+ public override void OnApplicationStarted()
+ {
+
+ }
+
+ public void OnNavigatedToWithObject(Exception ex)
+ {
+ Error = ex.Message;
+ }
+
+ private void Restart()
+ {
+ ApplicationManager.Restart();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
index 486829103..5598362be 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
@@ -54,6 +54,17 @@ namespace Tango.PPC.UI.ViewModels
{
Task.Delay(1000).ContinueWith((x) => { IsLoading = true; });
}
+
+ applicationManager.ApplicationInitializationError += ApplicationManager_ApplicationInitializationError;
+ }
+
+ private void ApplicationManager_ApplicationInitializationError(object sender, Exception ex)
+ {
+ InvokeUI(() =>
+ {
+ NavigationManager.NavigateWithObject<Exception>(NavigationView.LoadingErrorView, ex);
+ IsLoading = false;
+ });
}
/// <summary>