Esempio n. 1
0
        /// <summary>
        /// 显示候选框的汉字
        /// smspace
        /// </summary>
        public void ShowInput(bool sp, bool clear = true, int ncount = 0, bool smspace = false)//可上屏
        {
            if (LSView)
            {
                LSView = false;
            }
            this.HideByApi();
            Dream     = false;
            PageNum   = 1;
            valuearry = Input.GetInputValue(this.inputstr);
            int count = 0;

            PreFirstValue = string.Empty;
            if (valuearry != null)
            {
                cachearry = new string[PageSize];
                for (int i = 0; i < PageSize && i < valuearry.Length; i++)
                {
                    count++;
                    cachearry[i] = valuearry[i];
                }
                if (count == 1)
                {
                    //无重码直接上屏
                    ShangPing(1);
                }
                else if (smspace && valuearry.Length == 2)
                {
                    //3码时,带空格,只有1重码,输出第2位字词。
                    ShangPing(2, 0, false);
                    //this.ShowWindow(true);
                }
                //else if (smspace && valuearry.Length > 2
                //    && valuearry[0].Split('|')[1].Length== 1 && valuearry[1].Split('|')[1].Length == 1
                //    &&  valuearry[2].Split('|')[1].Length >1)
                //{
                //    //3码时,带空格,只有1重码,输出第2位字词。
                //    ShangPing(2, 0, false);
                //    //this.ShowWindow(true);
                //}
                //else if(this.inputstr.Length==3 && smspace)
                //{
                //    ShangPing(1, 0, false);
                //}
                else if (smspace && count == 2)
                {
                    ShangPing(2);
                }
                else
                {
                    if (sp)
                    {
                        ShangPing(1, 0, clear);
                    }
                    else
                    {
                        this.ShowWindow(true);
                    }
                }
            }
            else
            {
                if (cachearry != null && cachearry.Length > 0)
                {
                    if (!string.IsNullOrEmpty(cachearry[0]))
                    {
                        PreFirstValue = cachearry[0].Split('|')[1];
                    }
                }
                if (cachearry == null)
                {
                    cachearry = new string[PageSize];
                }
                if (PreFirstValue.Length > 0 && this.inputstr != this.input && this.inputstr.Length >= 4)
                {
                    //错码上屏
                    SendText(PreFirstValue);
                    this.inputstr = this.input;
                    if (this.inputstr.Length > 0)
                    {
                        ShowInput(false);
                    }
                }
                else
                {
                    this.Clear();
                }
            }
        }