示例#1
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();
                }
            }
        }
示例#2
0
 private void btn_DelClick(object sender, MouseButtonEventArgs e)
 {
     e.Handled = true;
     if (MessageBox.Show("是否删除此图片?", "询问", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         Image btn = sender as Image;
         ActivityPlaceLocationImageView itemview = btn.DataContext as ActivityPlaceLocationImageView;
         if (itemview != null)
         {
             foreach (var item in viewList)
             {
                 if (item.GUID == itemview.GUID)
                 {
                     viewList.Remove(item);
                     RefreshList();
                     break;
                 }
             }
             //更新源
             foreach (var item in ActivityPlaceLocationImageList)
             {
                 if (item.GUID == itemview.GUID)
                 {
                     ActivityPlaceLocationImageList.Remove(item);
                     break;
                 }
             }
         }
     }
 }
示例#3
0
        private void btn_ModifyClick(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            Image btn = sender as Image;
            ActivityPlaceLocationImageView itemview = btn.DataContext as ActivityPlaceLocationImageView;

            if (itemview != null)
            {
                LocationImageDialog imgDialog = new LocationImageDialog(itemview);
                if (imgDialog.ShowDialog() == true)
                {
                    for (int i = 0; i < viewList.Count; i++)
                    {
                        if (viewList[i].GUID == imgDialog.EditView.GUID)
                        {
                            viewList[i].ImageName = imgDialog.EditView.ImageName;
                            viewList[i].Image     = imgDialog.EditView.Image;
                            viewList[i].TYPE      = imgDialog.EditView.TYPE;
                            break;
                        }
                    }
                    RefreshList();
                    for (int i = 0; i < ActivityPlaceLocationImageList.Count; i++)
                    {
                        if (ActivityPlaceLocationImageList[i].GUID == imgDialog.EditView.GUID)
                        {
                            ActivityPlaceLocationImageList[i].ImageName = imgDialog.EditView.ImageName;
                            ActivityPlaceLocationImageList[i].Image     = imgDialog.EditView.Image;
                            ActivityPlaceLocationImageList[i].TYPE      = imgDialog.EditView.TYPE;
                            break;
                        }
                    }
                }
            }
        }
 public LocationImageDialog(ActivityPlaceLocationImageView editView)
 {
     InitializeComponent();
     EditView = AT_BC.Data.Helpers.DataContractSerializeHelper.Clone <ActivityPlaceLocationImageView>(editView);
     SetDefaultImage();
     this.Title       = "编辑";
     this.DataContext = EditView;
 }
示例#5
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;
        }
 public LocationImageDialog()
 {
     InitializeComponent();
     this.Title    = "添加";
     EditView      = new ActivityPlaceLocationImageView();
     EditView.GUID = Utility.NewGuid();
     SetDefaultImage();
     this.DataContext = EditView;
 }
示例#7
0
        public void setSource(List <ActivityPlaceLocationImage> activityPlaceLocationImage, string _locationGuid)
        {
            locationGuid = _locationGuid;
            if (!string.IsNullOrEmpty(_locationGuid))
            {
                CanEdit = true;
            }
            ActivityPlaceLocationImageList = activityPlaceLocationImage;
            if (ActivityPlaceLocationImageList == null)
            {
                ActivityPlaceLocationImageList = new List <ActivityPlaceLocationImage>();
            }

            if (activityPlaceLocationImage != null && activityPlaceLocationImage.Count > 0)
            {
                foreach (var item in activityPlaceLocationImage)
                {
                    ActivityPlaceLocationImageView view = new ActivityPlaceLocationImageView();
                    view.GUID      = item.GUID;
                    view.ImageName = item.ImageName;
                    view.Image     = item.Image;
                    if (CanEdit)
                    {
                        view.IsVisible = Visibility.Visible;
                    }
                    else
                    {
                        view.IsVisible = Visibility.Collapsed;
                    }
                    viewList.Add(view);
                }
            }
            if (CanEdit)
            {
                ActivityPlaceLocationImageView gpvAdd = new ActivityPlaceLocationImageView();
                gpvAdd.GUID      = "add";
                gpvAdd.ImageName = "添加";
                gpvAdd.IsVisible = Visibility.Hidden;
                gpvAdd.TYPE      = -1;
                gpvAdd.Cursor    = "Hand";
                gpvAdd.Image     = ClientHelper.ResourceImageToBytes("pack://application:,,,/CO_IA.Themes;component/Images/Area/add.png");
                viewList.Add(gpvAdd);
            }

            this.flc_ImgList.ItemsSource = viewList;
        }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     EditView          = null;
     this.DialogResult = false;
 }