コード例 #1
0
        public void SaveLayoutAs()
        {
            var dialog = new SaveFileDialog();

            dialog.Filters.Add(new FileFilter(this.Keyboard.Name + " layout", "*." + this.Keyboard.SaveFileExtension));
            dialog.Title     = "Save Layout As";
            dialog.Directory = new Uri(Environment.CurrentDirectory + MdConstant.PathSeparator + "layouts");
            try
            {
                dialog.ShowDialog(this);
                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    this.SavePath = dialog.FileName;

                    // this line is needed because gtk savefiledialog doesnt work properly with extensions
                    this.SavePath = Path.ChangeExtension(dialog.FileName, this.Keyboard.SaveFileExtension);

                    MdCore.SerializeToPath(MdSessionData.CurrentLayout, this.SavePath);
                    this.DisplaySavedChangedSignal();
                    this.LLayoutName.Text = Path.GetFileNameWithoutExtension(this.SavePath);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        public static void CreateDefaultKeyboards()
        {
            if (!Directory.Exists(Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD)))
            {
                Directory.CreateDirectory(Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD));
            }

            MdCore.SerializeToPath(Keyboard.GenerateDiverge2(), Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "diverge-2-3" + MdConstant.E_KEYBOARD));
            var d2r = Keyboard.GenerateDiverge2();

            d2r.Commands[0] = "uniqueksetsubkey";
            d2r.Commands[1] = "uniqueksetkey";
            MdCore.SerializeToPath(d2r, Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "diverge-2-3-rightmaster" + MdConstant.E_KEYBOARD));
            MdCore.SerializeToPath(Keyboard.GenerateDivergeTM(), Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "diverge-tm-1-2" + MdConstant.E_KEYBOARD));
            var dtmr = Keyboard.GenerateDivergeTM();

            dtmr.Commands[0] = "uniqueksetsubkey";
            dtmr.Commands[1] = "uniqueksetkey";
            MdCore.SerializeToPath(dtmr, Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "diverge-tm-1-2-rightmaster" + MdConstant.E_KEYBOARD));
            MdCore.SerializeToPath(Keyboard.GenerateTerminusMini(), Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "terminus-mini" + MdConstant.E_KEYBOARD));
            MdCore.SerializeToPath(Keyboard.GenerateTerminusMini2(), Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "terminus-mini-2" + MdConstant.E_KEYBOARD));
            MdCore.SerializeToPath(Keyboard.GenerateFelix(), Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "felix" + MdConstant.E_KEYBOARD));
            MdCore.SerializeToPath(Keyboard.GenerateTerminus2(), Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "terminus-2" + MdConstant.E_KEYBOARD));
            var t2mr = Keyboard.GenerateTerminus2();

            t2mr.Commands[0] = "uniqueksetsubkey";
            t2mr.Commands[1] = "uniqueksetkey";
            MdCore.SerializeToPath(t2mr, Path.Combine(MdConstant.Root, MdConstant.D_KEYBOARD, "terminus-2-rightmaster" + MdConstant.E_KEYBOARD));
        }
コード例 #3
0
ファイル: MdMetaUtil.cs プロジェクト: skempf/arbites-family
        public static void CreateDefaultInputMethods()
        {
            if (!Directory.Exists(Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_INPUT_METHOD)))
            {
                Directory.CreateDirectory(Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_INPUT_METHOD));
            }

            MdCore.Serialize(ClDisplayCharacterContainer.GenerateUSASCII()
                             , Path.Combine(
                                 MdPersistentData.ConfigPath
                                 , MdConstant.D_INPUT_METHOD,
                                 "US-ANSI" + MdConstant.E_INPUT_METHOD));

            MdCore.Serialize(ClDisplayCharacterContainer.GenerateUKISO()
                             , Path.Combine(
                                 MdPersistentData.ConfigPath
                                 , MdConstant.D_INPUT_METHOD,
                                 "UK-QWERTY-BS4822" + MdConstant.E_INPUT_METHOD));


            //Deutsch-QWERTZ-T1
            MdCore.Serialize(ClDisplayCharacterContainer.GenerateDeuQWERTZ()
                             , Path.Combine(
                                 MdPersistentData.ConfigPath
                                 , MdConstant.D_INPUT_METHOD,
                                 "Deutsch-QWERTZ-T1" + MdConstant.E_INPUT_METHOD));

            //GenerateSEDKQWERTY
            MdCore.Serialize(ClDisplayCharacterContainer.GenerateSEDKQWERTY()
                             , Path.Combine(
                                 MdPersistentData.ConfigPath
                                 , MdConstant.D_INPUT_METHOD,
                                 "Swedish-Danish-QWERTY" + MdConstant.E_INPUT_METHOD));
        }
コード例 #4
0
ファイル: FmMain.cs プロジェクト: skempf/arbites-family
        public void Test()
        {
            MdCore.Serialize(new MdPersistentData(), MdConstant.N_PERSISTENT_DATA);


            MdMetaUtil.ResetDefaults();
        }
