Esempio n. 1
0
        private void SelectDevice()
        {
            var lst = Directory.GetFiles(Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_KEYBOARD), "*" + MdConstant.E_KEYBOARD).ToList();
            var fm  = new FmSelectTextDialog(lst, lst.Select(ele => Path.GetFileNameWithoutExtension(ele)).ToList(), "Select a device");

            fm.ShowModal();
            var outputInd = fm.OutputIndex;

            if (outputInd >= 0)
            {
                var kb = MdCore.Deserialize <ClKeyboard>(fm.OutputValues[outputInd]);
                MdSessionData.CurrentKeyboardType = kb;
                MdSessionData.CurrentLayout       = kb.GenerateLayout();
                var ucl = new UCKeyboard(MdSessionData.CurrentKeyboardType, MdSessionData.CurrentLayout);
                MdSessionData.CurrentKeyboardUI = ucl;
                this.PnMain.Content             = ucl;
                this.BtnSelectDevice.Text       = "Device: " + kb.Name;
            }
        }
Esempio n. 2
0
        public static void Init()
        {
            MdConfig.Init();
            CurrentKeyboardType = new Keyboard();
            CurrentLayout       = new LayoutContainer();
            CurrentKeyboardUI   = new UCKeyboard();
            KeyMenuKey          = new Key();
            CurrentInputMethod  = new DisplayCharacterContainer();
            KeyGroup            = new KeyGroup();
            SP = new SerialPort();

            if (File.Exists("favicon.ico"))
            {
                WindowIcon = new Icon(Path.Combine(MdConstant.Root, MdConstant.N_ICON));
            }

            CurrentInputMethod = MdConfig.Main.GetCurrentInputMethod();
            KeyGroup           = MdCore.DeserializeFromPath <KeyGroup>(Path.Combine(MdConstant.Root, MdConstant.D_KEYGROUP, "Core" + MdConstant.E_KEYGROUP));
        }