Пример #1
0
        private void LoadIcon(MirandaPlugin owner, MenuItemDeclarationAttribute attrib)
        {
            try
            {
                if (!attrib.HasIcon)
                    return;

                if (attrib.UseEmbeddedIcon)
                {
                    using (Stream stream = owner.GetType().Assembly.GetManifestResourceStream(attrib.IconID))
                    {
                        if (stream != null)
                            Icon = IconImageCache.Singleton.GetStreamedIcon(stream).Handle;
                        else
                            Debug.Fail("Embedded icon not found.");
                    }
                }
                else
                    Icon = Skin.LoadIcon(int.Parse(attrib.IconID));
            }
            catch
            {
                this.Icon = IntPtr.Zero;
            }
        }