From f0bcdcdbfa78ba705b8fa44591fa594a425352a9 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 15 Jun 2018 23:18:51 +0300 Subject: Implemented TouchLoadingPanel --- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 15 ++ .../PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml | 186 +++++++++++---------- .../PPCApplication/DefaultPPCApplicationManager.cs | 6 +- .../PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs | 5 - 4 files changed, 111 insertions(+), 101 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index fabb57d10..3cbb44bbe 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -53,6 +53,17 @@ namespace Tango.PPC.Jobs.ViewModels } } + private bool _isLoadingJobs; + /// + /// Gets or sets a value indicating whether this instance is loading jobs. + /// + public bool IsLoadingJobs + { + get { return _isLoadingJobs; } + set { _isLoadingJobs = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands @@ -139,6 +150,8 @@ namespace Tango.PPC.Jobs.ViewModels { Task.Factory.StartNew(() => { + IsLoadingJobs = true; + Thread.Sleep(500); if (_jobsContext != null) @@ -151,6 +164,8 @@ namespace Tango.PPC.Jobs.ViewModels Jobs = _jobsContext.Jobs.Where(x => x.Machine.SerialNumber == Settings.MachineSerialNumber).ToObservableCollection(); JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs); JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + + IsLoadingJobs = false; }); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml index 1686aef84..63e65f777 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml @@ -23,7 +23,7 @@ - + @@ -58,98 +58,100 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 233751ddb..554bd704c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -128,10 +128,8 @@ namespace Tango.PPC.UI.PPCApplication var settings = SettingsManager.Default.GetOrCreate(); ; - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - Machine = db.Machines.SingleOrDefault(x => x.SerialNumber == settings.MachineSerialNumber); - } + ObservablesEntitiesAdapter.Instance.Initialize(); + Machine = ObservablesEntitiesAdapter.Instance.Machines.FirstOrDefault(); }); ApplicationStarted?.Invoke(this, new EventArgs()); 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 f6b06ca61..5bc02f829 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -36,11 +36,6 @@ namespace Tango.PPC.UI.ViewModels /// public async override void OnApplicationStarted() { - await Task.Factory.StartNew(() => - { - ObservablesEntitiesAdapter.Instance.Initialize(); - }); - ApplicationManager.ModulesInitialized += (_, __) => { NavigationManager.NavigateTo(NavigationView.HomeModule); -- cgit v1.3.1