コード例 #1
0
ファイル: Bootstrapper.cs プロジェクト: runerys/DomaMove
        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);
        }
コード例 #2
0
ファイル: MoveViewModel.cs プロジェクト: runerys/DomaMove
        public MoveViewModel(DomaConnection source, DomaConnection target, ITracker tracker)
        {
            _tracker = tracker;

            Source = source;
            Target = target;
        }
コード例 #3
0
ファイル: Steps.cs プロジェクト: runerys/DomaMove
        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);
        }
コード例 #4
0
ファイル: DomaConnection.cs プロジェクト: runerys/DomaMove
        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();
            }
        }