Exemplo n.º 1
0
        //void InitializeYunmu()
        //{
        //	mAllYunmus = new List<Yunmu>(24);

        //	Yunmu ymA = new Yunmu("a", btnYunmuA, false);
        //	mAllYunmus.Add(ymA);

        //	Yunmu ymO = new Yunmu("o", btnYunmuO, false);
        //	mAllYunmus.Add(ymO);

        //	Yunmu ymE = new Yunmu("e", btnYunmuE, false);
        //	mAllYunmus.Add(ymE);

        //	Yunmu ymI = new Yunmu("i", btnYunmuI, true);
        //	mAllYunmus.Add(ymI);

        //	Yunmu ymU = new Yunmu("u", btnYunmuU, true);
        //	mAllYunmus.Add(ymU);

        //	Yunmu ymV = new Yunmu("ü", btnYunmuV, true);
        //	mAllYunmus.Add(ymV);

        //	Yunmu ymAI = new Yunmu("ai", btnYunmuAI, false);
        //	mAllYunmus.Add(ymAI);

        //	Yunmu ymEI = new Yunmu("ei", btnYunmuEI, false);
        //	mAllYunmus.Add(ymEI);

        //	Yunmu ymUI = new Yunmu("ui", btnYunmuUI, true);
        //	mAllYunmus.Add(ymUI);

        //	Yunmu ymAO = new Yunmu("ao", btnYunmuAO, false);
        //	mAllYunmus.Add(ymAO);

        //	Yunmu ymOU = new Yunmu("ou", btnYunmuOU, false);
        //	mAllYunmus.Add(ymOU);

        //	Yunmu ymIU = new Yunmu("iu", btnYunmuIU, true);
        //	mAllYunmus.Add(ymIU);

        //	Yunmu ymIE = new Yunmu("ie", btnYunmuIE, true);
        //	mAllYunmus.Add(ymIE);

        //	Yunmu ymVE = new Yunmu("üe", btnYunmuVE, true);
        //	mAllYunmus.Add(ymVE);

        //	Yunmu ymER = new Yunmu("er", btnYunmuER, false);
        //	mAllYunmus.Add(ymER);

        //	Yunmu ymAN = new Yunmu("an", btnYunmuAN, false);
        //	mAllYunmus.Add(ymAN);

        //	Yunmu ymEN = new Yunmu("en", btnYunmuEN, false);
        //	mAllYunmus.Add(ymEN);

        //	Yunmu ymIN = new Yunmu("in", btnYunmuIN, true);
        //	mAllYunmus.Add(ymIN);

        //	Yunmu ymUN = new Yunmu("un", btnYunmuUN, true);
        //	mAllYunmus.Add(ymUN);

        //	Yunmu ymVN = new Yunmu("ün", btnYunmuVN, true);
        //	mAllYunmus.Add(ymVN);

        //	Yunmu ymANG = new Yunmu("ang", btnYunmuANG, false);
        //	mAllYunmus.Add(ymANG);

        //	Yunmu ymENG = new Yunmu("eng", btnYunmuENG, false);
        //	mAllYunmus.Add(ymENG);

        //	Yunmu ymING = new Yunmu("ing", btnYunmuING, true);
        //	mAllYunmus.Add(ymING);

        //	Yunmu ymONG = new Yunmu("ong", btnYunmuONG, true);
        //	mAllYunmus.Add(ymONG);

        //}

        void UpdateExplanation(ToneOfYinjie tone)
        {
            YinjieXmlFile pinyinData  = PinyinDataManager.Instance.GetAllYinjies();
            int           yinjieIndex = pinyinData.FindYinjie(mYinjie.GetString());

            FormattedString fs = new FormattedString();

            if (yinjieIndex >= 0)
            {
                string samples = "";

                if (tone == ToneOfYinjie.TONE_1)
                {
                    samples = pinyinData.AllYinjies[yinjieIndex].Tone1Samples;
                }
                else if (tone == ToneOfYinjie.TONE_2)
                {
                    samples = pinyinData.AllYinjies[yinjieIndex].Tone2Samples;
                }
                else if (tone == ToneOfYinjie.TONE_3)
                {
                    samples = pinyinData.AllYinjies[yinjieIndex].Tone3Samples;
                }
                else if (tone == ToneOfYinjie.TONE_4)
                {
                    samples = pinyinData.AllYinjies[yinjieIndex].Tone4Samples;
                }
                else
                {
                    samples = "";
                }

                fs.Spans.Add(new Span {
                    Text = pinyinData.AllYinjies[yinjieIndex].Desc + "\n", ForegroundColor = Color.FromHex("#E8AD00")
                });
                if (mYinjie.ToneRule != Yinjie.ToneRuleEnum.TONERULE_NONE)
                {
                    fs.Spans.Add(new Span {
                        Text = string.Format("声调规则: {0}\n", mYinjie.ToneRules[(int)mYinjie.ToneRule]), ForegroundColor = Color.LimeGreen
                    });
                }
                fs.Spans.Add(new Span {
                    Text = samples
                });
            }
            else
            {
                fs.Spans.Add(new Span {
                    Text = DefaultTip1 + "\n", ForegroundColor = Color.FromHex("#E8AD00")
                });
            }

            lblExplanation.FormattedText = fs;
        }
