Example #1
0
        /// <summary>
        /// 添加地点按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddPlace_Click(object sender, RoutedEventArgs e)
        {
            if (newPlaceNotSave != null)
            {
                MessageBox.Show("新建应急区域未保存,请保存后再继续添加应急区域", "提示消息", MessageBoxButton.OK);
                return;
            }
            ActivityPlaceInfo[]      places     = listPlace.ItemsSource as ActivityPlaceInfo[];
            List <ActivityPlaceInfo> placesList = places.ToList();
            ActivityPlaceInfo        newPlace   = new ActivityPlaceInfo();

            newPlace.ActivityGuid = _activityInfo.Guid;
            newPlace.Guid         = Utility.NewGuid();
            //newPlace.Name = this.txtName.Text;
            newPlace.Name      = cPlaceName;//新建时,先添加默认名称
            newPlace.Locations = new ActivityPlaceLocation[0];
            placesList.Add(newPlace);
            listPlace.ItemsSource  = placesList.ToArray();
            listPlace.SelectedItem = newPlace;
            newPlaceNotSave        = newPlace;
            ActivityMap.PlaceLocation.Add(newPlace.Guid, newPlace);
            InitPlaceInfo();

            this.btnPlaceSave.IsEnabled = true;
        }
        //频率规划
        private void FreqPartPlanShow(ActivityPlaceInfo placeInfo)
        {
            if (placeInfo != null)
            {
                PLaceFreqPlanControl control = new PLaceFreqPlanControl();
                control.DataContext = placeInfo;
                //PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke<I_CO_IA.FreqStation.I_CO_IA_FreqStation>(channel =>
                //    {
                //        var dataSource = channel.GetPlaceFreqPlans(placeInfo.Guid);
                //        if (dataSource != null && dataSource.Length > 0)
                //        {
                //            control.DataContext = new ObservableCollection<PlaceFreqPlan>(dataSource);
                //        }
                //        else
                //        {
                //            control.DataContext = new ObservableCollection<PlaceFreqPlan>();
                //        }
                //    });

                this.borderContent.Child      = control;
                this.borderContent.Visibility = System.Windows.Visibility.Visible;
            }
            //_mapLoadControl.UpSubControl = new FreqPartPlan_Control();
            //this.borderContent.Child = _mapLoadControl;
            //this.borderContent.Visibility = System.Windows.Visibility.Visible;
        }
Example #3
0
 private void LoadPlace(ActivityPlaceInfo placeInfo)
 {
     dicDistanceRangPoints.Clear();
     if (placeInfo != null)
     {
         Dictionary <string, ActivityPlaceInfo> dic = new Dictionary <string, ActivityPlaceInfo>();
         dic.Add(placeInfo.Guid, placeInfo);
         this.activityMap.PlaceLocation = dic;
         this.activityMap.ShowMap.SetAllGraphicsExtent();
         PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqStation.I_CO_IA_FreqStation>(channel =>
         {
             var dataSource = channel.GetPlaceFreqPlans(placeInfo.Guid);
             foreach (var data in dataSource)
             {
                 if (data.RangePointList != null)
                 {
                     this.dicDistanceRangPoints[data.mDistanceToActivityPlace] = new BePolygon {
                         PointList = data.RangePointList
                     };
                 }
             }
             if (dataSource != null && dataSource.Length > 0)
             {
                 this.dataGridFreqRange.ItemsSource = new ObservableCollection <PlaceFreqPlan>(dataSource);
             }
             else
             {
                 this.dataGridFreqRange.ItemsSource = new ObservableCollection <PlaceFreqPlan>();
             }
         });
     }
 }
