Example #1
0
        KeyboardLayoutContent ProcessKeyboardLayout(LocaleSource input, ContentProcessorContext context)
        {
            // Load keyboard layout
            // FIXME: Use localeSource.CultureInfo.KeyboardLayoutId?
            String klid = String.Format("{0:x8}", input.CultureInfo.KeyboardLayoutId);

            context.Logger.LogMessage("Using keyboard layout {0} for locale {1}", klid, input.CultureInfo.Name);
            KeyboardLayoutSource kls = new KeyboardLayoutSource(klid);

            return(context.Convert <KeyboardLayoutSource, KeyboardLayoutContent>(kls, "KeyboardLayoutProcessor"));
        }
Example #2
0
        public static void TestImport(int localeId)
        {
            String lid = String.Format("{0:x8}", localeId);
            KeyboardLayoutSource    kls = new KeyboardLayoutSource(lid);
            KeyboardLayoutProcessor klp = new KeyboardLayoutProcessor();
            KeyboardLayoutContent   klc = klp.Process(kls, null);
            VirtualKey vk = klc.Keys[(int)KeysEx.VK_Z].VirtualKey;

            byte[]       buffer = new byte[1024];
            MemoryStream ms     = new MemoryStream(buffer);
            BinaryWriter bw     = new BinaryWriter(ms);

            foreach (VirtualKeyValue value in vk.ShiftStates)
            {
                bw.Write(value.Characters);
                System.Diagnostics.Debug.WriteLine(value.Characters);
            }
            bw.Close();
        }