//管理配置文件的类
        public SystemSettingViewModel(IUnityContainer container, IRegionManager regionManager)
        {
            this.container = container; this.regionManager = regionManager;
            //初始化时从配置文件中载入基本配置,并在点击保存按钮时把配置保存下来
            this.databaseAndSerialSettingsServices = new DatabaseAndSerialSettingsServices();
            this.bookInformationServerSettings = databaseAndSerialSettingsServices.loadBookInformationServerSettings();
            this.bookLocationServerSettings = databaseAndSerialSettingsServices.loadBookLocationServerSettings();
            this.serialSettings = databaseAndSerialSettingsServices.loadSerialSettings();
            //把配置信息放到容器中的相应对象中,因此这部分必须要比其他的viewModel和view首先被初始化
            //此后容器里的两个数据库服务,和一个RFID服务就有了配置信息
            IBookInformationService bookInformationSrv = this.container.Resolve<IBookInformationService>();
            bookInformationSrv.ServerIp = BookInformationServer.IP;
            bookInformationSrv.ServerUsername = BookInformationServer.Username;
            bookInformationSrv.ServerPassword = BookInformationServer.Password;
            IBookLocationService bookLocationSrv = container.Resolve<IBookLocationService>();
            bookLocationSrv.ServerIp = BookLocationServer.IP;
            bookLocationSrv.ServerUsername = BookLocationServer.Username;
            bookLocationSrv.ServerPassword = BookLocationServer.Password;
            ISerialService serialSrv = container.Resolve<ISerialService>();
            serialSrv.Serial = Serial.Serial;
            serialSrv.Speed = Serial.Speed;

            //把系统配置信息放置在RFID服务中
            IRFIDService rfidService = container.Resolve<IRFIDService>();
            rfidService.HardwareInterface = serialSrv.Serial;
            rfidService.HardwareInterfaceConnectionSpeed = serialSrv.Speed;

        }
Example #2
0
        //管理配置文件的类
        public SystemSettingViewModel(IUnityContainer container, IRegionManager regionManager)
        {
            this.container = container; this.regionManager = regionManager;
            //初始化时从配置文件中载入基本配置,并在点击保存按钮时把配置保存下来
            this.databaseAndSerialSettingsServices = new DatabaseAndSerialSettingsServices();
            this.bookInformationServerSettings     = databaseAndSerialSettingsServices.loadBookInformationServerSettings();
            this.bookLocationServerSettings        = databaseAndSerialSettingsServices.loadBookLocationServerSettings();
            this.serialSettings = databaseAndSerialSettingsServices.loadSerialSettings();
            //把配置信息放到容器中的相应对象中,因此这部分必须要比其他的viewModel和view首先被初始化
            //此后容器里的两个数据库服务,和一个RFID服务就有了配置信息
            IBookInformationService bookInformationSrv = this.container.Resolve <IBookInformationService>();

            bookInformationSrv.ServerIp       = BookInformationServer.IP;
            bookInformationSrv.ServerUsername = BookInformationServer.Username;
            bookInformationSrv.ServerPassword = BookInformationServer.Password;
            IBookLocationService bookLocationSrv = container.Resolve <IBookLocationService>();

            bookLocationSrv.ServerIp       = BookLocationServer.IP;
            bookLocationSrv.ServerUsername = BookLocationServer.Username;
            bookLocationSrv.ServerPassword = BookLocationServer.Password;
            ISerialService serialSrv = container.Resolve <ISerialService>();

            serialSrv.Serial = Serial.Serial;
            serialSrv.Speed  = Serial.Speed;

            //把系统配置信息放置在RFID服务中
            IRFIDService rfidService = container.Resolve <IRFIDService>();

            rfidService.HardwareInterface = serialSrv.Serial;
            rfidService.HardwareInterfaceConnectionSpeed = serialSrv.Speed;
        }
 public void saveSerialSettings(SerialSettings settings)
 {
     Properties.CustomSettings.Default.serialName = settings.Serial;
     Properties.CustomSettings.Default.serialSpeed = settings.Speed;
     Properties.CustomSettings.Default.Save();
 }
 public DatabaseAndSerialSettingsServices()
 {
     bookInformationServerSettings = new BookInformationServerSettings();
     bookLocationServerSettings = new BookLocationServerSettings();
     serialSettings = new SerialSettings();
 }