Пример #1
0
 private void itemTrack_Click(object sender, RoutedEventArgs e)
 {
     if (tv_PersonPlan.SelectedItem != null)
     {
         PP_OrgInfo orgInfo = tv_PersonPlan.SelectedItem as PP_OrgInfo;
         if (orgInfo != null)
         {
             //先查有没有车,或者车牌
             PP_VehicleInfo itemVehicle = null;
             PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.PersonSchedule.I_CO_IA_PersonSchedule>(channel =>
             {
                 //更新当前节点
                 itemVehicle = channel.GetPP_VehicleInfo(orgInfo.GUID);
             });
             if (itemVehicle != null && !string.IsNullOrEmpty(itemVehicle.VEHICLE_NUMB))
             {
                 OrgToMapStyle        group    = new OrgToMapStyle(orgInfo);
                 Track.TrackCondition conTrack = new Track.TrackCondition(group);
                 conTrack.VehicleNum = itemVehicle.VEHICLE_NUMB;
                 conTrack.Owner      = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(this);
                 conTrack.Show();
             }
             else
             {
                 MessageBox.Show("没有查询到车辆信息!");
             }
         }
     }
 }
Пример #2
0
        private void SelectImg_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Image img      = sender as Image;
            var   groupBox = VisualTreeHelperExtension.GetParentObject <DevExpress.Xpf.LayoutControl.GroupBox>(img);
            ActivityPlaceLocationImageView gpv = groupBox.DataContext as ActivityPlaceLocationImageView;

            if (gpv.GUID == "add")
            {
                LocationImageDialog imgDialog = new LocationImageDialog();
                if (imgDialog.ShowDialog(this) == true)
                {
                    imgDialog.EditView.ACTIVITY_PLACE_LOCATION_GUID = locationGuid;
                    viewList.Insert(viewList.Count - 1, imgDialog.EditView);

                    ActivityPlaceLocationImage newitem = new ActivityPlaceLocationImage();
                    newitem.GUID      = imgDialog.EditView.GUID;
                    newitem.ImageName = imgDialog.EditView.ImageName;
                    newitem.TYPE      = imgDialog.EditView.TYPE;
                    newitem.Image     = imgDialog.EditView.Image;
                    newitem.ACTIVITY_PLACE_LOCATION_GUID = imgDialog.EditView.ACTIVITY_PLACE_LOCATION_GUID;
                    ActivityPlaceLocationImageList.Add(newitem);

                    RefreshList();
                }
            }
        }
        /// <summary>
        /// 放大和缩小
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GroupBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Image img      = sender as Image;
            var   groupBox = VisualTreeHelperExtension.GetParentObject <DevExpress.Xpf.LayoutControl.GroupBox>(img);

            groupBox.State = groupBox.State == GroupBoxState.Normal ? GroupBoxState.Maximized : GroupBoxState.Normal;
        }
Пример #4
0
        /// <summary>
        /// 查看移动轨迹
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void itemTrack_Click(object sender, RoutedEventArgs e)
        {
            MenuItem    item   = sender as MenuItem;
            ContextMenu menu   = item.Parent as ContextMenu;
            var         target = menu.PlacementTarget as OrgToMapStyle;

            if (target != null)
            {
                PP_OrgInfo orgInfo = target.OrgInfo;
                //先查有没有车,或者车牌
                PP_VehicleInfo itemVehicle = null;
                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.PersonSchedule.I_CO_IA_PersonSchedule>(channel =>
                {
                    //更新当前节点
                    itemVehicle = channel.GetPP_VehicleInfo(orgInfo.GUID);
                });
                if (itemVehicle != null && !string.IsNullOrEmpty(itemVehicle.VEHICLE_NUMB))
                {
                    OrgToMapStyle        group    = new OrgToMapStyle(orgInfo);
                    Track.TrackCondition conTrack = new Track.TrackCondition(group);
                    conTrack.VehicleNum = itemVehicle.VEHICLE_NUMB;
                    conTrack.Owner      = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(Element);
                    conTrack.Show();
                }
                else
                {
                    MessageBox.Show("没有查询到车辆信息!");
                }
            }
        }
