Пример #1
0
        void AddEntry()
        {
            var newRule = new NameConventionRule();

            newRule.Name = "New Rule";
            var diag   = new NameConventionEditRuleDialog(newRule);
            var result = MessageService.ShowCustomDialog(diag);

            if (result == (int)ResponseType.Ok)
            {
                treeStore.AppendValues(newRule);
            }
            OnPolicyChanged(EventArgs.Empty);
        }
Пример #2
0
        public NameConventionEditRuleDialog(NameConventionRule rule)
        {
            if (rule == null)
            {
                throw new System.ArgumentNullException("rule");
            }
            this.rule = rule;
            this.Build();

            treeviewEntities.AppendColumn("Entity", new CellRendererText(), "text", 0);
            var ct1 = new CellRendererToggle();

            ct1.Toggled += delegate(object o, Gtk.ToggledArgs args) {
                TreeIter iter;
                if (!entityStore.GetIterFromString(out iter, args.Path))
                {
                    return;
                }
                entityStore.SetValue(iter, 2, !(bool)entityStore.GetValue(iter, 2));
            };
            treeviewEntities.AppendColumn("IsChecked", ct1, "active", 2);
            treeviewEntities.Model = entityStore;

            treeviewAccessibility.AppendColumn("Entity", new CellRendererText(), "text", 0);
            var ct2 = new CellRendererToggle();

            ct2.Toggled += delegate(object o, Gtk.ToggledArgs args) {
                TreeIter iter;
                if (!accessibiltyStore.GetIterFromString(out iter, args.Path))
                {
                    return;
                }
                accessibiltyStore.SetValue(iter, 2, !(bool)accessibiltyStore.GetValue(iter, 2));
            };
            treeviewAccessibility.AppendColumn("IsChecked", ct2, "active", 2);
            treeviewAccessibility.Model = accessibiltyStore;
            buttonOk.Clicked           += (sender, e) => Apply();

            FillDialog();
        }
		void AddEntry ()
		{
			var newRule = new NameConventionRule ();
			newRule.Name = "New Rule";
			var diag = new NameConventionEditRuleDialog (newRule);
			var result = MessageService.ShowCustomDialog (diag);
			if (result == (int)ResponseType.Ok)
				treeStore.AppendValues (newRule);
			OnPolicyChanged (EventArgs.Empty);
		}
		public NameConventionEditRuleDialog (NameConventionRule rule)
		{
			if (rule == null)
				throw new System.ArgumentNullException ("rule");
			this.rule = rule;
			this.Build ();

			treeviewEntities.AppendColumn ("Entity", new CellRendererText (), "text", 0);
			var ct1 = new CellRendererToggle ();
			ct1.Toggled += delegate(object o, Gtk.ToggledArgs args) {
				TreeIter iter;
				if (!entityStore.GetIterFromString (out iter, args.Path))
					return;
				entityStore.SetValue (iter, 2, !(bool)entityStore.GetValue (iter, 2));
			};
			treeviewEntities.AppendColumn ("IsChecked", ct1, "active", 2);
			treeviewEntities.Model = entityStore;
			
			treeviewAccessibility.AppendColumn ("Entity", new CellRendererText (), "text", 0);
			var ct2 = new CellRendererToggle ();
			ct2.Toggled += delegate(object o, Gtk.ToggledArgs args) {
				TreeIter iter;
				if (!accessibiltyStore.GetIterFromString (out iter, args.Path))
					return;
				accessibiltyStore.SetValue (iter, 2, !(bool)accessibiltyStore.GetValue (iter, 2));
			};
			treeviewAccessibility.AppendColumn ("IsChecked", ct2, "active", 2);
			treeviewAccessibility.Model = accessibiltyStore;
			buttonOk.Clicked += (sender, e) => Apply ();

			FillDialog ();
		}