Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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>();
        }