Exemple #1
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);
            }
        }