aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/DesktopIcon.cs
blob: d0523d23bf72788b4bb805fac857482af91af272 (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
70
71
72
73
74
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 System.Windows.Forms;

namespace ShiftOS
{
    public partial class DesktopIcon : UserControl
    {
        /// <summary>
        /// User control for a desktop icon.
        /// </summary>
        public DesktopIcon()
        {
            InitializeComponent();
        }

        public string IconName
        {
            set
            {
                lbiconname.Text = value;
            }
            get
            {
                return lbiconname.Text;
            }
        }

        public Image Icon
        {
            set
            {
                pbicon.Image = value;
            }
            get
            {
                return pbicon.Image;
            }
        }

        //public string LuaAction { get; set; }
        public string LuaAction = "open_program(\"shiftorium\")";
        private void Icon_Click(object sender, EventArgs e)
        {
            var li = new LuaInterpreter();
            li.mod(LuaAction);
            lbiconname.BackColor = Color.White;
            t.Start();
        }

        public Timer t = new Timer();


        private void DesktopIcon_Load(object sender, EventArgs e)
        {
            t.Interval = 5000;
            t.Tick += (object s, EventArgs a) =>
            {
                lbiconname.BackColor = Color.Transparent;
            };
            var st = new Timer();
            st.Interval = 200;
            st.Tick += (object s, EventArgs a) => {
                lbiconname.ForeColor = API.CurrentSkin.IconTextColor;
            };
        }
    }
}