Esempio n. 1
0
        public void table(ListView listView1, string otprv, string nazn, string date)
        {
            s_el = parse_el.list("http://rasp.yandex.ru/search/suburban/?fromName=" + otprv + "&fromId=&toName=" + nazn + "&&toId=&when=" + date);
            int number = 1;

            while (1 > 0)
            {
                lv1 = new ListViewItem();
                lv2 = new ListViewItem.ListViewSubItem();
                lv3 = new ListViewItem.ListViewSubItem();
                lv4 = new ListViewItem.ListViewSubItem();
                lv5 = new ListViewItem.ListViewSubItem();
                lv6 = new ListViewItem.ListViewSubItem();

                lv1.Text = Convert.ToString(number);

                //рейсы
                begin_reis[number] = s_el.IndexOf(begin_1, end_reis[number - 1]);
                if (begin_reis[number] < 0) { break; }
                sered_reis[number] = s_el.IndexOf(sered_1, begin_reis[number]);
                end_reis[number] = s_el.IndexOf(end_1, sered_reis[number]);
                lv2.Text = s_el.Substring(begin_reis[number] + begin_1.Length, sered_reis[number] - begin_reis[number] - begin_1.Length) + " - " + s_el.Substring(sered_reis[number] + sered_1.Length, end_reis[number] - sered_reis[number] - sered_1.Length);

                //отправление

                otshet_otpr[number] = s_el.IndexOf(otshet_2, end_otpr[number - 1]);
                begin_otpr[number] = s_el.IndexOf(begin_2, otshet_otpr[number]);
                end_otpr[number] = s_el.IndexOf(end_2, begin_otpr[number]);
                lv3.Text = s_el.Substring(begin_otpr[number] + begin_2.Length, end_otpr[number] - begin_otpr[number] - begin_2.Length);

                time_srvn tsrv = new time_srvn();
                bool time = tsrv.srvn(lv3.Text);
                if (time == true)
                {
                    lv1.BackColor = Color.Gray;
                }

                //прибытие

                otshet_pr[number] = s_el.IndexOf(otshet_3, end_pr[number - 1]);
                begin_pr[number] = s_el.IndexOf(begin_3, otshet_pr[number]);
                end_pr[number] = s_el.IndexOf(end_3, begin_pr[number]);
                lv4.Text = s_el.Substring(begin_pr[number] + begin_3.Length, end_pr[number] - begin_pr[number] - begin_3.Length);

                //остановки

                begin_ost[number] = s_el.IndexOf(begin_4, end_ost[number - 1]);
                end_ost[number] = s_el.IndexOf(end_4, begin_ost[number]);
                lv5.Text = s_el.Substring(begin_ost[number] + begin_4.Length, end_ost[number] - begin_ost[number] - begin_4.Length);

                lv1.SubItems.Add(lv2);
                lv1.SubItems.Add(lv3);
                lv1.SubItems.Add(lv4);
                lv1.SubItems.Add(lv5);
                string rezult = lv2.Text + lv2.Text + lv2.Text + lv2.Text;

                listView1.Items.Add(lv1);
                number += 1;
            }
        }
