Exemplo n.º 1
0
        public AppConfigViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;

            SaveConfigCommand = new DelegateCommand(Execute, CanExecute)
                                .ObservesProperty(() => BaseUri)
                                .ObservesProperty(() => ClientSecret);

            _eventAggregator.GetEvent <GetConfigSettingsCommand>().Subscribe(AppConfigUpdated);
            _eventAggregator.GetEvent <SaveAppConfigCommand>().Subscribe(AppConfigUpdated);
            _eventAggregator.GetEvent <GetConfigSettingsCommand>().Publish(AppConfigEdit.GetConfigSettings());
            _eventAggregator.GetEvent <UpdateFromConfigCommand>().Publish(ClientSecret);

            Title = "Config";
        }
Exemplo n.º 2
0
        //private void AppConfigUpdated(AppConfigInfo obj) => ConfigInfo = obj;
        private void AppConfigUpdated(AppConfigEdit obj)
        {
            ConfigEdit = obj;

            DalManagers = new ObservableCollection <string>();
            foreach (DalManagers item in Enum.GetValues(typeof(DalManagers)))
            {
                DalManagers.Add(EnumUtilities.GetEnumDescription(item));
            }

            SqlServerInstances = new ObservableCollection <string>();
            foreach (SQLServerInstances item in Enum.GetValues(typeof(SQLServerInstances)))
            {
                SqlServerInstances.Add(EnumUtilities.GetEnumDescription(item));
            }

            if (ConfigEdit.DalManagerType == EnumUtilities.GetEnumDescription(DalManagerConnectionStrings.DalSql))
            {
                DalManagerInUse = (int)Enums.DalManagers.SQLServer;
            }
            else if (ConfigEdit.DalManagerType == EnumUtilities.GetEnumDescription(DalManagerConnectionStrings.DalFile))
            {
                DalManagerInUse = (int)Enums.DalManagers.File;
            }

            BaseUri      = ConfigEdit.BaseUri;
            ClientSecret = ConfigEdit.ClientSecret;

            if (ConfigEdit.DbInUse == EnumUtilities.GetEnumDescription(SQLServerInstances.Local))
            {
                DbInUse = (int)SQLServerInstances.Local;
            }
            else
            {
                DbInUse = (int)SQLServerInstances.Server;
            }
        }
Exemplo n.º 3
0
 public AppConfigEdit SaveConfig(AppConfigEdit data)
 {
     data = data.Save();
     return(data);
 }