Example #4
0
        private void AddPlaceFreqPlans(EquipmentClassFreqRange[] checkedFreqRanges, ActivityPlaceInfo placeInfo)
        {
            var freqPlanList = this.dataGridFreqRange.ItemsSource as IList <PlaceFreqPlan>;
            var addFreqPlans = new PlaceFreqPlan[checkedFreqRanges.Length];

            for (int i = 0; i < addFreqPlans.Length; i++)
            {
                addFreqPlans[i] = new PlaceFreqPlan();
                addFreqPlans[i].CopyFrom(checkedFreqRanges[i]);
                addFreqPlans[i].ActivityGuid = placeInfo.ActivityGuid;
                addFreqPlans[i].PlaceGuid    = placeInfo.Guid;
                this.SetDistanceToPlace(addFreqPlans[i], addFreqPlans[i].mDistanceToActivityPlace);
                //var polygon = this.dicDistanceRangPoints[addFreqPlans[i].mDistanceToActivityPlace];
                //addFreqPlans[i].RangePointList = polygon.PointList;
                //var rect = polygon.GetExternalRectangle();
                //addFreqPlans[i].LongitudeRange = new Range<double> { Little = rect.LeftTop.Longitude, Great = rect.RightBottom.Longitude };
                //addFreqPlans[i].LatitudeRange = new Range<double> { Little = rect.RightBottom.Latitude, Great = rect.LeftTop.Latitude };
            }
            PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqStation.I_CO_IA_FreqStation>(channel =>
            {
                channel.SavePlaceFreqPlans(addFreqPlans);
            });
            foreach (var freqPlan in addFreqPlans)
            {
                freqPlanList.Add(freqPlan);
            }
        }
Example #5
0
        /// <summary>
        ///  添加位置按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddLocation_Click(object sender, RoutedEventArgs e)
        {
            ActivityPlaceInfo _placeInfo = (ActivityPlaceInfo)grdPlace.DataContext;

            foreach (ActivityPlaceLocation location in _placeInfo.Locations)
            {
                if (string.IsNullOrEmpty(location.LocationName))
                {
                    MessageBox.Show("位置名称不能为空!", "消息提示", MessageBoxButton.OK);
                    return;
                }
                if (!string.IsNullOrEmpty(location.LocationName) && location.LocationName.Length > 50)
                {
                    MessageBox.Show("位置名称不能超过50个字!", "消息提示", MessageBoxButton.OK);
                    return;
                }
            }
            ActivityPlaceInfo place = grdPlace.DataContext as ActivityPlaceInfo;

            ActivityPlaceLocation[] locations   = dg_LocationList.ItemsSource as ActivityPlaceLocation[];
            ActivityPlaceLocation   newLocation = new ActivityPlaceLocation();

            newLocation.GUID = Utility.NewGuid();
            newLocation.ActivityPlaceGuid          = place.Guid;
            newLocation.activityPlaceLocationImage = new List <ActivityPlaceLocationImage>();
            List <ActivityPlaceLocation> listLocation = locations.ToList();

            listLocation.Add(newLocation);
            locations = listLocation.ToArray();
            dg_LocationList.ItemsSource = locations;
        }
        /// <summary>
        /// 调用绘制编辑界面
        /// </summary>
        public void ShowEditMap()
        {
            if (string.IsNullOrEmpty(_currentPlaceId))
            {
                MessageBox.Show("当前没有选择的区域!");
                return;
            }
            MapEdit = new UMap(this);
            MapEdit.mapGis.MainMap.ServiceUrl = RiasPortal.Current.MapConfig.ElectricUrl;
            MapEdit.mapGis.ShowBar            = true;
            MapEdit.mapGis.MapInitialized    += ((b) => {
                if (_placeLocation.ContainsKey(_currentPlaceId))
                {
                    ActivityPlaceInfo placeInfo = _placeLocation[_currentPlaceId] as ActivityPlaceInfo;
                    if (placeInfo != null)
                    {
                        MapEdit.mapGis.DrawArea(_currentPlaceId, placeInfo.Graphics);
                    }
                    MapEdit.mapGis.SetAllGraphicsExtent();
                    MapEdit.mapGis.BarGraphicChange(true);
                }
            });

            MapEdit.ShowDialog();
        }
