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

            newRule.Name = "New Rule";
            using (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();

            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.AppendColumn("Entity", new CellRendererText(), "text", 0);
            treeviewEntities.Model        = entityStore;
            treeviewEntities.SearchColumn = -1;             // disable the interactive search

            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.AppendColumn("Entity", new CellRendererText(), "text", 0);
            treeviewAccessibility.Model        = accessibiltyStore;
            treeviewAccessibility.SearchColumn = -1;             // disable the interactive search
            buttonOk.Clicked += (sender, e) => Apply();

            FillDialog();
        }
		public NameConventionEditRuleDialog (NameConventionRule rule)
		{
			if (rule == null)
				throw new System.ArgumentNullException ("rule");
			this.rule = rule;
			this.Build ();

			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.AppendColumn ("Entity", new CellRendererText (), "text", 0);
			treeviewEntities.Model = entityStore;
			treeviewEntities.SearchColumn = -1; // disable the interactive search

			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.AppendColumn ("Entity", new CellRendererText (), "text", 0);
			treeviewAccessibility.Model = accessibiltyStore;
			treeviewAccessibility.SearchColumn = -1; // disable the interactive search
			buttonOk.Clicked += (sender, e) => Apply ();

			FillDialog ();
		}
		void AddEntry ()
		{
			var newRule = new NameConventionRule ();
			newRule.Name = "New Rule";
			using (var diag = new NameConventionEditRuleDialog (newRule)) {
				var result = MessageService.ShowCustomDialog (diag);
				if (result == (int)ResponseType.Ok)
					treeStore.AppendValues (newRule);
				OnPolicyChanged (EventArgs.Empty);
			}
		}