Esempio n. 2
0
        public void table(ListView listView2, string otprv, string nazn, string date)
        {
            s_train = parse_train.list(" http://rasp.yandex.ru/search/train/?fromName=" + otprv + "&fromId=&toName=" + nazn + "&&toId=&when=" + date);
            //s_train = parse_train.list(" http://rasp.yandex.ru/search/train/?fromName=" + "Москва" + "&fromId=&toName=" + "Уфа" + "&&toId=&when=" + date);

            int number = 1;

            while (1 > 0)
            {
                lv1 = new ListViewItem();
                lv2 = new ListViewItem.ListViewSubItem();
                lv3 = new ListViewItem.ListViewSubItem();
                lv4 = new ListViewItem.ListViewSubItem();
                lv5 = new ListViewItem.ListViewSubItem();

                lv1.Text = Convert.ToString(number);

                begin_reis[number] = s_train.IndexOf(begin_1, end_reis[number - 1]);
                if (begin_reis[number] < 0)
                {
                    break;
                }
                sered_reis[number]  = s_train.IndexOf(sered_1, begin_reis[number]);
                sered_reis2[number] = s_train.IndexOf(sered_2, sered_reis[number]);
                sered_reis3[number] = s_train.IndexOf(sered_3, sered_reis2[number]);
                end_reis[number]    = s_train.IndexOf(end_1, sered_reis3[number]);
                lv2.Text            = s_train.Substring(sered_reis[number] + sered_1.Length, sered_reis2[number] - sered_reis[number] - sered_1.Length) + "  " + s_train.Substring(sered_reis2[number] + sered_2.Length, sered_reis3[number] - sered_reis2[number] - sered_2.Length) + " - " + s_train.Substring(sered_reis3[number] + sered_3.Length, end_reis[number] - sered_reis3[number] - sered_3.Length);



                otshet_otpr[number] = s_train.IndexOf(otshet_2, end_otpr[number - 1]);
                begin_otpr[number]  = s_train.IndexOf(begin_2, otshet_otpr[number]);
                end_otpr[number]    = s_train.IndexOf(end_2, begin_otpr[number]);
                lv3.Text            = s_train.Substring(begin_otpr[number] + begin_2.Length, end_otpr[number] - begin_otpr[number] - begin_2.Length);

                time_srvn tsrv = new time_srvn();
                bool      time = tsrv.srvn(lv3.Text);
                if (time == true)
                {
                    lv1.BackColor = Color.Gray;
                }


                otshet_pr[number] = s_train.IndexOf(otshet_3, end_pr[number - 1]);
                begin_pr[number]  = s_train.IndexOf(begin_3, otshet_pr[number]);
                end_pr[number]    = s_train.IndexOf(end_3, begin_pr[number]);
                lv4.Text          = s_train.Substring(begin_pr[number] + begin_3.Length, end_pr[number] - begin_pr[number] - begin_3.Length);

                lv1.SubItems.Add(lv2);
                lv1.SubItems.Add(lv3);
                lv1.SubItems.Add(lv4);
                lv1.SubItems.Add(lv5);

                listView2.Items.Add(lv1);
                number += 1;
            }
        }
Esempio n. 3
0
        public void table(ListView listView2, string otprv, string nazn, string date)
        {
            s_train = parse_train.list(" http://rasp.yandex.ru/search/train/?fromName=" + otprv + "&fromId=&toName=" + nazn + "&&toId=&when=" + date);
            //s_train = parse_train.list(" http://rasp.yandex.ru/search/train/?fromName=" + "Москва" + "&fromId=&toName=" + "Уфа" + "&&toId=&when=" + date);

            int number = 1;

            while (1 > 0)
            {
                lv1 = new ListViewItem();
                lv2 = new ListViewItem.ListViewSubItem();
                lv3 = new ListViewItem.ListViewSubItem();
                lv4 = new ListViewItem.ListViewSubItem();
                lv5 = new ListViewItem.ListViewSubItem();

                lv1.Text = Convert.ToString(number);

                begin_reis[number] = s_train.IndexOf(begin_1, end_reis[number - 1]);
                if (begin_reis[number] < 0) { break; }
                sered_reis[number] = s_train.IndexOf(sered_1, begin_reis[number]);
                sered_reis2[number] = s_train.IndexOf(sered_2, sered_reis[number]);
                sered_reis3[number] = s_train.IndexOf(sered_3, sered_reis2[number]);
                end_reis[number] = s_train.IndexOf(end_1, sered_reis3[number]);
                lv2.Text = s_train.Substring(sered_reis[number] + sered_1.Length, sered_reis2[number] - sered_reis[number] - sered_1.Length) + "  " + s_train.Substring(sered_reis2[number] + sered_2.Length, sered_reis3[number] - sered_reis2[number] - sered_2.Length) + " - " + s_train.Substring(sered_reis3[number] + sered_3.Length, end_reis[number] - sered_reis3[number] - sered_3.Length);

                otshet_otpr[number] = s_train.IndexOf(otshet_2, end_otpr[number - 1]);
                begin_otpr[number] = s_train.IndexOf(begin_2, otshet_otpr[number]);
                end_otpr[number] = s_train.IndexOf(end_2, begin_otpr[number]);
                lv3.Text = s_train.Substring(begin_otpr[number] + begin_2.Length, end_otpr[number] - begin_otpr[number] - begin_2.Length);

                time_srvn tsrv = new time_srvn();
                bool time = tsrv.srvn(lv3.Text);
                if (time == true)
                {
                    lv1.BackColor = Color.Gray;
                }

                otshet_pr[number] = s_train.IndexOf(otshet_3, end_pr[number - 1]);
                begin_pr[number] = s_train.IndexOf(begin_3, otshet_pr[number]);
                end_pr[number] = s_train.IndexOf(end_3, begin_pr[number]);
                lv4.Text = s_train.Substring(begin_pr[number] + begin_3.Length, end_pr[number] - begin_pr[number] - begin_3.Length);

                lv1.SubItems.Add(lv2);
                lv1.SubItems.Add(lv3);
                lv1.SubItems.Add(lv4);
                lv1.SubItems.Add(lv5);

                listView2.Items.Add(lv1);
                number += 1;
            }
        }