Example #7
0
        /// <summary>
        /// 保存地点按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlaceSave_Click(object sender, RoutedEventArgs e)
        {
            if (listPlace.Items.Count <= 0)
            {
                return;
            }
            ActivityPlaceInfo _placeInfo = (ActivityPlaceInfo)grdPlace.DataContext;

            _placeInfo.Graphics = ActivityMap.PlaceLocation[_placeInfo.Guid].Graphics;
            if (ValidatedPlace(_placeInfo))
            {
                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.ActivityManage.I_CO_IA_ActivityManage>(
                    channel =>
                {
                    if (channel.ValidationPlaceName(_placeInfo))
                    {
                        channel.SavePlaceInfo(_placeInfo);
                        MessageBox.Show("保存成功", "提示", MessageBoxButton.OK);
                        if (newPlaceNotSave != null)
                        {
                            newPlaceNotSave = null;
                        }
                        InitPlaceList();
                    }
                    else
                    {
                        MessageBox.Show("该活动区域名称已存在,请修改后重新保存。", "提示", MessageBoxButton.OK);
                    }
                });
            }
        }
Example #8
0
        /// <summary>
        /// 删除地点按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelPlace_Click(object sender, RoutedEventArgs e)
        {
            ActivityPlaceInfo place = listPlace.SelectedItem as ActivityPlaceInfo;

            if (place == null)
            {
                MessageBox.Show("请选中地点后再删除", "提示", MessageBoxButton.OK);
                return;
            }
            PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.ActivityManage.I_CO_IA_ActivityManage>(
                channel =>
            {
                try
                {
                    channel.DeletePlaceInfo(place.Guid);
                    MessageBox.Show("删除成功", "提示", MessageBoxButton.OK);
                    if (newPlaceNotSave != null)
                    {
                        newPlaceNotSave = null;
                    }
                    InitPlaceList();
                    listPlace.SelectedIndex = 0;
                    InitPlaceInfo();
                }
                catch
                {
                    MessageBox.Show("删除失败,此地点已有子记录,无法删除", "提示", MessageBoxButton.OK);
                }
            });
        }
Example #9
0
        /// <summary>
        /// 列表中被选中的地点改变后重新绑定右侧显示的地点信息
        /// </summary>
        private void selectPlaceChanged()
        {
            //列表中选中的地点
            ActivityPlaceInfo _placeInfo = listPlace.SelectedItem as ActivityPlaceInfo;
            //右侧显示的地点
            ActivityPlaceInfo place = grdPlace.DataContext as ActivityPlaceInfo;

            //如果选中的项没有改变时,不刷新右侧显示的地点,只有改变时才刷新
            if (_placeInfo != null && place != null && _placeInfo.Guid != place.Guid)
            {
                //如果新建的地点信息没有保存,在选项改变后没有保存的项消失
                if (newPlaceNotSave != null)
                {
                    if (newPlaceNotSave.Guid != _placeInfo.Guid)
                    {
                        grdPlace.DataContext = null;
                        ActivityPlaceInfo[]      _places    = listPlace.ItemsSource as ActivityPlaceInfo[];
                        List <ActivityPlaceInfo> _placeList = _places.ToList();
                        _placeList.Remove(newPlaceNotSave);
                        listPlace.ItemsSource = _placeList.ToArray();
                        newPlaceNotSave       = null;
                    }
                }
                //重新刷新右侧显示的地点信息
                InitPlaceInfo();
            }
        }
