예제 #1
0
        public async Task TitleIsSetProperly()
        {
            var mockChannel = new MockChannel(1, "1.0");

            mockChannel.SetArtifactUrl("artifact_url");
            await _sut.StartAsync(mockChannel, "dest_path");

            Assert.AreEqual("Downloading Magpie.Tests Updates...", _sut.Title);
        }
예제 #2
0
파일: Magpie.cs 프로젝트: randianb/Magpie
        protected virtual async Task ShowDownloadWindow(Channel channel)
        {
            var viewModel    = new DownloadWindowViewModel(AppInfo, _logger, RemoteContentDownloader);
            var artifactPath = CreateTempPath(channel.ArtifactUrl);
            var window       = new DownloadWindow {
                DataContext = viewModel
            };

            bool[] finishedDownloading = { false };
            viewModel.ContinueWithInstallationCommand = new DelegateCommand(e =>
            {
                _logger.Log("Continue after downloading artifact");
                _analyticsLogger.LogContinueWithInstallation();
                OnArtifactDownloadedEvent(new SingleEventArgs <string>(artifactPath));
                window.Close();
                if (ShouldOpenArtifact(channel, artifactPath))
                {
                    OpenArtifact(artifactPath);
                    _logger.Log("Opened artifact");
                }
            }, o => finishedDownloading[0]);

            SetOwner(window);
            OnWindowWillBeDisplayed(window, channel);
            window.Show();

            var savedAt = await viewModel.StartAsync(channel, artifactPath).ConfigureAwait(true);

            finishedDownloading[0] = true;
            ((DelegateCommand)viewModel.ContinueWithInstallationCommand).RaiseCanExecuteChanged();

            if (string.IsNullOrWhiteSpace(savedAt))
            {
                window.Close();
                ShowErrorWindow();
            }
        }
예제 #3
0
        protected virtual void ShowDownloadWindow(RemoteAppcast appcast)
        {
            var viewModel    = new DownloadWindowViewModel(_appInfo, _logger, RemoteContentDownloader);
            var artifactPath = CreateTempPath(appcast.ArtifactUrl);
            var window       = new DownloadWindow {
                DataContext = viewModel
            };

            viewModel.ContinueWithInstallationCommand = new DelegateCommand(e =>
            {
                _logger.Log("Continue after downloading artifact");
                _analyticsLogger.LogContinueWithInstallation();
                OnArtifactDownloadedEvent(new SingleEventArgs <string>(artifactPath));
                window.Close();
                if (ShouldOpenArtifact(appcast, artifactPath))
                {
                    OpenArtifact(artifactPath);
                    _logger.Log("Opened artifact");
                }
            });
            SetOwner(window);
            viewModel.StartAsync(appcast, artifactPath);
            window.ShowDialog();
        }