Exemple #1
0
        // 装入全部日历名
        int FillCalendarNames(out string strError)
        {
            this.comboBox_calendarName.Items.Clear();

            EnableControls(false, true);

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在获得全部日历名 ...");
            stop.BeginLoop();

            this.Update();
            this.MainForm.Update();

            try
            {
                int           nStart = 0;
                int           nCount = 100;
                List <string> names  = new List <string>();

                while (true)
                {
                    CalenderInfo[] infos = null;

                    long lRet = Channel.GetCalendar(
                        stop,
                        "list",
                        "",
                        nStart,
                        nCount,
                        out infos,
                        out strError);
                    if (lRet == -1)
                    {
                        goto ERROR1;
                    }
                    if (lRet == 0)
                    {
                        break;
                    }

                    //
                    for (int i = 0; i < infos.Length; i++)
                    {
                        names.Add(infos[i].Name);
                    }

                    nStart += infos.Length;
                    if (nStart >= lRet)
                    {
                        break;
                    }
                }

                names.Sort(new CalencarNameComparer());
                foreach (string s in names)
                {
                    this.comboBox_calendarName.Items.Add(s);
                }
            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");

                EnableControls(true, true);
            }

            return(1);

ERROR1:
            return(-1);
        }