Ejemplo n.º 1
0
        private WindowItem <Model.Policy> CreateNewWindow(Model.Policy policy)
        {
            var bootStrapper = new PolicyShellBootStrapper(compositionContainer, policy);

            bootStrapper.Run();
            RegisterPolicyContextState(policy);
            var windowItem = this.windowService.CreateWindow(policy, bootStrapper.Shell);

            GetMainRegion().Add(windowItem.CurrentView);
            return(windowItem);
        }
Ejemplo n.º 2
0
 public PolicyShellBootStrapper(CompositionContainer parentContainer, Model.Policy policy)
 {
     if (parentContainer == null)
     {
         throw new ArgumentNullException("parentContainer");
     }
     if (policy == null)
     {
         throw new ArgumentNullException("policy");
     }
     this.ParentContainer = parentContainer;
     this.Policy          = policy;
 }
Ejemplo n.º 3
0
        public void OpenPolicyWindow(Model.Policy policy)
        {
            IRegion mainRegion = GetMainRegion();

            if (mainRegion == null)
            {
                return;
            }

            WindowItem <Model.Policy> windowItem;

            if (!this.windowService.ContainsWindow(policy))
            {
                if (stateService.ExistsContextState(policy.PolicyId.ToString()))
                {
                    var confirmMessage = string.Format("We have found saved work for Policy: {0}, would you like to continue with this work?", policy.PolicyId);

                    messageBoxService.ShowConfirm(
                        confirmMessage,
                        () =>
                    {
                        windowItem = CreateNewWindow(policy);
                        OpenWindow(windowItem);
                    },
                        () =>
                    {
                        stateService.RemoveContextState(policy.PolicyId.ToString());
                        windowItem = CreateNewWindow(policy);
                        OpenWindow(windowItem);
                    });
                }
                else
                {
                    windowItem = CreateNewWindow(policy);
                    OpenWindow(windowItem);
                }
            }
            else
            {
                windowItem = this.windowService.GetWindow(policy);
                OpenWindow(windowItem);
            }
        }
Ejemplo n.º 4
0
 public void OpenPolicy(Policy.Contracts.Models.Policy policy)
 {
     this.eventAggregator.GetEvent <PolicySearchSelectedEvent>().Publish(policy);
 }
Ejemplo n.º 5
0
 public void OpenPolicyWindow(Policy.Contracts.Models.Policy policy)
 {
     this.policyWindowService.OpenPolicyWindow(policy);
 }
Ejemplo n.º 6
0
        public void CloseWindow(Model.Policy policy)
        {
            var policyWindowItem = this.windowService.GetWindow(policy);

            CloseWindow(policyWindowItem);
        }
Ejemplo n.º 7
0
 private void RegisterPolicyContextState(Model.Policy policy)
 {
     this.stateService.RegisterContextState(policy.PolicyId.ToString(), "Policy:" + policy.PolicyId, null);
 }