示例#1
0
        /// <summary>
        /// Send message back to server to get cnList selection
        /// </summary>
        /// <param name="prompt"></param>
        /// <param name="defaultUo"></param>
        /// <returns></returns>
#if false
        public static UserObject SelectCompoundIdListDialog(
            string prompt,
            UserObject defaultUo)
        {
            string msg = "SelectCompoundIdList";

            if (defaultUo != null)
            {
                msg += "\t" + defaultUo.Id.ToString();
            }

            UIMisc.EnableComTimer(false);             // disable timer processing for this loop
            Server.SendMessage(msg);

            ObjectOpen.IsClosed = false;
            while (ObjectOpen.IsClosed == false)
            {             // wait for ObjectOpen to complete
                Application.DoEvents();
                Thread.Sleep(100);
            }

            while (true)             // get result
            {
                try
                {
                    msg = Server.ReceiveMessage();
                    if (!msg.StartsWith("SelectCompoundIdListResult"))
                    {
                        continue;
                    }
                    UIMisc.EnableComTimer(true);                     // reenable timer
                    string[] sa = msg.Split('\t');
                    if (sa.Length < 3)
                    {
                        return(null);
                    }
                    UserObject uo = new UserObject(UserObjectType.CnList);
                    uo.Name = sa[1];
                    uo.Id   = int.Parse(sa[2]);
                    return(uo);
                }
                catch (Exception ex) { ex = ex; }
            }
        }