Example #10
0
        /// <summary>
        /// 添加地点按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddPlace_Click(object sender, RoutedEventArgs e)
        {
            //PlaceManageDialog placeManage = new PlaceManageDialog(_activityInfo.Guid);
            //placeManage.RefreshPlaceListEvent += () => { InitPlaceList(); };
            //placeManage.ShowDialog();
            if (newPlaceNotSave != null)
            {
                MessageBox.Show("新建地点未保存,请保存后再继续添加地点", "提示", MessageBoxButton.OK);
                return;
            }
            ActivityPlaceInfo[] places = listPlace.ItemsSource as ActivityPlaceInfo[];
            if (places != null && places.Length >= 10)
            {
                MessageBox.Show("活动区域最大数量为10。", "消息提示", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            List <ActivityPlaceInfo> placesList = places.ToList();
            ActivityPlaceInfo        newPlace   = new ActivityPlaceInfo();

            newPlace.ActivityGuid = _activityInfo.Guid;
            newPlace.Guid         = Utility.NewGuid();
            newPlace.Name         = "新建活动区域";
            newPlace.Locations    = new ActivityPlaceLocation[0];
            placesList.Add(newPlace);
            listPlace.ItemsSource  = placesList.ToArray();
            listPlace.SelectedItem = newPlace;
            newPlaceNotSave        = newPlace;
            ActivityMap.PlaceLocation.Add(newPlace.Guid, newPlace);
            InitPlaceInfo();
        }
        public void iniData()
        {
            Obj.screenMap.MainMap.DefaultLayer.OnGraphicsMouseRightButtonUp += DefaultLayer_OnGraphicsMouseRightButtonUp;
            Obj.AreaGraphicInfo.Clear();
            cmbAreas.Items.Clear();
            ActivityPlaceInfo defaultSelect = new ActivityPlaceInfo()
            {
                Name = "全部区域"
            };

            defaultSelect.Image = ClientHelper.ResourceImageToBytes("pack://application:,,,/CO_IA.Themes;component/ActivityTypeImages/defaultActivity.png");
            cmbAreas.Items.Add(defaultSelect);

            if (Obj.ActivityPlaces != null && Obj.ActivityPlaces.Length > 0)
            {
                foreach (var item in Obj.ActivityPlaces)
                {
                    cmbAreas.Items.Add(item);
                    //此处绘制区域图形
                    ReturnDrawGraphicInfo[] infos = Obj.screenMap.DrawArea(MapGroupTypes.AreaRange_.ToString() + item.Guid, item.Graphics);
                    Obj.AreaGraphicInfo.Add(item.Guid, infos);
                    //画地点
                    Obj.screenMap.DrawLocation(item.Locations);
                }
                //Obj.screenMap.SetAllAreaGraphicsExtent();
            }
            cmbAreas.SelectedIndex = 0;
        }
Example #12
0
        private void SurroundStationClearResultControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var activityPlace = e.NewValue as ActivityPlaceInfo;

            currentPlace = activityPlace;
            this.LoadStationClearResult();
        }
Example #13
0
 public EquipmentInspectionManageControl(ActivityPlaceInfo pActivityPlaceInfo)
 {
     InitializeComponent();
     CurrentActivityPlace = pActivityPlaceInfo;
     equipmentInspectionListControl.EquInspectionSelectionChanged += equipmentInspectionListControl_EquInspectionSelectionChanged;
     GetEquInspections(QueryCondition);
 }
 private void cmbAreas_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cmbAreas.SelectedItem != null)
     {
         ActivityPlaceInfo SelectItem = cmbAreas.SelectedItem as ActivityPlaceInfo;
         if (SelectItem != null)
         {
             //Obj.screenMap.RemoveElementByFlag(MapGroupTypes.Location_.ToString());
             //Obj.screenMap.RemoveSymbolElementByFlag(MapGroupTypes.Location_.ToString());
             if (SelectItem.Name == "全部区域")
             {
                 Obj.SelectedAreaID = "";
                 Obj.screenMap.SetElementVisibilityByFlag(MapGroupTypes.Location_.ToString(), true);
             }
             else
             {
                 Obj.SelectedAreaID = SelectItem.Guid;
                 Obj.screenMap.SetElementVisibilityByFlag(MapGroupTypes.Location_.ToString(), false);
                 foreach (var location in SelectItem.Locations)
                 {
                     Obj.screenMap.SetElementVisibilityByID(MapGroupTypes.Location_.ToString() + location.GUID, true);
                 }
             }
             if (AreaChange != null)
             {
                 AreaChange(SelectItem);
             }
         }
     }
 }
