Exemplo n.º 1
0
        public override void Validate(MainViewModel entity)
        {
            if (string.IsNullOrWhiteSpace(entity.SelectedCollection))
            {
                AddRequired(Fields.Collections);
            }

            if (string.IsNullOrWhiteSpace(entity.SelectedProject))
            {
                AddRequired(Fields.Projects);
            }

            if (string.IsNullOrWhiteSpace(entity.SearchText))
            {
                AddRequired(Fields.WorkItemID);
            }

            int parsedValue;
            var parseSucceeded = Int32.TryParse(entity.SearchText, out parsedValue);

            if (parseSucceeded)
            {
                ActionContext.Add("ID", parsedValue);
            }
            else
            {
                var message = Resources.InvalidWorkItemIDText.FormatWith(entity.SearchText);
                Add(Fields.WorkItemID, message);
            }
        }
Exemplo n.º 2
0
        public override void ExecuteCompleted()
        {
            var message = Resources.SettingsSavedMessage;

            if (!ViewModel.UseLocalAccount)
            {
                message = string.Concat(message, Environment.NewLine, Environment.NewLine, Resources.PasswordWillNotBeSaved);
            }

            ActionContext.Add("SettingsSaved", message);
        }
Exemplo n.º 3
0
        public sealed override bool Execute()
        {
            var actionContextEntry = ActionContextEntry.Create("Cancelled", IsCancelled, false);

            ActionContext.Add(actionContextEntry);

            _entries = ActionContext.GetEntries();

            if (ActionContext.TryGetValue(ActionContextConstants.SessionDialogBox, out _unstackingSessionDialog) && _unstackingSessionDialog)
            {
                _dialogBoxResult = ActionContext.GetValue <string>(ActionContextConstants.DialogBoxResult);
            }

            return(base.Execute());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the current session in the action context.
        /// </summary>
        /// <param name="actionContext">The action context.</param>
        public void OnBeforeCloseSession(ActionContext actionContext)
        {
            //Check if already added by our event handler. If not, insert the current session.
            if (actionContext.ContainsKey(typeof(SessionView).FullName))
            {
                return;
            }

            if (CurrentSession == null)
            {
                return;
            }

            var entry = ActionContextEntry.Create(CurrentSession, false);

            actionContext.Add(entry);
        }
Exemplo n.º 5
0
        private void ValidateTFSUri(SettingsViewModel entity)
        {
            if (string.IsNullOrEmpty(entity.TFSUriString))
            {
                AddRequired(Fields.TFSURI);
                return;
            }

            if (Uri.TryCreate(entity.TFSUriString, UriKind.Absolute, out _TfsUri))
            {
                ActionContext.Add("TfsUri", _TfsUri);
            }
            else
            {
                var message = Resources.UriParseError.FormatWith(entity.TFSUriString);
                Add(Fields.TFSURI, message);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Called before navigation.
        /// </summary>
        /// <param name="context">The context.</param>
        public void OnBeforeNavigation(ActionContext context)
        {
            var current = ActionContextEntry.Create(ActionContextConstants.CurrentViewConstant, CurrentView, false);

            context.Add(current);
        }