예제 #1
0
 public Context(MDIChildForm parent, IPolicyStore policyStore)
 {
     m_parent = parent;
     m_policyStore = policyStore;
     //TODO: this will be refactored when IPolicy layer is removed
     m_policySet = m_policyStore.Reader.PolicySets[0];
 }
예제 #2
0
    protected virtual void NewDoc()
    {
        MDIChildForm child = new MDIChildForm();

        child.MdiParent = this;
        child.Show();
    }
예제 #3
0
        public void TestDeleteLocalUnsavedPolicySet()
        {
            // Create some policies and a policy set
            IPolicySet policySet = Workshare.Policy.PolicySuite.Instance().NewPolicySet();
           
            TreeView treeView = new TreeView();       
            MDIChildForm childForm = new MDIChildForm(Guid.NewGuid(), policySet, treeView, null);

            IPolicy policy1 = PolicyFactory.CreatePolicy("TestPolicy1", policySet, PolicyStatus.Active, "None");
            IPolicy policy2 = PolicyFactory.CreatePolicy("TestPolicy2", policySet, PolicyStatus.Active, "None");
            IPolicy policy3 = PolicyFactory.CreatePolicy("TestPolicy3", policySet, PolicyStatus.Active, "None");
            policySet.Policies.Add(policy1);
            policySet.Policies.Add(policy2);
            policySet.Policies.Add(policy3);

            // Make sure policies exist
            Assert.AreEqual(3, policySet.Policies.Count, "Unexpected number of policies in policy set");

            // Don't bother commiting the policy set to disk (for a local policy set)
            // Try to delete the policy set
            MDIParentForm parentForm = (MDIParentForm)m_parentForm.MockInstance;
            MDIParentMenuHelper.GetInstance().ParentForm = parentForm;

            // Should work OK (no exceptions thrown)
            MDIParentMenuHelper.GetInstance().DeleteChild(childForm);
        }
예제 #4
0
        public UIStateMachine(IPolicySet policyset, MDIChildForm childform)
        {
            PolicyLanguageCache.Instance.ActiveLanguageId = policyset.MasterCatalogue.LanguageId;
            m_policySet = policyset;
            m_ChildForm = childform;

            m_InitState.PolicySet = m_policySet;
            m_InitState.SetParent(childform);
            
            AddState(m_CloseState);
            AddState(m_InitState);
            AddState(m_ShowConditionsState);
            AddState(m_ShowPoliciesState);
            AddState(m_AddPolicyState);
            AddState(m_CopyPolicyState);
            AddState(m_ShowPolicyState);
            AddState(m_ShowActionsState);
            AddState(m_deletePolicyState);
            AddState(m_DeleteAllPoliciesState);
            AddState(m_deletePolicySetState);
            AddState(m_EditConditionState);
            AddState(m_NewConditionState);
            AddState(m_addAddressCollectionState);
            AddState(m_editRoutingDetailState);
            AddState(m_deleteAddressCollectionState);
            AddState(m_savePolicySetState);
            AddState(m_addActionState);
            AddState(m_addActionConditionGroupState);
            AddState(m_editCustomActionGroupState);
            AddState(m_editActionState);
            AddState(m_deleteActionState);
            AddState(m_activatePolicyState);
            AddState(m_exportState);
            AddState(m_importState);
            AddState(m_deleteConditionState);
            AddState(m_changeRoutingTypeState);
        }
예제 #5
0
 public void SetParent(MDIChildForm parent)
 {
     m_parent = parent;
 }
예제 #6
0
        public void TestDeleteLocalSavedPolicySet()
        {
            // Create a policy set and commit it to disk
            string servername = "localhost";
            string oldpolicyname = TEST_FILE_PATH + "New Policy Set.policy";
            string newpolicyname = TEST_FILE_PATH + "Copy of New Policy Set.policy";

            System.IO.File.Copy(oldpolicyname, newpolicyname);

            Workshare.Policy.PolicySetItem policySetItem = Workshare.Policy.PolicySuite.Instance().LoadPolicySet(servername, newpolicyname);
            IPolicySet policySet = policySetItem.Data;

            TreeView treeView = new TreeView();
            MDIChildForm childForm = new MDIChildForm(Guid.NewGuid(), policySet, treeView, null);

            // Make sure policies exist i.e. the file was read and loaded OK
            // There are 3 policies in the test policy file
            Assert.AreEqual(3, policySet.Policies.Count, "Unexpected number of policies in policy set");

            // Try to delete the policy set
            MDIParentForm parentForm = (MDIParentForm)m_parentForm.MockInstance;
            MDIParentMenuHelper.GetInstance().ParentForm = parentForm;

            // Should work OK (no exceptions thrown)
            MDIParentMenuHelper.GetInstance().DeleteChild(childForm);

            // The local policy file should no longer exist...
            System.IO.FileInfo fi = new System.IO.FileInfo(newpolicyname);
            Assert.IsFalse(fi.Exists);
        }