Пример #1
0
        private void lnkAssign_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // get the location using real map
            RealNavigationForm navigationForm = new RealNavigationForm();

            navigationForm.ProjectImagePath = Globals.ImagesDir;
            navigationForm.CurrentPlace     = Globals.NavigatorPlace;
            if (Globals.NavigatorPlace.Paths.Count > 0)
            {
                navigationForm.CurrentPath = Globals.NavigatorPlace.Paths[0];
            }
            if (Globals.NavigatorPlace.Paths.Count > 0 && Globals.NavigatorPlace.Paths[0].Points.Count > 0)
            {
                navigationForm.CurrentPoint = Globals.NavigatorPlace.Paths[0].Points[0];
            }
            navigationForm.CurrentAngle = 0;
            navigationForm.StartRealView();
            if (navigationForm.ShowDialog() == DialogResult.OK)
            {
                location.NavigatorPathId = (new FileInfo(navigationForm.CurrentImagePath)).Directory.Name;
                location.ImageName       = Path.GetFileName(navigationForm.CurrentImagePath);
            }

            LoadPreviewImage();

            HotspotManager.Save();
        }
Пример #2
0
        public void LoadControl()
        {
            HotspotManager.Load();

            foreach (Hotspot hotspot in HotspotManager.Hotspots)
            {
                Button btn = CreateControl(hotspot);
                pnlHotspots.Controls.Add(btn);
            }
        }
Пример #3
0
        void itemCtrl_ItemDeleted(object sender, EventArgs e)
        {
            HotSpotItemCtrl ctrl = (HotSpotItemCtrl)sender;

            // remove from the collection
            hotSpot.Locations.Remove(ctrl.HotspotLocation);
            HotspotManager.Save();

            // remove from the panel containing it
            pnlHotSpotItems.Controls.Remove(ctrl);
        }
Пример #4
0
        private void btnAddNewHotspot_Click(object sender, EventArgs e)
        {
            Hotspot newHotSpot = new Hotspot();

            HotSpotCtrl ctrl = CreateControl(newHotSpot);

            pnlHotspots.Controls.Add(ctrl);

            HotspotManager.Hotspots.Add(newHotSpot);
            HotspotManager.Save();
        }
Пример #5
0
        private void lnkAddNewLocation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (hotSpot != null)
            {
                HotspotLocation newLocation = new HotspotLocation();

                HotSpotItemCtrl ctrl = CreateHotSpotItemCtrl(newLocation);
                pnlHotSpotItems.Controls.Add(ctrl);

                hotSpot.Locations.Add(newLocation);
                HotspotManager.Save();
            }
        }
Пример #6
0
        public void LoadControl()
        {
            HotspotManager.Load();

            pnlHotspots.Controls.Clear();
            foreach (Hotspot hotSpot in HotspotManager.Hotspots)
            {
                HotSpotCtrl ctrl = CreateControl(hotSpot);
                pnlHotspots.Controls.Add(ctrl);
            }

            if (pnlHotspots.Controls.Count > 0)
            {
                ((HotSpotCtrl)pnlHotspots.Controls[0]).IsSelected = true;
            }
        }
Пример #7
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            HotSpotImageForm imageForm = new HotSpotImageForm();
            string           resFile   = string.Empty;

            if (imageForm.ShowDialog() == DialogResult.OK)
            {
                if (imageForm.ResourceImageSelected && imageForm.SelectedImage != null)
                {
                    resFile = Globals.SettingsResourceDir + imageForm.SelectedResourceImageFileName + ".png";
                    imageForm.SelectedImage.Save(resFile);
                }
                else if (imageForm.ResourceImageSelected == false && String.IsNullOrEmpty(imageForm.SelectedFile) == false)
                {
                    resFile = Globals.SettingsResourceDir + Path.GetFileName(imageForm.SelectedFile);
                    IOSupport.CopyFile(imageForm.SelectedFile, resFile);
                }

                pbImagePreview.Image = ImageLoader.GetImageFromFile(resFile, pbImagePreview.Width, pbImagePreview.Height);

                hotSpot.ImageName = Path.GetFileName(resFile);
                HotspotManager.Save();
            }
        }
Пример #8
0
        private void btnDeleteSelectedHotspot_Click(object sender, EventArgs e)
        {
            HotSpotCtrl hotSpotCtrl = null;

            foreach (Control ctrl in pnlHotspots.Controls)
            {
                hotSpotCtrl = (HotSpotCtrl)ctrl;
                if (hotSpotCtrl.IsSelected)
                {
                    break;
                }
            }

            if (hotSpotCtrl != null)
            {
                if (MessageBox.Show("Are you sure you want to delete this hot spot ?", "Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    HotspotManager.Hotspots.Remove(hotSpotCtrl.HotSpot);
                    HotspotManager.Save();

                    pnlHotspots.Controls.Remove(hotSpotCtrl);
                }
            }
        }