private static IRepository GetFtpRepo(ILoader loader, IPsnConfiguration psnConfig, int deviceNumber, string host, int port, string username, string password) { IRepository repo = null; Exception backException = null; var signal = new ManualResetEvent(false); Console.Write("Getting ftp repos async... "); loader.GetFtpRepositoryInfosAsync(host, port, username, password, (eventArgs, infos) => { try { Console.WriteLine("done!"); repo = loader.GetFtpRepository(infos.First(i => i.DeviceNumber == deviceNumber), "ftp loc " + deviceNumber, "1", psnConfig); Console.WriteLine("Repo taken async"); } catch (Exception ex) { backException = ex; } finally { signal.Set(); } }); signal.WaitOne(); if (backException != null) { throw backException; } return(repo); }
private static void LoadAllStoragedSignals(IRepository repo, IPsnConfiguration config) { var signal = new AutoResetEvent(false); repo.Open( args => { Log(args.Message); signal.Set(); }, args => { }); signal.WaitOne(); signal.Reset(); Log("Число локомотивов в репозитории = " + repo.Locomotives.Count); foreach (var locomotive in repo.Locomotives) { Log("Число секций у локомотива <<" + locomotive.Name + ">> = " + locomotive.Sections.Count); foreach (var section in locomotive.Sections) { Log("Число ПСН логов у секции " + section.Name + " = " + section.Psns.Count); foreach (var psnLog in section.Psns) { } } } signal.WaitOne(); }
public IRepository GetNandFlashRepository(string nandPath, IPsnConfiguration psnConfiguration) { var repo = new RepositoryMock(); repo.Locomotives.Add(LocomotiveGenerator.GenerateLocomotive("Локомотив NAND")); return(repo); }
public PsnConfigurationViewModel(IPsnConfiguration psnConfiguration, IColorsStorage colorsStorage) { Model = psnConfiguration; PsnMeterConfigs = new ObservableCollection <IPsnMeterConfigViewModel>(); Model.PsnMeterConfigs.ForEach(m => PsnMeterConfigs.Add(new PsnMeterConfigViewModel(m, colorsStorage))); }
public PsnLogMock(ISection owner, PsnLogType logType, IPsnConfiguration psnConfiguration) { Meters = new ObservableCollection <IPsnMeter>(); BeginTime = DateTime.Now - TimeSpan.FromDays(10); EndTime = BeginTime + TimeSpan.FromMinutes(10); SaveTime = DateTime.Now; LogType = logType; PsnConfiguration = psnConfiguration; }
public void Update(IPsnConfiguration psnConfig, string customName) { // TODO: improve threading // Предполагается, что метод вызывается из потока UI _psnConfiguration = psnConfig; _psnDataCustomConfigration.SetPsnConfigurationId(new IdentifierStringToLowerBased(_psnConfiguration.Id.ToString().ToLower())); _psnDataCustomConfigration.SetCustomLogName(customName); _bworker.AddToQueueAndWaitExecution(() => { _psnDataCustomConfigurationStorage.Update(_psnDataCustomConfigration.Id, new IdentifierStringToLowerBased(_psnConfiguration.Id.ToString().ToLower()), customName); _psnConfigurationLowLevel = _psnProtocolStorage.StoredItems.First(lowConfig => lowConfig.Id.IdentyString == _psnConfiguration.Id.ToString().ToLower()); }); RebuildMetersUnsafe(); }
public PsnLogRelay( IPsnDataInformation psnDataInformation, IPsnData psnData, IPsnConfiguration psnConfiguration, IPsnProtocolConfiguration psnConfigurationLowLevel, IPsnDataCustomConfigration psnDataCustomConfigration, IThreadNotifier uiNotifier, IWorker <Action> bworker, IStorage <IPsnProtocolConfiguration> psnProtocolStorage, IPsnDataCustomConfigurationsStorage psnDataCustomConfigurationStorage, IKeyValueStorageHolder repoStorageHolder) { _logIntegrity = PsnLogIntegrity.Unknown; _psnDataInformation = psnDataInformation; _psnData = psnData; _psnDataPaged = _psnData.PagesInformation; _psnConfiguration = psnConfiguration; _psnConfigurationLowLevel = psnConfigurationLowLevel; _psnDataCustomConfigration = new PsnDataCustomConfigurationSimple( psnDataCustomConfigration.Id, psnDataCustomConfigration.PsnConfigurationId, psnDataCustomConfigration.CustomLogName); _uiNotifier = uiNotifier; _bworker = bworker; _psnProtocolStorage = psnProtocolStorage; _psnDataCustomConfigurationStorage = psnDataCustomConfigurationStorage; _meters = new ObservableCollection <IPsnMeter>(); // TODO: i get logs for FTP logs also //_unicSignalIdStorage = new KeyValueStringStorageXmlMemCache(Path.Combine(Support.GetAppDataDirectoryPathAndCreateItIfNeeded(), Id.UnicString + ".Id.xml")); _unicSignalIdStorage = repoStorageHolder.GetStorage(Id.UnicString); //_unicSignalIdStorage = new KvStorageDbreezed(Id.UnicString); RebuildMetersUnsafe(); }
public IRepository GetFtpRepository(IFtpRepositoryInfo ftpRepositoryInfo, string locomotiveName, string sectionName, IPsnConfiguration psnConfiguration) { throw new NotImplementedException(); }
public IRepository GetFtpClientRepository(string ftpHost, int ftpPort, string ftpUsername, string ftpPassword, int deviceNumber, string locomotiveName, string sectionName, IPsnConfiguration psnConfiguration) { throw new NotImplementedException(); }
public IRepository GetFtpFilesRepository(string ftpFilesDirecotyPath, string locomotiveName, string sectionName, IPsnConfiguration psnConfiguration) { throw new NotImplementedException(); }
public void Update(IPsnConfiguration psnConfig, string customName) { throw new NotImplementedException(); }