public ConfigurationViewModel()
        {
            this.keyboards = new List <string>()
            {
                "Default",
                "Plain",
                "Chat",
                "Email",
                "Numeric",
                "Telephone",
                "Text",
                "Url"
            };

            this.textColors = new List <string>()
            {
                "Gray",
                "Orange",
                "Blue",
                "Pink"
            };

            this.fontSizes = new List <NamedSize>()
            {
                NamedSize.Default,
                NamedSize.Large,
                NamedSize.Small
            };

            this.keyboardTypeConverter = new KeyboardTypeConverter();
            this.colorTypeConverter    = new ColorTypeConverter();
            this.fontSizeConverter     = new FontSizeConverter();
        }
        void KeyboardType_SelectedIndexChanged(System.Object sender, System.EventArgs e)
        {
            string selectedValue       = KeyboardType.Items[KeyboardType.SelectedIndex];
            var    converter           = new KeyboardTypeConverter();
            string keyboardStringValue = "Keyboard." + selectedValue;

            keyboardEntry.Keyboard = (Keyboard)converter.ConvertFromInvariantString(keyboardStringValue);
        }
示例#3
0
		public void ConversionConvert ()
		{

			var converter = new KeyboardTypeConverter ();
			Assert.True (converter.CanConvertFrom (typeof(string)));
			foreach (var kvp in new Dictionary<string, Keyboard> {
				{"Keyboard.Default", Keyboard.Default},
				{"Keyboard.Email", Keyboard.Email},
				{"Keyboard.Text", Keyboard.Text},
				{"Keyboard.Url", Keyboard.Url},
				{"Keyboard.Telephone", Keyboard.Telephone},
				{"Keyboard.Chat", Keyboard.Chat},
			})
				Assert.AreSame (kvp.Value, converter.ConvertFromInvariantString (kvp.Key));
		}
示例#4
0
        public void ConversionConvert()
        {
            var converter = new KeyboardTypeConverter();

            Assert.True(converter.CanConvertFrom(typeof(string)));
            foreach (var kvp in new Dictionary <string, Keyboard> {
                { "Keyboard.Default", Keyboard.Default },
                { "Keyboard.Email", Keyboard.Email },
                { "Keyboard.Text", Keyboard.Text },
                { "Keyboard.Url", Keyboard.Url },
                { "Keyboard.Telephone", Keyboard.Telephone },
                { "Keyboard.Chat", Keyboard.Chat },
            })
            {
                Assert.AreSame(kvp.Value, converter.ConvertFromInvariantString(kvp.Key));
            }
        }
示例#5
0
		public void ConversionFail ()
		{
			var converter = new KeyboardTypeConverter ();
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("Foo"));
		}
示例#6
0
        public void ConversionFail()
        {
            var converter = new KeyboardTypeConverter();

            Assert.Throws <InvalidOperationException> (() => converter.ConvertFromInvariantString("Foo"));
        }
 public XamlKeyboardTypeConverter()
 {
     _converter = new KeyboardTypeConverter();
 }