Example #15
0
        /// <summary>
        /// 保存地点按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlaceSave_Click(object sender, RoutedEventArgs e)
        {
            ActivityPlaceInfo _placeInfo = (ActivityPlaceInfo)grdPlace.DataContext;

            _placeInfo.Name    = this.txtName.Text;
            _placeInfo.Address = this.txtAddress.Text;
            _placeInfo.Contact = this.txtContact.Text;
            _placeInfo.Phone   = this.txtPhone.Text;
            //ActivityPlaceInfo _placeInfo = listPlace.SelectedItem as ActivityPlaceInfo;

            _placeInfo.Graphics = ActivityMap.PlaceLocation[_placeInfo.Guid].Graphics;
            if (ValidatedPlace(_placeInfo))
            {
                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.ActivityManage.I_CO_IA_ActivityManage>(
                    channel =>
                {
                    channel.SavePlaceInfo(_placeInfo);
                    MessageBox.Show("保存成功", "提示", MessageBoxButton.OK);
                    if (newPlaceNotSave != null)
                    {
                        newPlaceNotSave = null;
                    }
                    InitPlaceList();
                });
            }
        }
Example #16
0
        //public System.Drawing.Bitmap SmallPic(string strOldPic, int intHeight)
        //{
        //    int intWidth = 0;
        //    System.Drawing.Bitmap objPic, objNewPic;
        //    try
        //    {
        //        objPic = new System.Drawing.Bitmap(strOldPic);
        //        intWidth = Convert.ToInt32(((double)intHeight / objPic.Size.Height) * objPic.Size.Width);
        //        if (objPic.Size.Width < intWidth || objPic.Size.Height < intHeight)
        //        {
        //            return null;
        //        }
        //        objNewPic = new System.Drawing.Bitmap(objPic, intWidth, intHeight);

        //    }
        //    catch (Exception exp)
        //    { throw exp; }
        //    return objNewPic;
        //}

        /// <summary>
        /// 上传地点图片事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void placeImg_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            ActivityPlaceInfo place = this.listPlace.SelectedValue as ActivityPlaceInfo;

            if (place == null)
            {
                return;
            }
            //ActivityPlaceInfo place = grdPlace.DataContext as ActivityPlaceInfo;
            OpenFileDialog ofd = new OpenFileDialog();              //打开选择文件窗口

            ofd.Filter = "jpg|*.jpg|png|*.png|bmp|*.bmp|gif|*.gif"; //过滤器
            if (ofd.ShowDialog() == true)
            {
                string fileName = ofd.FileName;            //获得文件的完整路径
                place.Image = File.ReadAllBytes(fileName); //把图像的二进制数据存储到emp的Photo属性中
                //System.Windows.Controls.Image img = sender as System.Windows.Controls.Image;
                //Grid g = img.Parent as Grid;
                //foreach (var item in g.Children)
                //{
                //    if (item is System.Windows.Controls.Image)
                //    {
                //        System.Windows.Controls.Image image = item as System.Windows.Controls.Image;
                //        image.Source = new BitmapImage(new Uri(fileName));
                //        break;
                //    }
                //}
                //placeImg.Source = new BitmapImage(new Uri(fileName));//将图片显示到Image控件上
            }
        }
Example #17
0
        /// <summary>
        /// 初始化右侧地点信息
        /// </summary>
        private void InitPlaceInfo()
        {
            ActivityPlaceInfo place = listPlace.SelectedItem as ActivityPlaceInfo;

            if (place != null)
            {
                ActivityPlaceInfo _placeInfo = new ActivityPlaceInfo();

                _placeInfo.Guid         = place.Guid;
                _placeInfo.ActivityGuid = place.ActivityGuid;
                _placeInfo.Name         = place.Name;
                _placeInfo.Image        = place.Image;
                _placeInfo.Address      = place.Address;
                _placeInfo.Contact      = place.Contact;
                _placeInfo.Phone        = place.Phone;
                _placeInfo.Graphics     = place.Graphics;
                _placeInfo.Locations    = (ActivityPlaceLocation[])place.Locations.Clone();

                grdPlace.DataContext = _placeInfo;

                //选中地点时选中图形 xiaguohui
                //test
                ActivityMap.CurrentPlaceId = _placeInfo.Guid;
            }
            else
            {
                ActivityMap.CurrentPlaceId = "";
            }
        }
