aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/Controls/IconControl.cs
blob: 597174416a1e7abfab50d4c19589ec3a367e30e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShiftUI;
using System.Drawing.Imaging;
using Newtonsoft.Json;
using System.IO;

namespace ShiftOS
{
    public partial class IconWidget : UserWidget
    {
        public IconWidget()
        {
            InitializeComponent();
        }

        private void IconWidget_Load(object sender, EventArgs e)
        {
            pblarge.Top = (this.Height - pblarge.Height) / 2;
        }

        

        public Image LargeImage
        {
            get
            {
                return pblarge.Image;
            }
            set
            {
                pblarge.Image = value;
            }
        }

        public string IconName
        {
            get
            {
                return lbname.Text;

            }
            set
            {
                lbname.Text = value;
            }
        }
        
        private void pblarge_Click(object sender, EventArgs e)
        {
            API.CreateGraphicPickerSession($"Icon - {IconName}", false);
            API.GraphicPickerSession.FormClosing += (object s, FormClosingEventArgs a) =>
            {
                if(API.GraphicPickerSession.IdleImage != null)
                {
                    LargeImage = API.GraphicPickerSession.IdleImage;
                }
            };
        }
    }

    
}