Пример #1
0
        private void GetIcon(object state)
        {
            UserGameInfo game = (UserGameInfo)state;
            Icon         icon = Shell32Interop.GetIcon(game.ExePath, false);

            Bitmap bmp = icon.ToBitmap();

            icon.Dispose();
            game.Icon = bmp;

            lock (controls) {
                GameControl control;
                if (controls.TryGetValue(game.GameID, out control))
                {
                    control.Invoke((Action) delegate() {
                        control.Image = game.Icon;
                    });
                }
            }
        }
Пример #2
0
        private void ThreadGetIcon(object state) {
            UserGameInfo game = (UserGameInfo)state;
            Icon icon = Shell32Interop.GetIcon(game.ExePath, false);

            Bitmap bmp = icon.ToBitmap();
            icon.Dispose();
            game.Icon = bmp;

            lock (callbacks) {
                List<Action<Bitmap>> calls;
                if (callbacks.TryGetValue(game.GameID, out calls)) {
                    for (int i = 0; i < calls.Count; i++) {
                        calls[i](bmp);
                    }
                    callbacks.Remove(game.GameID);
                }

                GameIcons.Add(game.GameID, bmp);
            }
        }
Пример #3
0
        private void GetIcon(object state)
        {
            UserGameInfo game = (UserGameInfo)state;
            Icon         icon = Shell32Interop.GetIcon(game.ExePath, false);

            Bitmap bmp = icon.ToBitmap();

            icon.Dispose();
            game.Icon = bmp;

            lock (controls)
            {
                if (controls.ContainsKey(game))
                {
                    GameControl control = controls[game];
                    control.Invoke((Action) delegate()
                    {
                        control.Image = game.Icon;
                    });
                }
            }
        }