Beispiel #1
0
        private void GroupBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var groupBox = (DevExpress.Xpf.LayoutControl.GroupBox)sender;
            ActivityPlaceLocationImageView gpv = groupBox.DataContext as ActivityPlaceLocationImageView;

            if (gpv.GUID == "add")
            {
                LocationImageDialog imgDialog = new LocationImageDialog();
                if (imgDialog.ShowDialog() == 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();
                }
            }
            else
            {
                groupBox.State = groupBox.State == GroupBoxState.Normal ? GroupBoxState.Maximized : GroupBoxState.Normal;
            }
        }
Beispiel #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;
                 }
             }
         }
     }
 }
Beispiel #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;
                        }
                    }
                }
            }
        }
Beispiel #4
0
 public LocationImageDialog(ActivityPlaceLocationImageView editView)
 {
     InitializeComponent();
     EditView = AT_BC.Data.Helpers.DataContractSerializeHelper.Clone <ActivityPlaceLocationImageView>(editView);
     SetDefaultImage();
     this.Title       = "编辑";
     this.DataContext = EditView;
 }
Beispiel #5
0
 public LocationImageDialog()
 {
     InitializeComponent();
     this.Title    = "添加";
     EditView      = new ActivityPlaceLocationImageView();
     EditView.GUID = Utility.NewGuid();
     SetDefaultImage();
     this.DataContext = EditView;
 }
Beispiel #6
0
        public ActivityManageImage(List <ActivityPlaceLocationImage> activityPlaceLocationImage, string _locationGuid)
        {
            InitializeComponent();
            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.Image     = ClientHelper.ResourceImageToBytes("/CO_IA.UI.ActivityManage;component/Images/add.png");
                viewList.Add(gpvAdd);
            }

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