예제 #1
0
        public void RestoreState(CremaSettings settings)
        {
            if (settings.NoCache == false)
            {
                var stateCaches = this.ReadStateCaches();
                foreach (var item in this)
                {
                    if (stateCaches.ContainsKey($"{item.ID}") == true)
                    {
                        if (stateCaches[$"{item.ID}"] == DataBaseState.IsLoaded)
                        {
                            item.Load(Authentication.System);
                        }
                    }
                }
            }

            foreach (var item in settings.DataBaseList)
            {
                if (this.ContainsKey(item) == true)
                {
                    var dataBase = this[item];
                    if (dataBase.IsLoaded == false)
                    {
                        dataBase.Load(Authentication.System);
                    }
                }
                else
                {
                    CremaLog.Error(new DataBaseNotFoundException(item));
                }
            }
        }
예제 #2
0
 public CremaAppHostViewModel(ICremaHost cremaHost, IAppConfiguration configs, IBuildUp buildUp, CremaSettings settings,
                              Lazy <DataBaseServiceViewModel> dataBaseService, Lazy <DataBaseListViewModel> dataBaseSelections, Lazy <IShell> shell)
 {
     this.cremaHost          = cremaHost;
     this.cremaHost.Opened  += CremaHost_Opened;
     this.configs            = configs;
     this.buildUp            = buildUp;
     this.settings           = settings;
     this.dataBaseService    = dataBaseService;
     this.dataBaseSelections = dataBaseSelections;
     this.shell           = shell;
     this.theme           = Themes.Keys.FirstOrDefault();
     this.themeColor      = FirstFloor.ModernUI.Presentation.AppearanceManager.Current.AccentColor;
     this.ConnectionItems = ConnectionItemCollection.Read(this, AppUtility.GetDocumentFilename("ConnectionList.xml"));
     this.buildUp.BuildUp(this.ConnectionItems);
     this.ConnectionItem = this.ConnectionItems.FirstOrDefault(item => item.IsDefault);
     this.authenticator  = this.cremaHost.GetService(typeof(Authenticator)) as Authenticator;
     this.configs.Update(this);
     this.PropertyChanged += (s, e) =>
     {
         if (e.PropertyName == nameof(this.IsProgressing))
         {
             this.Shell.IsProgressing = this.IsProgressing;
         }
         else if (e.PropertyName == nameof(this.ProgressMessage))
         {
             this.Shell.ProgressMessage = this.ProgressMessage;
         }
     };
 }
예제 #3
0
 public DataBaseRepositoryHost(DataBase dataBase, IRepository repository)
     : base(repository, dataBase.CremaHost.RepositoryDispatcher, dataBase.BasePath)
 {
     this.dataBase = dataBase;
     this.settings = this.dataBase.GetService(typeof(CremaSettings)) as CremaSettings;
     this.Dispatcher.Invoke(this.InitializeBranchInfo);
 }
예제 #4
0
 public DataBaseRepositoryHost(DataBase dataBase, IRepository repository, DataBaseSerializationInfo dataBaseInfo)
     : base(repository, dataBase.CremaHost.RepositoryDispatcher, dataBase.BasePath)
 {
     this.dataBase             = dataBase;
     this.settings             = this.dataBase.GetService(typeof(CremaSettings)) as CremaSettings;
     this.branchRevision       = dataBaseInfo.BranchRevision;
     this.branchSource         = dataBaseInfo.BranchSource;
     this.branchSourceRevision = dataBaseInfo.BranchSourceRevision;
 }
예제 #5
0
 public ShellViewModel(CremaService service, CremaSettings settings, IAppConfiguration configs, AppSettings appSettings)
 {
     this.service     = service;
     this.settings    = settings;
     this.configs     = configs;
     this.DisplayName = "Crema Server";
     this.Dispatcher.InvokeAsync(() =>
     {
         this.configs.Update(this);
         this.Initialize(appSettings);
     });
 }