/// <summary> /// /// </summary> private void Login() { LoginViewModel login = new LoginViewModel(); if (login.ShowDialog().Value) { ListDatabaseViewModel ldm = new ListDatabaseViewModel(); if (ldm.ShowDialog().Value) { this.TagGroup.Clear(); mDatabase = ldm.SelectDatabase.Name; var dbitem = new DatabaseViewModel() { Name = mDatabase, IsSelected = true, IsExpanded = true }; this.TagGroup.Add(dbitem); dbitem.Children.Add(mRootTagGroupModel); mRootTagGroupModel.Database = mDatabase; dbitem.Children.Add(securityModel); securityModel.Database = mDatabase; securityModel.Init(); Task.Run(() => { TagViewModel.Drivers = DevelopServiceHelper.Helper.GetRegistorDrivers(mDatabase); QueryGroups(); }); } } }
/// <summary> /// /// </summary> private void SwitchDatabase() { ListDatabaseViewModel ldm = new ListDatabaseViewModel(); if (ldm.ShowDialog().Value) { if (Database != ldm.SelectDatabase.Name) { if (ContentViewModel is IModeSwitch) { (ContentViewModel as IModeSwitch).DeActive(); } Database = ldm.SelectDatabase.Name; OnPropertyChanged("MainwindowTitle"); foreach (var vv in this.TagGroup) { vv.Dispose(); } this.TagGroup.Clear(); var dbitem = new DatabaseViewModel() { Name = mDatabase, IsSelected = true, IsExpanded = true }; this.TagGroup.Add(dbitem); var sec = new ServerSecurityTreeViewModel(); sec.Children.Add(new ServerUserEditorTreeViewModel() { Name = UserName }); if (DevelopServiceHelper.Helper.IsAdmin()) { sec.Children.Add(new ServerUserManagerTreeViewModel()); } this.TagGroup.Add(sec); dbitem.Children.Add(mRootTagGroupModel); mRootTagGroupModel.Database = mDatabase; dbitem.Children.Add(securityModel); securityModel.Database = mDatabase; securityModel.Init(); dbitem.Children.Add(new DatabaseSettingViewModel() { Database = this.Database }); Task.Run(() => { TagViewModel.Drivers = DevelopServiceHelper.Helper.GetRegistorDrivers(mDatabase); QueryGroups(); }); IsDatabaseRunning = DevelopServiceHelper.Helper.IsDatabaseRunning(mDatabase); } } }
private void NewDatabase() { NewDatabaseViewModel ndm = new NewDatabaseViewModel(); var vdd = DevelopServiceHelper.Helper.ListDatabase(); if (vdd.Count > 0) { ndm.ExistDatabase = vdd.Keys.ToList(); } if (ndm.ShowDialog().Value) { Database = ndm.Name; OnPropertyChanged("MainwindowTitle"); OnPropertyChanged("UserName"); IsLogin = true; foreach (var vv in TagGroup) { vv.Dispose(); } this.TagGroup.Clear(); var dbitem = new DatabaseViewModel() { Name = mDatabase, IsSelected = true, IsExpanded = true }; this.TagGroup.Add(dbitem); var sec = new ServerSecurityTreeViewModel(); sec.Children.Add(new ServerUserEditorTreeViewModel()); if (DevelopServiceHelper.Helper.IsAdmin()) { sec.Children.Add(new ServerUserManagerTreeViewModel()); } this.TagGroup.Add(sec); dbitem.Children.Add(mRootTagGroupModel); mRootTagGroupModel.Database = mDatabase; dbitem.Children.Add(securityModel); securityModel.Database = mDatabase; securityModel.Init(); dbitem.Children.Add(new DatabaseSettingViewModel() { Database = this.Database }); Task.Run(() => { TagViewModel.Drivers = DevelopServiceHelper.Helper.GetRegistorDrivers(mDatabase); QueryGroups(); }); } }
/// <summary> /// /// </summary> private void Login() { LoginViewModel login = new LoginViewModel(); if (login.ShowDialog().Value) { ListDatabaseViewModel ldm = new ListDatabaseViewModel(); if (ldm.ShowDialog().Value) { this.TagGroup.Clear(); CurrentUserManager.Manager.UserName = login.UserName; Database = ldm.SelectDatabase.Name; OnPropertyChanged("MainwindowTitle"); OnPropertyChanged("UserName"); IsLogin = true; var dbitem = new DatabaseViewModel() { Name = mDatabase, IsSelected = true, IsExpanded = true }; this.TagGroup.Add(dbitem); var sec = new ServerSecurityTreeViewModel(); sec.Children.Add(new ServerUserEditorTreeViewModel()); if (DevelopServiceHelper.Helper.IsAdmin()) { sec.Children.Add(new ServerUserManagerTreeViewModel()); } this.TagGroup.Add(sec); dbitem.Children.Add(mRootTagGroupModel); mRootTagGroupModel.Database = mDatabase; dbitem.Children.Add(securityModel); securityModel.Database = mDatabase; securityModel.Init(); dbitem.Children.Add(new DatabaseSettingViewModel() { Database = this.Database }); Task.Run(() => { TagViewModel.Drivers = DevelopServiceHelper.Helper.GetRegistorDrivers(mDatabase); QueryGroups(); }); StartCheckDatabaseRunning(); } } }