public void Initialize() { unity.RegisterType <IMetadataService, MetadataService>(); mainMenuController = unity.Resolve <MetadataMainMenuController>(); MetadataPersistentContext context = (MetadataPersistentContext)MetadataPersistentContext.Current; if (context.CheckDatabaseConnection() && context.CheckTables()) { regions.RegisterViewWithRegion(RegionNames.TopRegion, () => this.unity.Resolve <MetadataMainMenu>()); regions.RegisterViewWithRegion(RegionNames.LeftRegion, () => this.unity.Resolve <MetadataTreeView>()); } else { regions.RegisterViewWithRegion(RegionNames.RightRegion, () => this.unity.Resolve <SetupWizardView>()); } }
public void SetupDatabase(string password) { SaveConnectionStringSettings(password); dataContext.RefreshConnectionString(); if (!dataContext.CheckServerConnection()) { Z.Notify(new Notification() { Title = CONST_ViewModelDialogsTitle, Content = "Error connecting server. Try again, please." }); return; } if (dataContext.CheckDatabaseConnection() && dataContext.CheckTables()) { GoToStartupView(); return; } try { dataContext.SetupDatabase(); SetDefaultDatabaseName(password); dataContext.RefreshConnectionString(); dataContext.CreateMetaModel(); Z.Notify(new Notification() { Title = CONST_ViewModelDialogsTitle, Content = "1C# database has been setup successfully =)" }); GoToStartupView(); } catch (Exception ex) { Z.Notify(new Notification() { Title = CONST_ViewModelDialogsTitle, Content = Z.GetErrorText(ex) }); } }