Ejemplo n.º 1
0
 public CremaAppHostViewModel(ICremaHost cremaHost, IAppConfiguration configs, ICompositionService compositionService)
 {
     this.cremaHost          = cremaHost;
     this.cremaHost.Opened  += CremaHost_Opened;
     this.configs            = configs;
     this.compositionService = compositionService;
     this.theme           = Themes.Keys.FirstOrDefault();
     this.themeColor      = FirstFloor.ModernUI.Presentation.AppearanceManager.Current.AccentColor;
     this.loginCommand    = new DelegateCommand((p) => this.Login(), (p) => this.CanLogin);
     this.connectionItems = ConnectionItemCollection.Read(AppUtility.GetDocumentFilename("ConnectionList.xml"));
     this.compositionService.SatisfyImportsOnce(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;
         }
     };
 }