public static CheckProperty AddPropertyCheckbox(PropertyTable prop, string label, bool value)
 {
     var check = new CheckProperty(null);
     prop.Add(label, check);
     check.IsChecked = value;
     return check;
 }
Esempio n. 2
0
        private static void AddProperty(PropertyTable propertyTable, ICollection <PropertyBinding> memberList, Type declaringType, PropertyBinding memberBinding, MemberInfo memberInfo)
        {
            // Check if we already have a member with the same name declared.
            PropertyTable.Entry exisitingMemberEntry = propertyTable[memberBinding.Name];

            if (exisitingMemberEntry != null)
            {
                // Ok we have one. Check if the existing member is not more specific.
                if (ExistingMemberIsMoreSpecific(declaringType, exisitingMemberEntry.MemberInfo, memberInfo))
                {
                    // The existing member is more specific. So we don't add the new one.
                    return;
                }
                else
                {
                    // The new member is more specific. Remove the old one.
                    propertyTable.Remove(exisitingMemberEntry);
                    memberList.Remove(exisitingMemberEntry.PropertyBinding);
                }
            }

            // Either the new member is more specific or we don't had
            // a member with same name.
            propertyTable.Add(memberBinding, memberInfo);
            memberList.Add(memberBinding);
        }
Esempio n. 3
0
        private CheckProperty AddPropertyCheckbox(PropertyTable prop, string label, bool value)
        {
            var check = new CheckProperty(null);

            prop.Add(label, check);
            check.IsChecked = value;
            return(check);
        }
Esempio n. 4
0
        private void InitTable(PropertyTable table)
        {
            table.Add("text", "textbox").Tooltip = "Heyy tooltip";
            LabelProperty lab = new LabelProperty(null)
            {
                Value = "Uneditable label",
            };

            table.Add("Label", lab);
            table.Add("check", new CheckProperty(null));
            var cb = new ComboBoxProperty(table);

            cb.AddItem("Test");
            cb.AddItem("auto selected");
            cb.AddItem("val 3");
            cb.SetValue("auto selected");
            table.Add("combo", cb);
            NumberProperty num = new NumberProperty(table)
            {
                Min = -10, Max = 10, Value = "3"
            };

            table.Add("Number:", num);
        }
        private void SetupSceneryOptions(PropertyTree tree, PropertyTable lineProp)
        {
            var width = new NumberProperty(lineProp)
            {
                Min         = 0.1,
                Max         = 25.5,
                NumberValue = _ownerline.Width,
            };

            width.ValueChanged += (o, e) =>
            {
                ChangeWidth(width.NumberValue);
            };
            lineProp.Add("Width", width);
        }
Esempio n. 6
0
		private static void AddProperty(PropertyTable propertyTable, ICollection<PropertyBinding> memberList, Type declaringType, PropertyBinding memberBinding, MemberInfo memberInfo)
		{
			// Check if we already have a member with the same name declared.
			PropertyTable.Entry exisitingMemberEntry = propertyTable[memberBinding.Name];
	
			if (exisitingMemberEntry != null)
			{
				// Ok we have one. Check if the existing member is not more specific.
				if (ExistingMemberIsMoreSpecific(declaringType, exisitingMemberEntry.MemberInfo, memberInfo))
				{
					// The existing member is more specific. So we don't add the new one.
					return;
				}
				else
				{
					// The new member is more specific. Remove the old one.
					propertyTable.Remove(exisitingMemberEntry);
					memberList.Remove(exisitingMemberEntry.PropertyBinding);
				}
			}
	
			// Either the new member is more specific or we don't had
			// a member with same name.
			propertyTable.Add(memberBinding, memberInfo);
			memberList.Add(memberBinding);
		}
Esempio n. 7
0
        private void AddBinding(PropertyTable table, string label, Hotkey hotkey, string tooltip = null)
        {
            var           hk       = FetchBinding(hotkey);
            string        hkstring = CreateBindingText(hotkey);
            LabelProperty prop     = new LabelProperty(null)
            {
                Value = hkstring,
                Name  = hotkey.ToString(),
            };
            var row = table.Add(label, prop);

            if (tooltip != null)
            {
                row.Tooltip = tooltip;
            }
            prop.Clicked += (o, e) =>
            {
                ShowHotkeyWindow(hotkey, prop, 0);
            };
            prop.RightClicked += (o, e) =>
            {
                Menu opt = new Menu(_canvas);
                opt.AddItem("Change Primary").Clicked += (_o, _e) =>
                {
                    ShowHotkeyWindow(hotkey, prop, 0);
                };
                opt.AddItem("Change Secondary").Clicked += (_o, _e) =>
                {
                    ShowHotkeyWindow(hotkey, prop, 1);
                };
                opt.AddItem("Remove Secondary").Clicked += (_o, _e) =>
                {
                    var k = Settings.Keybinds[hotkey];
                    if (k.Count > 1)
                    {
                        k.RemoveAt(1);
                        prop.Value = CreateBindingText(hotkey);
                        Settings.Save();
                    }
                };
                opt.AddItem("Restore Default").Clicked += (_o, _e) =>
                {
                    var def = Settings.GetHotkeyDefault(hotkey);
                    if (def != null && def.Count != 0)
                    {
                        int idx  = 0;
                        var keys = Settings.Keybinds[hotkey];
                        keys.Clear();
                        foreach (var defaultbind in def)
                        {
                            var conflict = Settings.CheckConflicts(defaultbind, hotkey);
                            if (conflict != Hotkey.None)
                            {
                                RemoveKeybind(conflict, defaultbind);
                            }
                            ChangeKeybind(prop, hotkey, idx++, defaultbind);
                        }
                        Settings.Save();
                    }
                };
                opt.Open(Pos.Center);
            };
        }
Esempio n. 8
0
 private void InitTable(PropertyTable table)
 {
     table.Add("text", "val").Tooltip = "Heyy tooltip";
     table.Add("check", new CheckProperty(null));
 }