Esempio n. 1
0
        public async void InitInfo()
        {
            string        url           = "https://localhost:5001/api/route/get?travelId=" + travelId;
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(List <Route>));
            Client        client        = new Client();

            try
            {
                HttpResponseMessage result = await client.Get(url);

                if (result.IsSuccessStatusCode)
                {
                    List <Route> routes = (List <Route>)xmlSerializer.Deserialize(await result.Content.ReadAsStreamAsync());
                    flowLayoutPanel_route.Controls.Clear();

                    foreach (Route route in routes)
                    {
                        UC_Site cell = new UC_Site(changePanel, travelTitle, travelId, route.RouteId, route.StartSiteId);
                        //添加到panel中
                        flowLayoutPanel_route.Controls.Add(cell);
                    }
                }
                else
                {
                    using (Form_Tips tip = new Form_Tips("警告", "获取失败"))
                    {
                        tip.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 2
0
        public UC_AllSites(ChangePanel changePanel, long travelID = -1)
        {
            InitializeComponent();
            this.changePanel = changePanel;
            UC_Site uc_site = new UC_Site(this.changePanel);

            AddControlsToPanel(uc_site, Sitepanel1);
        }
Esempio n. 3
0
        public UC_AllSites()
        {
            InitializeComponent();
            SetFont();
            UC_Site uc_site = new UC_Site();

            AddControlsToPanel(uc_site, Sitepanel1);
        }