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 DomaConnection(DomaClientFactory clientFactory, ImageDownloader imageDownloader, ConnectionSettings connectionSettings) { _clientFactory = clientFactory; _imageDownloader = imageDownloader; _connectionSettings = connectionSettings; Url = connectionSettings.Url; Username = connectionSettings.User; Password = connectionSettings.Password; Maps = new List<TransferMap>(); Categories = new List<Category>(); }
public void Save(ConnectionSettings connectionSettings) { var settings = Properties.Settings.Default; if (connectionSettings.Role == Role.Source) { settings.SourceUrl = connectionSettings.Url; settings.SourceUser = connectionSettings.User; settings.SourcePassword = connectionSettings.Password; } else { settings.TargetUrl = connectionSettings.Url; settings.TargetUser = connectionSettings.User; settings.TargetPassword = connectionSettings.Password; } settings.Save(); }
public ConnectionSettings Load(Role role) { var settings = Properties.Settings.Default; var connectionSettings = new ConnectionSettings(role); if (role == Role.Source) { connectionSettings.Url = settings.SourceUrl; connectionSettings.User = settings.SourceUser; connectionSettings.Password = settings.SourcePassword; } else { connectionSettings.Url = settings.TargetUrl; connectionSettings.User = settings.TargetUser; connectionSettings.Password = settings.TargetPassword; } return connectionSettings; }