| 1234567891011121314151617181920212223242526272829303132333435363738 |
- namespace ProximaAnalizer.ViewModels;
- internal partial class LoadingViewModel : ObservableObject
- {
- public LoadingViewModel(IRegionManager regionManager, IEventAggregator eventAggregator,SqlSugarCustom sqlSugarCustom)
- {
- this._regionManager = regionManager;
- this._eventAggregator = eventAggregator;
- this._sqlSugarCustom = sqlSugarCustom;
- Task.Factory.StartNew(Initialize);
- }
- private readonly IEventAggregator _eventAggregator;
- private readonly IRegionManager _regionManager;
- private readonly SqlSugarCustom _sqlSugarCustom;
- private void Initialize()
- {
- //Thread.Sleep(2000);
- string dbString = "Database=TINReal;Password=123456;Host=10.4.6.89;Username=postgres;Persist Security Info=True";
- this._sqlSugarCustom.Initialize();
- if(!this._sqlSugarCustom.Open(dbString, DbType.PostgreSQL,true))
- {
- MessageBox.Show("Connect to db 10.4.6.89 Failed");
- App.Current.Shutdown();
- }
- App.Current.Dispatcher.Invoke(() =>
- {
- _eventAggregator.GetEvent<WindowSwitch>().Page = Pages.RecipeStepNavi;
- _eventAggregator.GetEvent<WindowSwitch>().Publish();
- });
- }
- }
|