Esempio n. 4
0
        public void table(ListView listView1, string otprv, string nazn, string date)
        {
            s_el = parse_el.list("http://rasp.yandex.ru/search/suburban/?fromName=" + otprv + "&fromId=&toName=" + nazn + "&&toId=&when=" + date);
            int number = 1;

            while (1 > 0)
            {
                lv1 = new ListViewItem();
                lv2 = new ListViewItem.ListViewSubItem();
                lv3 = new ListViewItem.ListViewSubItem();
                lv4 = new ListViewItem.ListViewSubItem();
                lv5 = new ListViewItem.ListViewSubItem();
                lv6 = new ListViewItem.ListViewSubItem();

                lv1.Text = Convert.ToString(number);


                //рейсы
                begin_reis[number] = s_el.IndexOf(begin_1, end_reis[number - 1]);
                if (begin_reis[number] < 0)
                {
                    break;
                }
                sered_reis[number] = s_el.IndexOf(sered_1, begin_reis[number]);
                end_reis[number]   = s_el.IndexOf(end_1, sered_reis[number]);
                lv2.Text           = s_el.Substring(begin_reis[number] + begin_1.Length, sered_reis[number] - begin_reis[number] - begin_1.Length) + " - " + s_el.Substring(sered_reis[number] + sered_1.Length, end_reis[number] - sered_reis[number] - sered_1.Length);

                //отправление

                otshet_otpr[number] = s_el.IndexOf(otshet_2, end_otpr[number - 1]);
                begin_otpr[number]  = s_el.IndexOf(begin_2, otshet_otpr[number]);
                end_otpr[number]    = s_el.IndexOf(end_2, begin_otpr[number]);
                lv3.Text            = s_el.Substring(begin_otpr[number] + begin_2.Length, end_otpr[number] - begin_otpr[number] - begin_2.Length);

                time_srvn tsrv = new time_srvn();
                bool      time = tsrv.srvn(lv3.Text);
                if (time == true)
                {
                    lv1.BackColor = Color.Gray;
                }

                //прибытие

                otshet_pr[number] = s_el.IndexOf(otshet_3, end_pr[number - 1]);
                begin_pr[number]  = s_el.IndexOf(begin_3, otshet_pr[number]);
                end_pr[number]    = s_el.IndexOf(end_3, begin_pr[number]);
                lv4.Text          = s_el.Substring(begin_pr[number] + begin_3.Length, end_pr[number] - begin_pr[number] - begin_3.Length);

                //остановки

                begin_ost[number] = s_el.IndexOf(begin_4, end_ost[number - 1]);
                end_ost[number]   = s_el.IndexOf(end_4, begin_ost[number]);
                lv5.Text          = s_el.Substring(begin_ost[number] + begin_4.Length, end_ost[number] - begin_ost[number] - begin_4.Length);


                lv1.SubItems.Add(lv2);
                lv1.SubItems.Add(lv3);
                lv1.SubItems.Add(lv4);
                lv1.SubItems.Add(lv5);
                string rezult = lv2.Text + lv2.Text + lv2.Text + lv2.Text;

                listView1.Items.Add(lv1);
                number += 1;
            }
        }