Example #18
0
        /// <summary>
        /// 添加地点按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddPlace_Click(object sender, RoutedEventArgs e)
        {
            //PlaceManageDialog placeManage = new PlaceManageDialog(_activityInfo.Guid);
            //placeManage.RefreshPlaceListEvent += () => { InitPlaceList(); };
            //placeManage.ShowDialog();
            if (newPlaceNotSave != null)
            {
                MessageBox.Show("新建考试区域未保存,请保存后再继续添加考试区域", "提示消息", MessageBoxButton.OK);
                return;
            }
            //if (this.txtName.Text == "")
            //{
            //    MessageBox.Show("请输入考点名称", "提示消息", MessageBoxButton.OK);
            //    return;
            //}
            ActivityPlaceInfo[]      places     = listPlace.ItemsSource as ActivityPlaceInfo[];
            List <ActivityPlaceInfo> placesList = places.ToList();
            ActivityPlaceInfo        newPlace   = new ActivityPlaceInfo();

            newPlace.ActivityGuid = _activityInfo.Guid;
            newPlace.Guid         = Utility.NewGuid();
            //newPlace.Name = this.txtName.Text;
            newPlace.Name      = cExamName;//新建考点时,先添加默认名称
            newPlace.Locations = new ActivityPlaceLocation[0];
            placesList.Add(newPlace);
            listPlace.ItemsSource  = placesList.ToArray();
            listPlace.SelectedItem = newPlace;
            newPlaceNotSave        = newPlace;
            ActivityMap.PlaceLocation.Add(newPlace.Guid, newPlace);
            InitPlaceInfo();

            this.btnPlaceSave.IsEnabled = true;
        }
 public SurroundStationDialog(ActivityPlaceInfo pActivityPlace)
 {
     InitializeComponent();
     CurrentActivityPlace        = pActivityPlace;
     mapcontrol.CurrentPlaceInfo = CurrentActivityPlace;
     surroundStationListControl.StationSelectionChanged += surroundStationListControl_StationSelectionChanged;
     QuerySurroundStationFromDB();
 }
Example #20
0
 public ActivityListDialog(ActivityPlaceInfo p_activityPlace)
 {
     InitializeComponent();
     _activityPlace = p_activityPlace;
     //获取对应地点的活动位置信息
     ActivityPlaceLocation[] getLocations = _activityPlace.Locations;
     listPlace.ItemsSource = getLocations.ToList();
 }
        public SurroundStationAnalyseManage(ActivityPlaceInfo acvtivityplace)
        {
            InitializeComponent();
            CurrentActivityPlace        = acvtivityplace;
            mapcontrol.CurrentPlaceInfo = CurrentActivityPlace;
            QuerySurroundStations();

            surroundStationListControl.StationSelectionChanged += surroundStationListControl_StationSelectionChanged;
        }