Пример #5
0
        private void ListBoxItem_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                ListBoxItem item = e.Source as ListBoxItem;
                if (item != null && item.DataContext is ActivityPlace)
                {
                    ActivityPlace place   = item.DataContext as ActivityPlace;
                    var           listBox = VisualTreeHelperExtension.GetParentObject <ListBox>(item);
                    if (listBox != null && place != null)
                    {
                        ActivityExt activity = listBox.DataContext as ActivityExt;
                        var         userInfo = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA_PersonSchedule, PP_OrgInfo>(channel =>
                        {
                            return(channel.GetPP_OrgInfoByPersonID(RiasPortal.Current.UserSetting.UserID, activity.Guid));
                        });
                        if (userInfo != null && !string.IsNullOrEmpty(userInfo.GUID))
                        {
                            //SystemLoginService.UserOrgInfo = userInfo;
                            //SystemLoginService.CurrentActivity = activity;
                            //SystemLoginService.CurrentActivityPlace = place;

                            this.OpenActivityPlace(activity, place, userInfo);
                        }
                        else
                        {
                            MessageBox.Show("无法打开活动,未能加载当前用户在该活动中的信息");
                        }
                    }
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Retrieves all the logic controls in the user interface and generates a variable declaration that match the control name.
        /// </summary>
        /// <returns>Returns a list of <see cref="ControlAccessorDeclaration"/> that must be use in the global scope.</returns>
        private IEnumerable <ControlAccessorDeclaration> AddControlAccessors()
        {
            var controlAccessors = new List <ControlAccessorDeclaration>();

            if (_parsedXamlRoot == null)
            {
                return(controlAccessors);
            }

            var action = new Action <FrameworkElement>((control) =>
            {
                if (string.IsNullOrWhiteSpace(control.Name))
                {
                    return;
                }

                var controlAccessor = new ControlAccessorDeclaration(control.Name);
                AddVariableToScope(controlAccessor.Variable, true);
                controlAccessors.Add(controlAccessor);
            });

            VisualTreeHelperExtension.ProcessLogicalTree(_parsedXamlRoot, action);

            return(controlAccessors);
        }
Пример #7
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            var selecter = VisualTreeHelperExtension.Ancestors(this).OfType <MyMultiSelecter>().First();

            selecter.NotifyItemMouseDown(this);
        }
Пример #8
0
        private void Img_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //var groupBox = (DevExpress.Xpf.LayoutControl.GroupBox)sender;
            Image img      = sender as Image;
            var   groupBox = VisualTreeHelperExtension.GetParentObject <DevExpress.Xpf.LayoutControl.GroupBox>(img);
            ActivityPlaceLocationImageView gpv = groupBox.DataContext as ActivityPlaceLocationImageView;

            groupBox.State = groupBox.State == GroupBoxState.Normal ? GroupBoxState.Maximized : GroupBoxState.Normal;
        }
Пример #9
0
 private void ResetCurrentTabScroll()
 {
     foreach (var scrollViewer in VisualTreeHelperExtension.EnumerateAllChildsOfType <ScrollViewer>(
                  (Visual)this.tabControl.SelectedContent))
     {
         scrollViewer.ScrollToTop();
         break;
     }
 }
Пример #10
0
        /// <summary>
        /// 周围监测设施
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void itemArroundSation_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;

            if (item != null && item.Tag != null)
            {
                string AreaId = item.Tag.ToString();
                Dialog.SurroundStationDialog stationDialog = new Dialog.SurroundStationDialog(AreaId);
                stationDialog.Owner = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(this);
                stationDialog.Show();
            }
        }
        private static void InjectControl(Control control, IViewModelWithRecipe viewModel)
        {
            var windowWrapper = VisualTreeHelperExtension.FindParentOfType(control, typeof(BaseUserControlWithWindow));
            var window        = ((BaseUserControlWithWindow)windowWrapper).Window;

            var controlRecipeBreakdown = new ControlRecipeBreakdown();

            controlRecipeBreakdown.InheritedViewModel = viewModel;

            InjectedControls.Add(control, controlRecipeBreakdown);
            window.AddExtensionControl(controlRecipeBreakdown);
        }
Пример #12
0
        private void itemInfo_Click(object sender, RoutedEventArgs e)
        {
            MenuItem    item   = sender as MenuItem;
            ContextMenu menu   = item.Parent as ContextMenu;
            var         target = menu.PlacementTarget as MonitorStation;

            if (target != null)
            {
                FixedStationInfo stationInfo           = target.StationInfo;
                Dialog.FixedStationDetailDialog detail = new Dialog.FixedStationDetailDialog(stationInfo);
                detail.Owner = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(Element);
                detail.Show();
            }
        }