コード例 #5
0
ファイル: FmMain.cs プロジェクト: skempf/arbites-family
        private void ChangeInputMethod()
        {
            MdConfig.Main.CurrentInputMethod = this.DDInputMethod.SelectedKey + MdConstant.E_INPUT_METHOD;
            MdSessionData.CurrentInputMethod = MdConfig.Main.GetCurrentInputMethod();
            MdMetaUtil.ReloadInputMethodUI();

            MdCore.Serialize(MdConfig.Main, Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
        }
コード例 #6
0
        public static void CreateDefaultKeygroups()
        {
            if (!Directory.Exists(Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_KEYGROUP)))
            {
                Directory.CreateDirectory(Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_KEYGROUP));
            }

            MdCore.Serialize(ClKeyGroup.GenerateDefault(), Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_KEYGROUP, "Core" + MdConstant.E_KEYGROUP));
        }
コード例 #7
0
        public static void CreateDefaultKeygroups()
        {
            if (!Directory.Exists(Path.Combine(MdConstant.Root, MdConstant.D_KEYGROUP)))
            {
                Directory.CreateDirectory(Path.Combine(MdConstant.Root, MdConstant.D_KEYGROUP));
            }

            MdCore.SerializeToPath(KeyGroup.GenerateDefault(), Path.Combine(MdConstant.Root, MdConstant.D_KEYGROUP, "Core" + MdConstant.E_KEYGROUP));
        }
コード例 #8
0
 public void SaveLayout()
 {
     if (this.SavePath == "<UNSAVED LAYOUT>")
     {
         SaveLayoutAs();
     }
     else
     {
         MdCore.SerializeToPath(MdSessionData.CurrentLayout, this.SavePath);
         this.DisplaySavedChangedSignal();
     }
 }
コード例 #9
0
ファイル: UCKeyboard.cs プロジェクト: skempf/arbites-family
 public void SaveLayout()
 {
     if (this.SavePath == "<UNSAVED LAYOUT>")
     {
         SaveLayoutAs();
     }
     else
     {
         MdCore.Serialize(MdSessionData.CurrentLayout, this.SavePath);
         this.BtnSave.Text = "Save Layout";
     }
 }
コード例 #10
0
        public static void CreateDefaultInputMethods()
        {
            if (!Directory.Exists(Path.Combine(MdConstant.Root, MdConstant.D_INPUT_METHOD)))
            {
                Directory.CreateDirectory(Path.Combine(MdConstant.Root, MdConstant.D_INPUT_METHOD));
            }

            MdCore.SerializeToPath(DisplayCharacterContainer.GenerateUSASCII()
                                   , Path.Combine(
                                       MdConstant.Root
                                       , MdConstant.D_INPUT_METHOD,
                                       "US-ANSI" + MdConstant.E_INPUT_METHOD));

            MdCore.SerializeToPath(DisplayCharacterContainer.GenerateUKISO()
                                   , Path.Combine(
                                       MdConstant.Root
                                       , MdConstant.D_INPUT_METHOD,
                                       "UK-QWERTY-BS4822" + MdConstant.E_INPUT_METHOD));

            //Deutsch-QWERTZ-T1
            MdCore.SerializeToPath(DisplayCharacterContainer.GenerateDeuQWERTZ()
                                   , Path.Combine(
                                       MdConstant.Root
                                       , MdConstant.D_INPUT_METHOD,
                                       "Deutsch-QWERTZ-T1" + MdConstant.E_INPUT_METHOD));

            //GenerateSEDKQWERTY
            MdCore.SerializeToPath(DisplayCharacterContainer.GenerateSEDKQWERTY()
                                   , Path.Combine(
                                       MdConstant.Root
                                       , MdConstant.D_INPUT_METHOD,
                                       "Swedish-Danish-QWERTY" + MdConstant.E_INPUT_METHOD));

            //GenerateSwissGerman
            MdCore.SerializeToPath(DisplayCharacterContainer.GenerateSwissQWERTZDE()
                                   , Path.Combine(
                                       MdConstant.Root
                                       , MdConstant.D_INPUT_METHOD,
                                       "Deutsch-QWERTZ-Schweizer" + MdConstant.E_INPUT_METHOD));

            //GenerateSwissFrench
            MdCore.SerializeToPath(DisplayCharacterContainer.GenerateSwissQWERTZFR()
                                   , Path.Combine(
                                       MdConstant.Root
                                       , MdConstant.D_INPUT_METHOD,
                                       "Français-QWERTZ-Suisse" + MdConstant.E_INPUT_METHOD));
        }
コード例 #11
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));
        }
コード例 #12
0
ファイル: FmMain.cs プロジェクト: skempf/arbites-family
        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;
            }
        }