Example #22
0
        /// <summary>
        /// 列表中的项被点击时的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListBoxItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //当列表中的项被点击时,设置列表选中这行数据
            var item = e.Source as ListBoxItem;
            ActivityPlaceInfo _placeInfo = item.DataContext as ActivityPlaceInfo;

            listPlace.SelectedItem = _placeInfo;
            AddressSelectionChanged(_placeInfo);
        }
        /// <summary>
        /// 绘制地点
        /// </summary>
        /// <param name="mapgis"></param>
        private void DrawPlace(MapGIS mapgis = null)
        {
            if (_placeLocation != null && _placeLocation.Count > 0)
            {
                if (mapgis == null)
                {
                    mapgis = ShowMap;
                }

                mapgis.MapInitialized += ((b) =>
                {
                    if (!b)
                    {
                        return;
                    }
                    mapgis.RemoveSymbolElementByFlag(MapGroupTypes.AreaRange_.ToString());
                    mapgis.RemoveElementByFlag(MapGroupTypes.Location_.ToString());
                    foreach (var itm in _placeLocation)
                    {
                        ActivityPlaceInfo placeInfo = itm.Value as ActivityPlaceInfo;
                        if (placeInfo != null)
                        {
                            mapgis.DrawArea(MapGroupTypes.AreaRange_.ToString() + itm.Key, placeInfo.Graphics);
                            if (placeInfo.Locations != null && placeInfo.Locations.Length > 0)
                            {
                                mapgis.DrawLocation(placeInfo.Locations);
                            }
                        }
                    }
                    if (_currentPlaceId != "")
                    {
                        CurrentPlaceId = _currentPlaceId;
                    }
                });
                if (mapgis.initialized)
                {
                    mapgis.RemoveSymbolElementByFlag(MapGroupTypes.AreaRange_.ToString());
                    mapgis.RemoveElementByFlag(MapGroupTypes.Location_.ToString());
                    foreach (var itm in _placeLocation)
                    {
                        ActivityPlaceInfo placeInfo = itm.Value as ActivityPlaceInfo;
                        if (placeInfo != null)
                        {
                            mapgis.DrawArea(MapGroupTypes.AreaRange_.ToString() + itm.Key, placeInfo.Graphics);
                            if (placeInfo.Locations != null && placeInfo.Locations.Length > 0)
                            {
                                mapgis.DrawLocation(placeInfo.Locations);
                            }
                        }
                    }
                    if (_currentPlaceId != "")
                    {
                        CurrentPlaceId = _currentPlaceId;
                    }
                }
            }
        }
        /// <summary>
        /// 绘制选择的位置图形
        /// </summary>
        private void SelectedPlace()
        {
            //if (!ShowMap.DrawList.Where(itm => itm.Key.StartsWith(MapGroupTypes.AreaRange_.ToString())).Any())
            //{
            //    if (ShowMap.DrawElementList.Count > 0)
            //    {

            //    }
            //    return;
            //}
            var item = ShowMap.DrawList.Where(itm => itm.Key.StartsWith("selected_")).ToList();

            if (item.Count > 0)
            {
                item.ForEach(g => ShowMap.RemoveSymbolElement(g.Key));
            }

            if (!string.IsNullOrEmpty(_currentPlaceId))
            {
                if (_placeLocation.ContainsKey(_currentPlaceId))
                {
                    ActivityPlaceInfo placeInfo = _placeLocation[_currentPlaceId] as ActivityPlaceInfo;
                    if (placeInfo != null)
                    {
                        MapExtent extent = null;
                        if (placeInfo.Graphics != null)
                        {
                            ShowMap.DrawArea("selected_" + _currentPlaceId, placeInfo.Graphics);
                            extent = ShowMap.GetGraphicExtentByID(new string[] { MapGroupTypes.AreaRange_.ToString() + _currentPlaceId });
                        }
                        else
                        {
                            if (placeInfo.Locations != null && placeInfo.Locations.Length > 0)
                            {
                                List <string> ids = new List <string>();
                                foreach (var location in placeInfo.Locations)
                                {
                                    ids.Add(MapGroupTypes.Location_.ToString() + location.GUID);
                                }
                                extent = ShowMap.GetGraphicExtentByID(ids.ToArray());
                            }
                        }
                        if (extent != null && extent.Xy1.X != 0)
                        {
                            ShowMap.setExtent(new AT_BC.Data.GeoPoint()
                            {
                                Longitude = extent.Xy1.X, Latitude = extent.Xy1.Y
                            }, new AT_BC.Data.GeoPoint()
                            {
                                Longitude = extent.Xy2.X, Latitude = extent.Xy2.Y
                            }, true);
                        }
                    }
                }
            }
        }
 public ORGAndEquipmentManage(ActivityPlaceInfo avtivityplace)
 {
     InitializeComponent();
     this.CurrentActivityPlace      = avtivityplace;
     this.CurrentActivity           = RiasPortal.ModuleContainer.Activity;
     orgquerycondition.ActivityGuid = CurrentActivity.Guid;
     InitQueryCondition(eququerycondition);
     GetActivityOrgs(orgquerycondition);
     InitEvent();
 }
 public CreateTaskDialog(DetailMonitorPlan p_task, ActivityPlaceInfo p_placeinfo)
 {
     InitializeComponent();
     _beginDate.SelectedDate = DateTime.Now;
     _endDate.SelectedDate   = DateTime.Now;
     activityGuid            = p_task.ACTIVITY_GUID;
     this._currentTask       = p_task;
     this._currentPlace      = p_placeinfo;
     this.DataContext        = _currentTask;
 }
 private void ClearStationShow(ActivityPlaceInfo placeInfo)
 {
     if (placeInfo != null)
     {
         SurroundStationClearResultControl control = new SurroundStationClearResultControl();
         control.DataContext           = placeInfo;
         this.borderContent.Child      = control;
         this.borderContent.Visibility = System.Windows.Visibility.Visible;
     }
 }
