Esempio n. 1
0
        void HandleNewButtonClicked(object sender, EventArgs e)
        {
            HashSet <PolicySet> esets = new HashSet <PolicySet> (PolicyService.GetPolicySets());

            esets.ExceptWith(PolicyService.GetUserPolicySets());
            esets.UnionWith(sets);
            esets.RemoveWhere(p => !p.Visible);

            NewPolicySetDialog dlg = new NewPolicySetDialog(new List <PolicySet> (esets));

            try {
                if (MessageService.RunCustomDialog(dlg, this) == (int)ResponseType.Ok)
                {
                    PolicySet pset = new PolicySet();
                    pset.CopyFrom(dlg.SourceSet);
                    pset.Name = GetUnusedName(dlg.PolicyName);
                    sets.Add(pset);
                    FillPolicySets();
                    policiesCombo.Active = sets.IndexOf(pset);
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
		void HandleNewButtonClicked (object sender, EventArgs e)
		{
			HashSet<PolicySet> esets = new HashSet<PolicySet> (PolicyService.GetPolicySets ());
			esets.ExceptWith (PolicyService.GetUserPolicySets ());
			esets.UnionWith (sets);
			esets.RemoveWhere (p => !p.Visible);
			
			NewPolicySetDialog dlg = new NewPolicySetDialog (new List<PolicySet> (esets));
			try {
				if (MessageService.RunCustomDialog (dlg, this) == (int) ResponseType.Ok) {
					PolicySet pset = new PolicySet ();
					pset.CopyFrom (dlg.SourceSet);
					pset.Name = GetUnusedName (dlg.PolicyName);
					sets.Add (pset);
					FillPolicySets ();
					policiesCombo.Active = sets.IndexOf (pset);
				}
			} finally {
				dlg.Destroy ();
			}
		}