コード例 #13
0
        public static void FirstRunCheck()
        {
            bool needsRestore = false;

            try
            {
                var cfg = MdCore.Deserialize <MdConfig>(Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
                if (cfg.ConfigVersion != MdConfig.SoftwareVersion)
                {
                    needsRestore = true;
                }
            }
            catch (Exception ex)
            {
                needsRestore = true;
            }

            if (needsRestore)
            {
                ResetDefaults();
            }
        }
コード例 #14
0
        public static void FirstRunCheck()
        {
            bool needsRestore = false;

            try
            {
                var cfg = MdCore.DeserializeFromPath <MdConfig>(Path.Combine(MdConstant.Root, MdConstant.N_CONFIG));
                if (cfg.ConfigVersion != MdConfig.SoftwareVersion)
                {
                    needsRestore = true;
                }
            }
            catch
            {
                needsRestore = true;
            }

            if (needsRestore)
            {
                ResetDefaults();
            }
        }
コード例 #15
0
        public void LoadLayoutFile()
        {
            var dialog = new OpenFileDialog();

            dialog.Filters.Add(new FileFilter(this.Keyboard.Name + " layout", "*." + this.Keyboard.SaveFileExtension));
            dialog.Title     = "Load Layout";
            dialog.Directory = new Uri(Environment.CurrentDirectory + MdConstant.PathSeparator + "layouts");
            try
            {
                dialog.ShowDialog(this);
                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    MdSessionData.CurrentLayout = MdCore.DeserializeFromPath <LayoutContainer>(dialog.FileName);
                    LoadLayout(MdSessionData.CurrentLayout);
                    this.SavePath         = dialog.FileName;
                    this.LLayoutName.Text = Path.GetFileNameWithoutExtension(this.SavePath);
                    this.DisplaySavedChangedSignal();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #16
0
 public static void Init()
 {
     Main       = MdCore.Deserialize <MdPersistentData>(MdConstant.N_PERSISTENT_DATA);
     ConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ArbitesData");
 }
コード例 #17
0
 private void CheckedDisplayOutput()
 {
     MdConfig.Main.DisplayOutput = this.CBDisplayOutput.Checked.Value;
     MdCore.SerializeToPath(MdConfig.Main, Path.Combine(MdConstant.Root, MdConstant.N_CONFIG));
 }
コード例 #18
0
 private void FmClosing()
 {
     MdCore.Serialize(MdConfig.Main, Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
 }
コード例 #19
0
 private void UploadDelayChanged()
 {
     MdConfig.Main.UploadDelay = Convert.ToInt32(this.DDUploadDelay.SelectedKey);
     MdCore.Serialize(MdConfig.Main, Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
 }
コード例 #20
0
ファイル: MdConfig.cs プロジェクト: skempf/arbites-family
 public static void Init()
 {
     Main = MdCore.Deserialize <MdConfig>(Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
 }
コード例 #21
0
 private void CheckedKeyMenuTopMost()
 {
     MdConfig.Main.KeyMenuTopmost = this.CBKeyMenuTopMost.Checked.Value;
     MdSessionData.KeyMenu.ReloadTopmost();
     MdCore.Serialize(MdConfig.Main, Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
 }
コード例 #22
0
 private void FmClosing()
 {
     MdCore.SerializeToPath(MdConfig.Main, Path.Combine(MdConstant.Root, MdConstant.N_CONFIG));
 }
コード例 #23
0
 public static void CreateDefaultConfig()
 {
     MdCore.Serialize(new MdConfig(), Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
 }
コード例 #24
0
ファイル: MdConfig.cs プロジェクト: sameer/arbites-family
 public static void Init()
 {
     Main = MdCore.DeserializeFromPath <MdConfig>(Path.Combine(MdConstant.Root, MdConstant.N_CONFIG));
 }
コード例 #25
0
ファイル: MdConfig.cs プロジェクト: sameer/arbites-family
 public DisplayCharacterContainer GetCurrentInputMethod()
 {
     return(MdCore.DeserializeFromPath <DisplayCharacterContainer>(Path.Combine(MdConstant.Root, MdConstant.D_INPUT_METHOD, this.CurrentInputMethod)));
 }
コード例 #26
0
 private void CheckedDisplayOutput()
 {
     MdConfig.Main.DisplayOutput = this.CBDisplayOutput.Checked.Value;
     MdCore.Serialize(MdConfig.Main, Path.Combine(MdPersistentData.ConfigPath, MdConstant.N_CONFIG));
 }
コード例 #27
0
 public static void CreateDefaultConfig()
 {
     MdCore.SerializeToPath(new MdConfig(), Path.Combine(MdConstant.Root, MdConstant.N_CONFIG));
 }
コード例 #28
0
ファイル: MdConfig.cs プロジェクト: skempf/arbites-family
 public ClDisplayCharacterContainer GetCurrentInputMethod()
 {
     return(MdCore.Deserialize <ClDisplayCharacterContainer>(Path.Combine(MdPersistentData.ConfigPath, MdConstant.D_INPUT_METHOD, this.CurrentInputMethod)));
 }