Exemplo n.º 2
0
        public PinyinPage()
        {
            InitializeComponent();

            // try disable the navigation bar
            //NavigationPage.SetHasNavigationBar(this, false);

            mYinjie = new Yinjie();

            InitializeShengmu();
            InitializeYunmu();

            mYinjieExplanations = new YinjieXmlFile();
            mYinjieExplanations.Load();

            UpdateExplanation(ToneOfYinjie.TONE_NONE);

            // set the tone buttons' initials status to false as no yinjie can be played
            UpdateToneButtonsStatus(false, false, false, false);
        }
Exemplo n.º 3
0
        //void InitializeShengmu()
        //{
        //	mAllShengmus = new List<Shengmu>(24);

        //	Shengmu smB = new Shengmu("b", btnShengmuB, "ba,bai,ban,bang,bao,bei,ben,beng,bi,bian,biao,bie,bin,bing,bo,bu");
        //	mAllShengmus.Add(smB);

        //	Shengmu smP = new Shengmu("p", btnShengmuP, "pa,pai,pan,pang,pao,pei,pen,peng,pi,pian,piao,pie,pin,ping,po,pou,pu");
        //	mAllShengmus.Add(smP);

        //	Shengmu smM = new Shengmu("m", btnShengmuM, "ma,mai,man,mang,mao,me,mei,men,meng,mi,mian,miao,mie,min,ming,miu,mo,mou,mu");
        //	mAllShengmus.Add(smM);

        //	Shengmu smF = new Shengmu("f", btnShengmuF, "fa,fan,fang,fei,fen,feng,fiao,fo,fou,fu");
        //	mAllShengmus.Add(smF);

        //	Shengmu smD = new Shengmu("d", btnShengmuD, "da,dai,dan,dang,dao,de,dei,den,deng,di,dia,dian,diao,die,ding,diu,dong,dou,du,duan,dui,dun,duo");
        //	mAllShengmus.Add(smD);

        //	Shengmu smT = new Shengmu("t", btnShengmuT, "ta,tai,tan,tang,tao,te,tei,teng,ti,tian,tiao,tie,ting,tong,tou,tu,tuan,tui,tun,tuo");
        //	mAllShengmus.Add(smT);

        //	Shengmu smN = new Shengmu("n", btnShengmuN, "na,nai,nan,nang,nao,ne,nei,nen,neng,ni,nian,niang,niao,nie,nin,ning,niu,nong,nou,nu,nü,nuan,nüe,nun,nuo");
        //	mAllShengmus.Add(smN);

        //	Shengmu smL = new Shengmu("l", btnShengmuL, "la,lai,lan,lang,lao,le,lei,leng,li,lia,lian,liang,liao,lie,lin,ling,liu,lo,long,lou,lu,lü,luan,lüe,lun,luo");
        //	mAllShengmus.Add(smL);

        //	Shengmu smG = new Shengmu("g", btnShengmuG, "ga,gai,gan,gang,gao,ge,gei,gen,geng,gong,gou,gu,gua,guai,guan,guang,gui,gun,guo");
        //	mAllShengmus.Add(smG);

        //	Shengmu smK = new Shengmu("k", btnShengmuK, "ka,kai,kan,kang,kao,ke,kei,ken,keng,kong,kou,ku,kua,kuai,kuan,kuang,kui,kun,kuo");
        //	mAllShengmus.Add(smK);

        //	Shengmu smH = new Shengmu("h", btnShengmuH, "ha,hai,han,hang,hao,he,hei,hen,heng,hong,hou,hu,hua,huai,huan,huang,hui,hun,huo");
        //	mAllShengmus.Add(smH);

        //	Shengmu smJ = new Shengmu("j", btnShengmuJ, "ji,jia,jian,jiang,jiao,jie,jin,jing,jiong,jiu,ju,juan,jue,jun");
        //	mAllShengmus.Add(smJ);

        //	Shengmu smQ = new Shengmu("q", btnShengmuQ, "qi,qia,qian,qiang,qiao,qie,qin,qing,qiong,qiu,qu,quan,que,qun");
        //	mAllShengmus.Add(smQ);

        //	Shengmu smX = new Shengmu("x", btnShengmuX, "xi,xia,xian,xiang,xiao,xie,xin,xing,xiong,xiu,xu,xuan,xue,xun");
        //	mAllShengmus.Add(smX);

        //	Shengmu smZH = new Shengmu("zh", btnShengmuZH, "zha,zhai,zhan,zhang,zhao,zhe,zhei,zhen,zheng,zhi,zhong,zhou,zhu,zhua,zhuai,zhuan,zhuang,zhui,zhun,zhuo");
        //	mAllShengmus.Add(smZH);

        //	Shengmu smCH = new Shengmu("ch", btnShengmuCH, "cha,chai,chan,chang,chao,che,chen,cheng,chi,chong,chou,chu,chua,chuai,chuan,chuang,chui,chun,chuo");
        //	mAllShengmus.Add(smCH);

        //	Shengmu smSH = new Shengmu("sh", btnShengmuSH, "sha,shai,shan,shang,shao,she,shei,shen,sheng,shi,shou,shu,shua,shuai,shuan,shuang,shui,shun,shuo");
        //	mAllShengmus.Add(smSH);

        //	Shengmu smR = new Shengmu("r", btnShengmuR, "ran,rang,rao,re,ren,reng,ri,rong,rou,ru,rua,ruan,rui,run,ruo");
        //	mAllShengmus.Add(smR);

        //	Shengmu smZ = new Shengmu("z", btnShengmuZ, "za,zai,zan,zang,zao,ze,zei,zen,zeng,zi,zong,zou,zu,zuan,zui,zun,zuo");
        //	mAllShengmus.Add(smZ);

        //	Shengmu smC = new Shengmu("c", btnShengmuC, "ca,cai,can,cang,cao,ce,cen,ceng,ci,cong,cou,cu,cuan,cui,cun,cuo");
        //	mAllShengmus.Add(smC);

        //	Shengmu smS = new Shengmu("s", btnShengmuS, "sa,sai,san,sang,sao,se,sen,seng,si,song,sou,su,suan,sui,sun,suo");
        //	mAllShengmus.Add(smS);

        //	Shengmu smY = new Shengmu("y", btnShengmuY, "ya,yan,yang,yao,ye,yi,yin,ying,yo,yong,you,yu,yuan,yue,yun");
        //	mAllShengmus.Add(smY);

        //	Shengmu smW = new Shengmu("w", btnShengmuW, "wa,wai,wan,wang,wei,wen,weng,wo,wu");
        //	mAllShengmus.Add(smW);

        //}

        void UpdateExplanation()
        {
            YinjieXmlFile pinyinData  = PinyinDataManager.Instance.GetAllYinjies();
            int           yinjieIndex = pinyinData.FindYinjie(mYinjie.GetString());

            FormattedString fs = new FormattedString();

            if (yinjieIndex >= 0)
            {
                fs.Spans.Add(new Span {
                    Text = pinyinData.AllYinjies[yinjieIndex].Desc + "\n", ForegroundColor = Color.FromHex("#E8AD00")
                });
            }
            else
            {
                fs.Spans.Add(new Span {
                    Text = DefaultTip1 + "\n", ForegroundColor = Color.FromHex("#E8AD00")
                });
            }

            lblExplanation.FormattedText = fs;
        }
Exemplo n.º 4
0
 PinyinDataManager()
 {
     mYinjieExplanations = new YinjieXmlFile();
     mYinjieExplanations.Load();
 }