main
 1using System;
 2using System.Drawing;
 3
 4namespace MoMoney.Presentation.Winforms.Resources
 5{
 6    public class HybridIcon : ApplicationIcon
 7    {
 8        readonly Image underlying_image;
 9
10        public HybridIcon(string name_of_the_icon, Action<ApplicationIcon> action) : base(name_of_the_icon, action)
11        {
12            if (icon_can_be_found())
13            {
14                underlying_image = Image.FromFile(find_full_path_to(this));
15            }
16        }
17
18        public override void Dispose()
19        {
20            base.Dispose();
21            if (underlying_image != null) underlying_image.Dispose();
22        }
23
24        static public implicit operator Image(HybridIcon icon_to_convert)
25        {
26            return icon_to_convert.underlying_image;
27        }
28    }
29}