コード例 #1
0
        /// <summary>
        /// 载入地图信息
        /// </summary>
        private void MapLoad()
        {
            MapInstrument.keyValuePairs.Clear();
            MapInstrument.valuePairs.Clear();
            MapInstrument.wirePointArrays.Clear();
            MapInstrument.GetKeyValues.Clear();
            Painting.siseWin    = 1;
            SliMax.Value        = 0;
            SubmitPro.IsEnabled = false;
            DelPro.IsEnabled    = false;
            MapMessageBLL messageBLL = new MapMessageBLL();
            DataTable     da         = messageBLL.GetMapData(null);

            if (da == null)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Content = "请选择";
                maplist.Items.Add(item);
                SubmitPro.IsEnabled = false;
                DelPro.IsEnabled    = false;
            }
            else
            {
                foreach (DataRow data in da.Rows)
                {
                    ComboBoxItem ite = new ComboBoxItem();
                    ite.Content = data["Name"].ToString();
                    ite.Tag     = data["Width"].ToString() + "," + data["Height"].ToString() + "," + data["CreateTime"].ToString();
                    maplist.Items.Add(ite);
                }
            }
            maplist.SelectedIndex = 0;
        }
コード例 #2
0
ファイル: Main.xaml.cs プロジェクト: Rocinante-Poet/AGV
        /// <summary>
        /// 载入地图信息
        /// </summary>
        private void MapLoad()
        {
            MapMessageBLL messageBLL = new MapMessageBLL();
            DataTable     da         = messageBLL.GetMapData(null);
            string        Times      = mapMessage.SettingInfoMap();

            this.Dispatcher.Invoke(new Action(() =>
            {
                if (da == null)
                {
                    ComboBoxItem item = new ComboBoxItem();
                    item.Content      = "请选择";
                    Maplistq.Items.Add(item);
                    Maplistq.SelectedIndex = 0;
                }
                else
                {
                    int Index         = 0;
                    int s             = 0;
                    ComboBoxItem item = new ComboBoxItem();
                    item.Content      = "请选择";
                    Maplistq.Items.Add(item);
                    foreach (DataRow data in da.Rows)
                    {
                        if (Times != null)
                        {
                            if (Times.Equals(data["CreateTime"].ToString()))
                            {
                                Index = s;
                            }
                        }
                        ComboBoxItem ite = new ComboBoxItem();
                        ite.Content      = data["Name"].ToString();
                        ite.Tag          = data["Width"].ToString() + "," + data["Height"].ToString() + "," + data["CreateTime"].ToString();
                        Maplistq.Items.Add(ite);
                        s++;
                    }
                    mapSelect = true;
                    Maplistq.SelectedIndex = Index + 1;
                }
            }));
        }
コード例 #3
0
        /// <summary>
        /// 地图选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Maplist_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (((ComboBoxItem)maplist.SelectedItem).Tag == null)
            {
                return;
            }
            SliMax.Value             = 0;
            SubmitPro.IsEnabled      = true;
            DelPro.IsEnabled         = true;
            EditlineData.ItemsSource = new DataTable().DefaultView;
            lineRo.Items.Clear();
            MapMessageBLL messageBLL = new MapMessageBLL();
            string        ls         = ((ComboBoxItem)maplist.SelectedItem).Tag.ToString();

            string[] arr = ls.Split(',');
            dtRoute = messageBLL.BLLMapRoute(arr[2]);
            if (dtRoute.Rows.Count == 0)
            {
                ComboBoxItem item = new ComboBoxItem {
                    Content = "请选择"
                };
                lineRo.Items.Add(item);
                SubmitPro.IsEnabled = false;
                DelPro.IsEnabled    = false;
            }
            else
            {
                ComboBoxItem item = new ComboBoxItem {
                    Content = "请选择"
                };
                lineRo.Items.Add(item);
                foreach (DataRow data in dtRoute.Rows)
                {
                    ComboBoxItem ite = new ComboBoxItem();
                    ite.Content = data["Name"].ToString();
                    ite.Tag     = data["Program"].ToString();
                    lineRo.Items.Add(ite);
                }
            }
            lineRo.SelectedIndex = 0;

            if (!maplist.Text.Equals("请选择") && ((ComboBoxItem)maplist.SelectedItem).Tag.ToString().Split(',').Count().Equals(3))
            {
                //线路
                MapInstrument.keyValuePairs.Clear();
                MapInstrument.valuePairs.Clear();
                MapInstrument.wirePointArrays.Clear();
                MapInstrument.GetKeyValues.Clear();
                Painting.siseWin = 1;
                int six = Convert.ToInt32(SliMax.Value.ToString("G3"));
                Painting.siseWin = six.Equals(0) ? 1 : six;
                MapIN.Children.Clear();
                string   lss  = ((ComboBoxItem)maplist.SelectedItem).Tag.ToString();
                string[] aarr = lss.Split(',');
                mpWidth       = Convert.ToDouble(aarr[0]) * manag.Sise;
                mpHeight      = Convert.ToDouble(aarr[1]) * manag.Sise;
                MapIN.Width   = mpWidth;
                MapIN.Height  = mpHeight;
                Times         = long.Parse(aarr[2]);
                manag.Times   = Times;
                manag.GetData = EditlineData;
                manag.SelectMap(long.Parse(aarr[2]), MapIN, true);
            }
        }