protected override void OnStartup(object sender, StartupEventArgs e) { base.OnStartup(sender, e); _settingsStorage = new ConnectionSettingsStorage(); _sourceSettings = _settingsStorage.Load(Role.Source); _targetSettings = _settingsStorage.Load(Role.Target); var domaClientFactory = new DomaClientFactory(); var imageDownloader = new ImageDownloader(); var source = new DomaConnection(domaClientFactory, imageDownloader, _sourceSettings); var target = new DomaConnection(domaClientFactory, imageDownloader, _targetSettings); _tracker = new Tracker(); if (ConfigurationManager.AppSettings.AllKeys.Any(x => x == "skiptracking") && ConfigurationManager.AppSettings["skiptracking"] == "true") _tracker = new NullTracker(); if (ConfigurationManager.AppSettings.AllKeys.Any(x => x == "messageboxerrors") && ConfigurationManager.AppSettings["messageboxerrors"] == "true") _messageboxOnError = true; var transferViewModel = new MoveViewModel(source, target, _tracker); var windowManager = (WindowManager)GetInstance(typeof(WindowManager), null); windowManager.ShowWindow(transferViewModel); }
public MoveViewModel(DomaConnection source, DomaConnection target, ITracker tracker) { _tracker = tracker; Source = source; Target = target; }
public void GivenABlankInputField() { _clientFactory = A.Fake<DomaClientFactory>(); A.CallTo(() => _clientFactory.Create(null)).Returns(A.Fake<DOMAServicePortType>()); var imageDownloader = A.Fake<ImageDownloader>(); _connection = new DomaConnection(_clientFactory, imageDownloader, _connectionSettings); }
public void TagAllExistingMapsAndSetTargetCategories(DomaConnection source) { if (source.Status != "OK") return; foreach (TransferMap sourceMap in source.Maps) { sourceMap.ExistsOnTarget = ( Maps.Any( x => x.MapInfo.Date == sourceMap.MapInfo.Date && string.Compare(x.MapInfo.Name, sourceMap.MapInfo.Name, StringComparison.InvariantCultureIgnoreCase) == 0)); // Match Category by name. If missing - take first by ID Category foundCategory = Categories.FirstOrDefault( x => string.Compare(x.Name, sourceMap.Category.Name, StringComparison.OrdinalIgnoreCase) == 0); sourceMap.TargetCategory = foundCategory ?? Categories.OrderBy(x => x.ID).First(); } }