コード例 #1
0
        private async Task OnConnectAsync()
        {
            IsConnecting = true;

            try
            {
                Application.Current.Dispatcher.Invoke(() => { BuildDefinitions.Clear(); });

                var buildDefinitions = await BuildProvider.GetBuildDefinitionsAsync(MonitorSettings).ConfigureAwait(false);

                if (buildDefinitions.IsSuccessStatusCode)
                {
                    Application.Current.Dispatcher.Invoke(() => { ApplyBuildDefinitions(buildDefinitions.Data); });
                    StatusText = String.Empty;
                    ShowPersonalAccessTokenInput = false;
                }
                else
                {
                    AccessTokenInputWhenUnauthorized(buildDefinitions.StatusCode);
                }
            }
            catch (AdvancedHttpRequestException ex)
            {
                AccessTokenInputWhenUnauthorized(ex.StatusCode);
            }
            catch (Exception ex)
            {
                StatusText = ex.Message;
            }

            IsConnecting = false;
        }
コード例 #2
0
        private void PopulateBackgroundWorkerOnDoWork(object sender, DoWorkEventArgs doWorkEventArgs)
        {
            this.Logger().Trace("Begin Populate");


            Application.Current.Dispatcher.Invoke(() =>
            {
                IsPopulating = true;
                BuildDefinitions.Clear();
            }, DispatcherPriority.Normal);

            IBuildDefinition[] buildDefinitions;
            if (teamPilgrimServiceModelProvider.TryGetBuildDefinitionsByProjectName(out buildDefinitions, _collection, _project.Name))
            {
                foreach (var buildDefinitionModel in buildDefinitions.Select(definition => new BuildDefinitionModel(this, definition)))
                {
                    var localScopeModel = buildDefinitionModel;
                    Application.Current.Dispatcher.Invoke(() => BuildDefinitions.Add(localScopeModel));
                }
            }

            Application.Current.Dispatcher.Invoke(() => IsPopulating = false, DispatcherPriority.Normal);

            this.Logger().Trace("End Populate");
        }
コード例 #3
0
        public override void Save()
        {
            if (IsInEditMode)
            {
                base.Save();

                MonitorSettings.SelectedBuildDefinitions.Clear();
                var selected = BuildDefinitions.Where(a => a.IsSelected && !a.IsDeleted);
                foreach (var viewModel in selected)
                {
                    MonitorSettings.SelectedBuildDefinitions.Add(viewModel.BuildDefinition);
                }

                IsInEditMode = false;

                UpdateSelectedCollection();
                BuildDefinitions.Clear();
            }
        }