diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-31 12:07:40 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-31 12:07:40 +0300 |
| commit | f03676747c3c4207da0be4e59273cbbca9b79649 (patch) | |
| tree | 5fe054dea1c4135416ecdfc252ae2f867633bec6 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 040118073dc67e9daf9792863786f87705f3fff6 (diff) | |
| download | Tango-f03676747c3c4207da0be4e59273cbbca9b79649.tar.gz Tango-f03676747c3c4207da0be4e59273cbbca9b79649.zip | |
Implemented PPC data base source from %appdata% on PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
3 files changed, 26 insertions, 6 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs index cc13e1216..1e3a16e3e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs @@ -2,9 +2,12 @@ using System.Collections.Generic; using System.Configuration; using System.Data; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; +using Tango.BL; +using Tango.Core; using Tango.Core.Helpers; using Tango.Settings; @@ -18,12 +21,6 @@ namespace Tango.PPC.UI protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); - - Environment.CurrentDirectory = PathHelper.GetStartupPath(); - - //var s = SettingsManager.Default.GetOrCreate<Core.CoreSettings>(); - //s.SQLServerAddress = "DB\\Tango.mdf"; - //s.Save(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs index 0eb59eeeb..b5af63e32 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tango.BL; using Tango.BL.Entities; @@ -42,6 +43,8 @@ namespace Tango.PPC.UI.ViewModels { Task.Factory.StartNew(() => { + Thread.Sleep(500); + if (_jobsContext != null) { _jobsContext.Dispose(); 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 5373539f2..df4a9c8e2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Helpers; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; @@ -22,6 +25,23 @@ namespace Tango.PPC.UI.ViewModels public async override void OnApplicationStarted() { await Task.Delay(500); + + //TODO: Use this in the future. + + //#if DEBUG + // DataSource = "localhost\\SQLEXPRESS"; + //#else + // DataBaseSettings.DefaultDataSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.db"); + //#endif + + CoreSettings.DefaultDataBaseSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.db"); + + if (!File.Exists(CoreSettings.DefaultDataBaseSource)) + { + Directory.CreateDirectory(Path.GetDirectoryName(CoreSettings.DefaultDataBaseSource)); + File.Copy(Path.Combine(PathHelper.GetStartupPath(), "DB", "Tango.db"), CoreSettings.DefaultDataBaseSource); + } + NavigationManager.NavigateTo(NavigationView.LayoutView); NavigationManager.NavigateTo(NavigationView.JobsView); } |
