private IGuidanceAction FindNodeBasedOnContentLink(IGuidanceExtension feature, string link)
        {
            IGuidanceAction focusedAction = feature.GuidanceWorkflow.Successors
                                            .Traverse <INode>(s => s.Successors)
                                            .OfType <IGuidanceAction>()
                                            .FirstOrDefault(a => (a.Link == null ? @"~~~" : a.Link.ToLower()) == link.ToLower());

            return(focusedAction);
        }
 internal GuidanceActionViewModel(IGuidanceExtension feature, IGuidanceAction model, ImageSource icon)
     : base(model, icon)
 {
     this.Node.HasStateOverrideChanged += (s, e) => this.OnPropertyChanged(() => this.HasStateOverride);
     this.RequiresUserAcceptance = model.Postconditions.OfType<UserAcceptanceBinding>().Any();
     this.Conditions = GetConditions(model);
     this.Model.StateChanged += (s, e) => this.RefreshDetails();
     this.feature = feature;
 }
Exemplo n.º 3
0
 internal GuidanceActionViewModel(IGuidanceExtension feature, IGuidanceAction model, ImageSource icon)
     : base(model, icon)
 {
     this.Node.HasStateOverrideChanged += (s, e) => this.OnPropertyChanged(() => this.HasStateOverride);
     this.RequiresUserAcceptance        = model.Postconditions.OfType <UserAcceptanceBinding>().Any();
     this.Conditions          = GetConditions(model);
     this.Model.StateChanged += (s, e) => this.RefreshDetails();
     this.feature             = feature;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Focuses the specified activity.
        /// </summary>
        /// <param name="action">The action to be focused.</param>
        public virtual void Focus(IGuidanceAction action)
        {
            Guard.NotNull(() => action, action);

            var previousFocusedAction = this.FocusedAction;

            focusedActionName = action.Name;

            if (previousFocusedAction != action)
            {
                this.OnFocusedActionChanged();
            }
        }
        private void Navigate(Uri uri)
        {
            if (uri == null)
            {
                return;
            }

            if (this.uriReferenceService.IsSchemeRegistered(uri))
            {
                // To avoid exceptions
                var launchPoint = this.TryResolveUri <object>(uri) as ILaunchPoint;
                if (launchPoint != null)
                {
                    if (launchPoint.CanExecute(featureExtension))
                    {
                        launchPoint.Execute(featureExtension);
                    }
                }
                else
                {
                    this.Link = this.TryResolveUri <Uri>(uri);
                    if (this.Link == null)
                    {
                        GuidanceContent content      = this.TryResolveUri <GuidanceContent>(uri);
                        IGuidanceAction matchingNode = null;
                        matchingNode = FindNodeBasedOnContentLink(featureExtension, uri.ToString());
                        if (matchingNode != null)
                        {
                            featureExtension.GuidanceWorkflow.Focus(matchingNode);
                            GuidanceWorkflowViewModel.Current.GoToFocusedAction();
                        }
                        else
                        if (content != null)
                        {
                            this.Link = new Uri(content.Path);
                        }
                    }
                }
            }
            else
            {
                this.Link = uri;
            }
        }
Exemplo n.º 6
0
        private static IEnumerable <LabelViewModel> GetConditions(IGuidanceAction model)
        {
            yield return(new LabelViewModel(Resources.GuidanceActionViewModel_PreConditionsLabel, model.Preconditions));

            yield return(new LabelViewModel(Resources.GuidanceActionViewModel_PostConditionsLabel, model.Postconditions));
        }
 private static IEnumerable<LabelViewModel> GetConditions(IGuidanceAction model)
 {
     yield return new LabelViewModel(Resources.GuidanceActionViewModel_PreConditionsLabel, model.Preconditions);
     yield return new LabelViewModel(Resources.GuidanceActionViewModel_PostConditionsLabel, model.Postconditions);
 }
Exemplo n.º 8
0
 public UserAcceptanceCondition(IGuidanceAction action)
 {
     this.action = action;
 }
Exemplo n.º 9
0
 public UserAcceptanceBinding(IGuidanceAction action)
 {
     this.UserMessage = Resources.UserAcceptanceBinding_UserMessage;
     this.Value       = new UserAcceptanceCondition(action);
     this.ComponentId = Guid.NewGuid().ToString();
 }
Exemplo n.º 10
0
        /// <summary>
        /// Focuses the specified activity.
        /// </summary>
        /// <param name="action">The action to be focused.</param>
        public virtual void Focus(IGuidanceAction action)
        {
            Guard.NotNull(() => action, action);

            var previousFocusedAction = this.FocusedAction;
            focusedActionName = action.Name;

            if (previousFocusedAction != action)
                this.OnFocusedActionChanged();
        }