private void DeleteHotSpot(Guid deleteId)
        {
            ShopHotSpot shopHot = GetHotSpotBy(deleteId);

            List <UIElement> removedElements = new List <UIElement>();

            foreach (UIElement element in casDrawPanel.Children)
            {
                if (element is Polygon && ((Polygon)element).Tag == shopHot)
                {
                    removedElements.Add((Polygon)element);
                }
                if (element is TextBlock && ((TextBlock)element).Tag == shopHot)
                {
                    removedElements.Add((TextBlock)element);
                }
            }
            foreach (UIElement removedElement in removedElements)
            {
                casDrawPanel.Children.Remove(removedElement);
            }

            HostSpots.Remove(shopHot);

            listNotDrawSeatNo.ItemsSource = NotAssignedShopNOs;
        }
Example #2
0
        public void ShowEdit(ShopHotSpot hostSpot, MainPage mainPage)
        {
            ParentWindow = mainPage;

            shopHotSpot                     = hostSpot;
            this.txtShopNo.Text             = shopHotSpot.DataID;
            this.cmbBrandInfo.SelectedValue = BrandInfo.GetBrandInfo(shopHotSpot.Brand);
            Show();
        }
        private void ChangeHotSpot(string shopNo)
        {
            ShopHotSpot shopHotEdit = GetHotSpotByDataID(shopNo);

            cwChangeShopBrand winHotSpot = new cwChangeShopBrand();

            winHotSpot.ShowEdit(shopHotEdit, this);
            winHotSpot.Closed += new EventHandler(ChangeHotSpot_Closed);
        }
        private void EditHotSpot(string shopNO)
        {
            ShopHotSpot shopHotEdit = GetHotSpotByDataID(shopNO);

            cwShopEditor winHotSpot = new cwShopEditor();

            winHotSpot.ShowEdit(shopHotEdit, this);
            winHotSpot.Closed += new EventHandler(winHotSpot_Closed);
        }
        private void EditHotSpot(Guid editId)
        {
            ShopHotSpot shopHotEdit = GetHotSpotBy(editId);

            cwShopEditor winHotSpot = new cwShopEditor();

            winHotSpot.ShowEdit(shopHotEdit, this);
            winHotSpot.Closed += new EventHandler(winHotSpot_Closed);
        }
        public void SetHotSpotSelected(string shopNO, bool selected)
        {
            ShopHotSpot spot = GetHotSpotByDataID(shopNO);

            if (spot != null)
            {
                spot.IsSelected = selected;
            }
        }
 public void ShowEdit(ShopHotSpot hostSpot, MainPage parentWindow)
 {
     ParentWindow = parentWindow;
     this.cmbShopNo.ItemsSource = AllShopNOs;
     DataMode    = DataFormMode.Edit;
     shopHotSpot = hostSpot;
     this.cmbShopNo.SelectedValue     = ShopInfo.GetBySeatNo(shopHotSpot.DataID);
     this.chkTextIsVertical.IsChecked = shopHotSpot.IsRotate;
     Show();
 }
 public void ShowAdd(ShopHotSpot hostSpot, MainPage parentWindow)
 {
     ParentWindow = parentWindow;
     this.cmbShopNo.ItemsSource = NotAssignedShopNOs;
     DataMode    = DataFormMode.AddNew;
     shopHotSpot = hostSpot;
     this.cmbShopNo.SelectedValue     = shopHotSpot.DataID;
     this.chkTextIsVertical.IsChecked = shopHotSpot.IsRotate;
     Show();
 }
        public MainPage(SLHotSpotSetting _hotSpotSetting, ShopMallFloorHotspotData _shopMallFloorData)
        {
            shopMallFloorData = _shopMallFloorData;

            InitializeComponent();

            BrandInfo.SetBrandData(shopMallFloorData);

            hostSpot = new ShopHotSpot(Guid.NewGuid(), "Thinkpad");


            casDrawPanel.MouseLeftButtonUp   += ssvDrawOnMouseLeftButtonUp;
            casDrawPanel.MouseMove           += ssvDrawOnMouseMove;
            casDrawPanel.MouseLeftButtonDown += ssvDrawOnMouseLeftButtonDown;

            imgBg.MouseEnter += new MouseEventHandler(imgBg_MouseEnter);

            setting = _hotSpotSetting;

            switch (setting.ControlMode)
            {
            case Mode.View:
            case Mode.Change:
                LayoutRoot.ColumnDefinitions[0].Width = new GridLength(100, GridUnitType.Star);
                LayoutRoot.ColumnDefinitions[1].Width = new GridLength(0, GridUnitType.Star);
                this.pnlManage.Visibility             = Visibility.Collapsed;
                break;

            case Mode.Design:
                LayoutRoot.ColumnDefinitions[0].Width = new GridLength(75, GridUnitType.Star);
                LayoutRoot.ColumnDefinitions[1].Width = new GridLength(25, GridUnitType.Star);
                this.pnlManage.Visibility             = Visibility.Visible;
                break;
            }

            if (!String.IsNullOrEmpty(shopMallFloorData.ImageUrl))
            {
                biLoadingImage.IsBusy = true;

                //MessageBox.Show(shopMallFloorData.ImageUrl);

                Uri imageuri = new Uri(shopMallFloorData.ImageUrl);

                WebClient webClient = new WebClient();

                webClient.OpenReadCompleted       += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
                webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);

                webClient.OpenReadAsync(imageuri);
            }
        }
        private void winHotSpot_Closed(object sender, EventArgs e)
        {
            cwShopEditor hotSpotEditor = sender as cwShopEditor;

            if (hotSpotEditor == null)
            {
                btnDrawArea.IsChecked = true;
                return;
            }

            if (!(hotSpotEditor.DialogResult.HasValue && hotSpotEditor.DialogResult.Value))
            {
                if (hotSpotEditor.DataMode == DataFormMode.AddNew)
                {
                    btnDrawArea.IsChecked = true;
                }
                return;
            }

            if (hotSpotEditor.DataMode == DataFormMode.AddNew)
            {
                ShopHotSpot newhostSpot = hotSpotEditor.GetItem();

                newhostSpot.AddHotspot(casDrawPanel, this.setting.ControlMode, this);

                HostSpots.Add(newhostSpot);

                dgHotSpot.ItemsSource = HostSpots;

                listNotDrawSeatNo.ItemsSource = NotAssignedShopNOs;

                hostSpot = new ShopHotSpot(Guid.NewGuid(), "Lenovo");

                btnCancelDraw.Visibility = Visibility.Collapsed;

                btnDrawArea.Content = "开始绘制热点";
            }
            else if (hotSpotEditor.DataMode == DataFormMode.Edit)
            {
                ShopHotSpot shopHotSpot = hotSpotEditor.GetItem();

                shopHotSpot.UpdateHotspot(casDrawPanel, this.setting.ControlMode, this);
                dgHotSpot.ItemsSource = HostSpots;

                listNotDrawSeatNo.ItemsSource = NotAssignedShopNOs;
            }
        }
        private void dgHotSpot_OnChangeTextPosionClick(object sender, RoutedEventArgs e)
        {
            tbtn = sender as ToggleButton;

            if (tbtn != null)
            {
                ShopHotSpot shopHotSpot = GetHotSpotBy((Guid)tbtn.CommandParameter);

                if (tbtn.IsChecked.HasValue && tbtn.IsChecked.Value)
                {
                    shopHotSpot.StartChangeText();
                    canDragPanel = false;
                    tbtn.Content = "调整结束";

                    if (tbtn.Parent is StackPanel)
                    {
                        foreach (UIElement uiElement in ((StackPanel)tbtn.Parent).Children)
                        {
                            if (uiElement is StackPanel)
                            {
                                ((StackPanel)uiElement).Visibility = Visibility.Visible;
                            }
                        }
                    }
                }
                else
                {
                    if (shopHotSpot.EndChangeText())
                    {
                        canDragPanel = true;
                        tbtn.Content = "文字调整";
                        if (tbtn.Parent is StackPanel)
                        {
                            foreach (UIElement uiElement in ((StackPanel)tbtn.Parent).Children)
                            {
                                if (uiElement is StackPanel)
                                {
                                    ((StackPanel)uiElement).Visibility = Visibility.Collapsed;
                                }
                            }
                        }
                    }
                }
            }
        }
        private void dgHotSpot_OnTextChangeClick(object sender, RoutedEventArgs e)
        {
            Button btnOnTextChange = sender as Button;

            if (btnOnTextChange != null && btnOnTextChange.Tag != null)
            {
                ShopHotSpot shopHotSpot = GetHotSpotBy((Guid)btnOnTextChange.CommandParameter);

                if (shopHotSpot != null && btnOnTextChange.Tag.ToString() == "+")
                {
                    shopHotSpot.LargeText(0.1);
                }
                else if (shopHotSpot != null && btnOnTextChange.Tag.ToString() == "-")
                {
                    shopHotSpot.SmallText(0.1);
                }
            }
        }
        private void ChangeHotSpot_Closed(object sender, EventArgs e)
        {
            cwChangeShopBrand hotSpotEditor = sender as cwChangeShopBrand;

            if (hotSpotEditor == null)
            {
                return;
            }

            if (!(hotSpotEditor.DialogResult.HasValue && hotSpotEditor.DialogResult.Value))
            {
                return;
            }

            ShopHotSpot shopHotSpot = hotSpotEditor.GetItem();

            shopHotSpot.UpdateHotspot(casDrawPanel, setting.ControlMode, this);

            OnItemChangedBrand(shopHotSpot);

            dgHotSpot.ItemsSource = HostSpots;
        }
        private void AddToCanvas(ROSHotSpot rosHotSpot, Mode mode)
        {
            ShopHotSpot shopHot = new ShopHotSpot(rosHotSpot, casDrawPanel, mode, this);

            HostSpots.Add(shopHot);
        }