Example #28
0
        /// <summary>
        /// 列表中的项被点击时的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListBoxItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //当列表中的项被点击时,设置列表选中这行数据
            //var item =e.Source as ListBoxItem;
            ActivityPlaceInfo _placeInfo = (e.Source as FrameworkElement).DataContext as ActivityPlaceInfo;

            listPlace.SelectedItem = _placeInfo;
            //重新绑定右侧显示的地点信息
            selectPlaceChanged();
        }
Example #29
0
        /// <summary>
        /// 保存地点前验证地点信息
        /// </summary>
        /// <param name="_placeInfo"></param>
        /// <returns></returns>
        private bool ValidatedPlace(ActivityPlaceInfo _placeInfo)
        {
            bool          IsSuccess = true;
            StringBuilder strmsg    = new StringBuilder();

            if (string.IsNullOrEmpty(_placeInfo.Name))
            {
                strmsg.Append("地点名称不能为空! \r");
                IsSuccess = false;
            }
            if (!string.IsNullOrEmpty(_placeInfo.Name) && _placeInfo.Name.Length > 100)
            {
                strmsg.Append("地点名称不能超过100个字! \r");
                IsSuccess = false;
            }
            if (!string.IsNullOrEmpty(_placeInfo.Address) && _placeInfo.Address.Length > 100)
            {
                strmsg.Append("地址不能超过100个字! \r");
                IsSuccess = false;
            }
            if (!string.IsNullOrEmpty(_placeInfo.Contact) && _placeInfo.Contact.Length > 10)
            {
                strmsg.Append("联系人不能超过10个字! \r");
                IsSuccess = false;
            }
            if (!string.IsNullOrEmpty(_placeInfo.Phone) && _placeInfo.Phone.Length > 20)
            {
                strmsg.Append("联系电话不能超过20个字! \r");
                IsSuccess = false;
            }
            //if (_placeInfo.Phone != null && !System.Text.RegularExpressions.Regex.IsMatch(_placeInfo.Phone, @"^[1]+\d{10}"))
            //{
            //    strmsg.Append("联系电话格式不正确! \r");
            //    IsSuccess = false;
            //}
            foreach (ActivityPlaceLocation location in _placeInfo.Locations)
            {
                if (string.IsNullOrEmpty(location.LocationName))
                {
                    strmsg.Append("位置名称不能为空! \r");
                    IsSuccess = false;
                }
                if (!string.IsNullOrEmpty(location.LocationName) && location.LocationName.Length > 50)
                {
                    strmsg.Append("位置名称不能超过50个字! \r");
                    IsSuccess = false;
                }
            }

            if (!string.IsNullOrEmpty(strmsg.ToString()))
            {
                MessageBox.Show(strmsg.ToString(), "提示", MessageBoxButton.OK);
            }
            return(IsSuccess);
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(value);
            }
            //GroupAndLocation group = value as GroupAndLocation;
            ActivityPlaceInfo getOrgPlaceinfo = PrototypeDatas.GetPlaceInfo(value.ToString());

            return(getOrgPlaceinfo.Name);
        }