Ejemplo n.º 1
0
        /// <summary>
        /// Загрузка исходный данных
        /// </summary>
        /// <param name="devices"></param>
        public void LoadSource(List <Device> devices)
        {
            Devices = devices;
            AppSettings settings = AppSettings.GetSettings();
            JsonFileProvider <DeviceTypeInfos> typeInfosService = new JsonFileProvider <DeviceTypeInfos>();

            TypeInfos = typeInfosService.Load(settings.DefaultTypeInfosFilePath).TypeInfos;
            JsonFileProvider <Dictionary <string, int> > typeOffsetService = new JsonFileProvider <Dictionary <string, int> >();

            TypeOffset = typeOffsetService.Load(settings.DefaultTypeOffsetFilePath);
        }
Ejemplo n.º 2
0
        public MainWindowViewModel()
        {
            OpenDeviceFileCmd     = new DelegateCommand(OpenDeviceFile, CanOpenDeviceFile);
            SaveDeviceFileCmd     = new DelegateCommand(SaveDeviceFile, CanSaveDeviceFile);
            GenModBusTableCmd     = new DelegateCommand(GenModBusTable, CanGenModBusTable);
            OpenSettingsWindowCmd = new DelegateCommand(OpenSettingsWindow, CanOpenSettingsWindow);
            CloseWindowCommand    = new DelegateCommand(CloseWindow, CanCloseWindow);

            SelectedDevice = new Device();

            //считывание текущих настроек из файла
            if (File.Exists(Properties.Settings.Default.AppSettingsFileName))
            {
                JsonFileProvider <AppSettings> settingsService = new JsonFileProvider <AppSettings>();
                AppSettings.SetSettings(settingsService.Load(Properties.Settings.Default.AppSettingsFileName));
            }
        }