/// <summary> ///Constructor /// </summary> public HotspotIconControl(Canvas parent, ScatterView parentScatterView,Hotspot hotspotData, MultiScaleImage msi ) { InitializeComponent(); m_hotspotData = hotspotData; m_parent = parent; _msi = msi; m_parentScatterView = parentScatterView; m_detailControl = new HotspotDetailsControl(m_parent, m_parentScatterView, m_hotspotData, msi); try { String imgUri = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Hotspots\\Icons\\normal.png"; normal = new BitmapImage(); normal.BeginInit(); normal.UriSource = new Uri(imgUri, UriKind.Relative); normal.CacheOption = BitmapCacheOption.OnLoad; normal.EndInit(); highlighted = new BitmapImage(); imgUri = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Hotspots\\Icons\\highlighted.png"; highlighted.BeginInit(); highlighted.UriSource = new Uri(imgUri, UriKind.Relative); highlighted.CacheOption = BitmapCacheOption.OnLoad; highlighted.EndInit(); WriteableBitmap wbmap = new WriteableBitmap(normal); } catch (Exception e) { } }
/// <summary> /// Read the hotspot XML file and save to m_hotspots. /// </summary> public bool loadDocument(String filename) { //XmlNodeList hotspotList; XmlDocument doc = new XmlDocument(); try { try { doc.Load(filename); } catch (Exception e) { return false; } m_hotspotList = doc.SelectNodes("//hotspot"); //MessageBox.Show(m_hotspotList[0].ChildNodes[0].InnerText); m_hotspotIcons = new HotspotIconControl[m_hotspotList.Count]; m_hotspotDetails = new HotspotDetailsControl[m_hotspotList.Count]; m_hotspots = new Hotspot[m_hotspotList.Count]; m_isSelected = new Boolean[m_hotspotList.Count]; m_isOnScreen = new Boolean[m_hotspotList.Count]; for (int i = 0; i < m_hotspots.Length; i++) { m_hotspots[i] = new Hotspot(); foreach (XmlNode child in m_hotspotList[i].ChildNodes) { switch (child.Name) { case "name": m_hotspots[i].Name = child.InnerText; break; case "positionX": m_hotspots[i].PositionX = (double)Convert.ToDouble(child.InnerText); break; case "positionY": m_hotspots[i].PositionY = (double)Convert.ToDouble(child.InnerText); break; case "type": m_hotspots[i].Type = child.InnerText; break; case "description": m_hotspots[i].Description = child.InnerText; break; case "fileDescription": m_hotspots[i].fileDescription = child.InnerText; break; default: break; } } m_hotspots[i].XmlNode = m_hotspotList[i]; m_isSelected[i] = true; m_isOnScreen[i] = false; String fileName = this.getArtworkName(filename); m_hotspots[i].artworkName = fileName; } } catch (Exception ex) { return false; } return true; }
/// <summary> /// Constructor /// </summary> public HotspotDetailsControl(Canvas parentCanvas, ScatterView parentScatterView, Hotspot hotspotData, MultiScaleImage msi) { InitializeComponent(); m_hotspotData = hotspotData; m_parentCanvas = parentCanvas; m_parentScatterView = parentScatterView; m_msi = msi; //ScatterViewItem this.PreviewMouseWheel += new MouseWheelEventHandler(HotspotDetailsControl_PreviewMouseWheel); isOnScreen = false; hasVideo = false; _hasBeenOpened = false; _volume = .5; // windowSize = new Size(); sizeChanged = true; firstTime = true; }