コード例 #1
0
        public void LoadImage(string filepath, IGUIContext ctx, float opacity = 1f)
        {
            if (m_ImageFilePath != filepath)
            {
                m_ImageFilePath = filepath;

                if (Image != null)
                {
                    Image.Dispose();
                    Image = null;
                }

                if (String.IsNullOrEmpty(filepath) || ctx == null)
                {
                    return;
                }

                try {
                    Image         = TextureImage.FromFile(filepath, ctx);
                    Image.Opacity = opacity;
                } catch (Exception ex) {
                    ex.LogError();
                }
            }
        }
コード例 #2
0
        public void LoadTextureImageFromFile(string filepath, IGUIContext ctx)
        {
            filepath = filepath.FixedExpandedPath();

            if (m_ImageFilePath != filepath)
            {
                m_ImageFilePath = filepath;

                if (Image != null)
                {
                    Image.Dispose();
                    Image = null;
                }

                if (String.IsNullOrEmpty(filepath) || ctx == null)
                {
                    return;
                }

                try {
                    Image = TextureImage.FromFile(filepath, ctx);
                } catch (Exception ex) {
                    ex.LogError();
                }
            }
        }
コード例 #3
0
ファイル: ImageList.cs プロジェクト: kroll-software/SummerGUI
 public bool AddImage(string key, string filePath)
 {
     try {
         TextureImage image = TextureImage.FromFile(filePath, Context, key, ImageSize);
         return(m_Images.TryAdd(key, image));
     } catch (Exception ex) {
         ex.LogError();
         return(false);
     }
 }
コード例 #4
0
        public void LoadImageAsync(string filePath, IGUIContext ctx)
        {
            if (IsDisposed || String.IsNullOrEmpty(filePath))
            {
                return;
            }

            try {
                if (Image != null && ShouldDisposeImage)
                {
                    Image.Dispose();
                }
                Image = TextureImage.FromFile(filePath.FixedExpandedPath(), ctx);
                //Image.Opacity = 0.999f;
            } catch (Exception ex) {
                ex.LogError();
            }
            finally {
                Update(true);
                m_InitialFilePath = null;
            }
        }
コード例 #5
0
ファイル: ImageList.cs プロジェクト: kroll-software/SummerGUI
 void LoadMissingImage()
 {
     try {
         if (!String.IsNullOrEmpty(MissingImagePath) && File.Exists(MissingImagePath))
         {
             Task.Run(() => {
                 TextureImage oldImage = MissingImage;
                 try {
                     MissingImage = TextureImage.FromFile(MissingImagePath, Context, null, ImageSize);
                 } catch (Exception ex) {
                     ex.LogError();
                 } finally {
                     if (oldImage != null)
                     {
                         oldImage.Dispose();
                     }
                 }
             });
         }
     } catch (Exception ex) {
         ex.LogError();
     }
 }