Пример #13
0
        private static void ShowContextDetails()
        {
            var hitTestResult = Api.Client.UI.GetVisualInPointedPosition();

            if (hitTestResult == null)
            {
                return;
            }

            if (VisualTreeHelperExtension.FindParentOfType(
                    hitTestResult, typeof(ItemSlotControl)) is ItemSlotControl itemSlotControl)
            {
                if (itemSlotControl.Item != null)
                {
                    WindowCNEIdetails.Open(
                        EntityViewModelsManager.GetEntityViewModel(itemSlotControl.Item.ProtoItem));
                }

                return;
            }

            if (VisualTreeHelperExtension.FindParentOfType(
                    hitTestResult, typeof(RequiredItemControl)) is RequiredItemControl requiredItemControl)
            {
                if (requiredItemControl.ProtoItemWithCount != null)
                {
                    WindowCNEIdetails.Open(
                        EntityViewModelsManager.GetEntityViewModel(requiredItemControl.ProtoItemWithCount.ProtoItem));
                }

                return;
            }

            if (VisualTreeHelperExtension.FindParentOfType(
                    hitTestResult, typeof(EntitySlotControl)) is EntitySlotControl entitySlotControl)
            {
                if (entitySlotControl.DataContext is ProtoEntityViewModel entityViewModel)
                {
                    WindowCNEIdetails.Open(entityViewModel);
                }
                else
                {
                    Api.Logger.Error("CNEI: Wrong view model for details window " + entitySlotControl.DataContext);
                }
            }
        }
        private void btnAreaSelect_Click(object sender, RoutedEventArgs e)
        {
            var dataGridRow = VisualTreeHelperExtension.GetParentObject <DataGridRow>(sender as UIElement);

            while (dataGridRow != null)
            {
                if (dataGridRow is DataGridRow && (dataGridRow.DataContext.GetType() == typeof(FreqPlanActivity)))
                {
                    _selFreqPlan = (FreqPlanActivity)dataGridRow.DataContext;
                    break;
                }
            }
            DialogExtendDistance dialog = new DialogExtendDistance();

            dialog.OnSetDistance += dialog_OnSetDistance;
            dialog.ShowDialog(this);
        }
Пример #15
0
        private void itemTrack_Click(object sender, RoutedEventArgs e)
        {
            MenuItem    item   = sender as MenuItem;
            ContextMenu menu   = item.Parent as ContextMenu;
            var         target = menu.PlacementTarget as PersonPoint;

            if (target != null)
            {
                PP_OrgInfo    orgInfo    = target.OrgInfo;
                PP_PersonInfo personInfo = target.PersonInfo;

                PersonPoint          group    = new PersonPoint(orgInfo, personInfo);
                Track.TrackCondition conTrack = new Track.TrackCondition(group);
                conTrack.VehicleNum = personInfo.GUID;
                conTrack.Owner      = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(Element);
                conTrack.Show();
            }
        }
        public static void Init()
        {
            if (isInitialized)
            {
                return;
            }

            isInitialized = true;

            // ReSharper disable once CanExtractXamlLocalizableStringCSharp
            ClientInputContext.Start("Container sort helper")
            .HandleButtonDown(
                GameButton.ContainerSort,
                () =>
            {
                var hitTestResult = Api.Client.UI.GetVisualInPointedPosition();
                if (hitTestResult == null)
                {
                    return;
                }

                var itemSlotControl = VisualTreeHelperExtension.FindParentOfType(
                    hitTestResult,
                    typeof(ItemSlotControl)) as
                                      ItemSlotControl;

                if (itemSlotControl != null)
                {
                    SortItems((IClientItemsContainer)itemSlotControl.Container);
                    return;
                }

                var itemsContainerControl = VisualTreeHelperExtension.FindParentOfType(
                    hitTestResult,
                    typeof(ItemsContainerControl)) as
                                            ItemsContainerControl;

                if (itemsContainerControl != null)
                {
                    SortItems(itemsContainerControl.Container);
                }
            });
        }
Пример #17
0
        //private void Image_MouseEnter(object sender, MouseEventArgs e)
        //{
        //    Image img = sender as Image;
        //    img.Opacity = 1;
        //}

        //private void Image_MouseLeave(object sender, MouseEventArgs e)
        //{
        //    Image img = sender as Image;
        //    img.Opacity = 0.4;
        //}

        private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Image img = sender as Image;

            if (img.Opacity != 1)
            {
                return;
            }
            if (img.Tag != null)
            {
                if (img.Tag.ToString() == "参保单位")
                {
                }
                if (img.Tag.ToString() == "监测站")
                {
                    Dialog.FixedStationDetailDialog detail = new Dialog.FixedStationDetailDialog(null);
                    detail.Owner = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(this);
                    detail.Show();
                }
            }
        }