ShiftOS-C-/source/WindowsFormsApplication1/Controls/DesktopIcon.cs
MichaelTheShifter 6b804f03eb Full ShiftUI conversion
The only bugs are that windows don't show in the center of the screen,
and Gecko webbrowsers are not serializing properly to be converted to
ShiftUI widgets (you can use the ToWidget() extension method to convert
a WinForms control to a ShiftUI widget)

Also multiple desktop panels are removed due to some odd bug I can't
diagnose. Will add them back in the future. Promise. I loved creating
GNOME2 skins.
2016-07-19 21:53:26 -04:00

83 lines
1.9 KiB
C#

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.IO;
namespace ShiftOS
{
public partial class DesktopIcon : UserWidget
{
/// <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)
{
if (File.Exists(Paths.Desktop + IconName))
{
var fs = new File_Skimmer();
fs.OpenFile(Paths.Desktop + IconName);
}
else
{
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;
};
}
}
}