示例#1
0
 private void GetKnownKeyboards(XmlReader reader, WritingSystemDefinitionV1 ws)
 {
     reader.MoveToContent();
     Debug.Assert(reader.NodeType == XmlNodeType.Element && reader.Name == Palaso2NamespaceName + ":" + KnownKeyboardsElementName);
     using (var knownKeyboardsReader = reader.ReadSubtree())
     {
         knownKeyboardsReader.MoveToContent();
         knownKeyboardsReader.ReadStartElement(Palaso2NamespaceName + ":" + KnownKeyboardsElementName);
         knownKeyboardsReader.MoveToContent();
         while (knownKeyboardsReader.NodeType == XmlNodeType.Element && knownKeyboardsReader.Name == Palaso2NamespaceName + ":" + KeyboardElementName)
         {
             var keyboard = new KeyboardDefinitionV1(knownKeyboardsReader.GetAttribute(LayoutAttrName),
                                                     knownKeyboardsReader.GetAttribute(LocaleAttrName));
             // Review EberhardB (JohnT): do we actually want to store OS in the LDML, or at all? If not, get rid of this.
             // If so, we need to make sure it can be loaded into the objects made by the real KeyboardController.
             PlatformID id;
             if (Enum.TryParse(knownKeyboardsReader.GetAttribute(OSAttrName), out id))
             {
                 keyboard.OperatingSystem = id;
             }
             knownKeyboardsReader.Read();
             FindElement(knownKeyboardsReader, KeyboardElementName);
             ws.AddKnownKeyboard(keyboard);
         }
     }
 }
 public void AddKnownKeyboard(KeyboardDefinitionV1 newKeyboard)
 {
     if (newKeyboard == null)
     {
         return;
     }
     // Review JohnT: how should this affect order?
     // e.g.: last added should be first?
     // Current algorithm keeps them in the order added, hopefully meaning the most likely one, added first,
     // remains the default.
     if (KnownKeyboards.Contains(newKeyboard))
     {
         return;
     }
     _knownKeyboards.Add(newKeyboard);
 }
		public void AddKnownKeyboard(KeyboardDefinitionV1 newKeyboard)
		{
			if (newKeyboard == null)
				return;
			// Review JohnT: how should this affect order?
			// e.g.: last added should be first?
			// Current algorithm keeps them in the order added, hopefully meaning the most likely one, added first,
			// remains the default.
			if (KnownKeyboards.Contains(newKeyboard))
				return;
			_knownKeyboards.Add(newKeyboard);
		}
示例#4
0
		private void GetKnownKeyboards(XmlReader reader, WritingSystemDefinitionV1 ws)
		{
			reader.MoveToContent();
			Debug.Assert(reader.NodeType == XmlNodeType.Element && reader.Name == Palaso2NamespaceName+ ":" + KnownKeyboardsElementName);
			using (var knownKeyboardsReader = reader.ReadSubtree())
			{
				knownKeyboardsReader.MoveToContent();
				knownKeyboardsReader.ReadStartElement(Palaso2NamespaceName + ":" + KnownKeyboardsElementName);
				knownKeyboardsReader.MoveToContent();
				while (knownKeyboardsReader.NodeType == XmlNodeType.Element && knownKeyboardsReader.Name == Palaso2NamespaceName + ":" + KeyboardElementName)
				{
					var keyboard = new KeyboardDefinitionV1(knownKeyboardsReader.GetAttribute(LayoutAttrName),
						knownKeyboardsReader.GetAttribute(LocaleAttrName));
					// Review EberhardB (JohnT): do we actually want to store OS in the LDML, or at all? If not, get rid of this.
					// If so, we need to make sure it can be loaded into the objects made by the real KeyboardController.
					PlatformID id;
					if (Enum.TryParse(knownKeyboardsReader.GetAttribute(OSAttrName), out id))
						keyboard.OperatingSystem = id;
					knownKeyboardsReader.Read();
					FindElement(knownKeyboardsReader, KeyboardElementName);
					ws.AddKnownKeyboard(keyboard);
				}
			}
		}