Esempio n. 1
0
        public override bool PerformSelectionAction(DrawArgs drawArgs)
        {
            if (this.ShowOnlyCurrentlySelected)
            {
                return(false);
            }

            lock (this.downloadableIconList.SyncRoot)
            {
                foreach (string key in this.downloadableIconList.Keys)
                {
                    if (this.currentlyDisplayed != null && key == this.currentlyDisplayed.Name)
                    {
                        continue;
                    }
                    DownloadableIcon di = (DownloadableIcon)this.downloadableIconList[key];
                    if (di.WasClicked(drawArgs))
                    {
                        if (this.currentlyDisplayed != null)
                        {
                            this.currentlyDisplayed.LoadImage = false;
                        }
                        di.LoadImage = true;
                        di.PerformSelectionAction(drawArgs);
                        this.currentlyDisplayed = di;
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
        public void RemoveDownloadableIcon(string name)
        {
            try
            {
                DownloadableIcon di = null;
                lock (this.downloadableIconList.SyncRoot)
                {
                    if (this.downloadableIconList.Contains(name))
                    {
                        di = (DownloadableIcon)this.downloadableIconList[name];
                        this.downloadableIconList.Remove(name);
                    }
                    this.returnList = new DownloadableIcon[this.downloadableIconList.Count];
                    int c = 0;
                    foreach (DownloadableIcon dicon in this.downloadableIconList.Values)
                    {
                        this.returnList[c++] = dicon;
                    }
                }

                if (this.currentlyDisplayed != null && name == this.currentlyDisplayed.Name)
                {
                    this.currentlyDisplayed = null;
                }

                if (di != null)
                {
                    di.Dispose();
                }
            }
            catch (Exception caught)
            {
                Log.Write(caught);
            }
        }
Esempio n. 3
0
 public override void Dispose()
 {
     this.isInitialized = false;
     lock (this.downloadableIconList.SyncRoot)
     {
         foreach (string key in this.downloadableIconList.Keys)
         {
             DownloadableIcon di = (DownloadableIcon)this.downloadableIconList[key];
             di.Dispose();
         }
     }
 }
Esempio n. 4
0
        public void AddDownloadableIcon(string name, float altitude,
                                        float west, float south, float east, float north, string imageUrl, string saveTexturePath, string iconFilePath, int iconSize, string caption)
        {
            Texture t = null;

            if (!this.textureHash.Contains(iconFilePath))
            {
                t = ImageHelper.LoadTexture(iconFilePath);
                lock (this.textureHash.SyncRoot)
                {
                    this.textureHash.Add(iconFilePath, t);
                }
            }
            else
            {
                t = (Texture)this.textureHash[iconFilePath];
            }
            DownloadableIcon di = new DownloadableIcon(name, m_ParentWorld,
                                                       this.layerRadius - (float)m_ParentWorld.EquatorialRadius + altitude, west, south, east, north,
                                                       imageUrl, saveTexturePath, t, iconSize, caption, this._terrainAccessor);

            di.IsOn         = true;
            di.IconFilePath = iconFilePath;

            lock (this.downloadableIconList.SyncRoot)
            {
                if (!this.downloadableIconList.Contains(di.Name))
                {
                    this.downloadableIconList.Add(di.Name, di);
                }

                this.returnList = new DownloadableIcon[this.downloadableIconList.Count];
                int c = 0;
                foreach (DownloadableIcon dicon in this.downloadableIconList.Values)
                {
                    this.returnList[c++] = dicon;
                }
            }
        }
Esempio n. 5
0
        public void LoadDownloadableIcon(string name)
        {
            DownloadableIcon di = null;

            lock (this.downloadableIconList.SyncRoot)
            {
                if (this.downloadableIconList.Contains(name))
                {
                    di = (DownloadableIcon)this.downloadableIconList[name];
                }
            }
            if (di != null)
            {
                if (this.currentlyDisplayed != null)
                {
                    this.currentlyDisplayed.Dispose();
                }

                di.DownLoadImage(drawArgs);
                this.currentlyDisplayed = di;
            }
        }