mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 23:39:29 +02:00
Improved plugin settings support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using DesktopMagicPluginAPI;
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
@@ -7,17 +8,39 @@ namespace DesktopMagicPlugin.Test
|
||||
{
|
||||
public class PluginScript : Plugin
|
||||
{
|
||||
[Element("Heading")]
|
||||
private Heading heading = new Heading("test");
|
||||
|
||||
[Element("Slider:")]
|
||||
private Slider slider = new Slider(1, 23, 4);
|
||||
|
||||
[Element("Text:")]
|
||||
private TextBox textBox = new TextBox("abc");
|
||||
|
||||
public PluginScript()
|
||||
{
|
||||
slider.OnValueChanged += Slider_OnValueChanged;
|
||||
textBox.OnValueChanged += TextBox_OnValueChanged;
|
||||
}
|
||||
|
||||
private void TextBox_OnValueChanged()
|
||||
{
|
||||
Debug.WriteLine("TextBox value changed:" + textBox.Value);
|
||||
}
|
||||
|
||||
private void Slider_OnValueChanged()
|
||||
{
|
||||
Debug.WriteLine("Slider value changed:" + slider.Value);
|
||||
}
|
||||
|
||||
public override Bitmap Main()
|
||||
{
|
||||
Bitmap bmp = new Bitmap(100, 100);
|
||||
using Graphics g = Graphics.FromImage(bmp);
|
||||
g.Clear(Application.Color);
|
||||
g.DrawString(slider.Value.ToString(), new Font("arial", 10), Brushes.Black, new PointF(0, 0));
|
||||
slider.Value++;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public override void OnMouseClick(Point position)
|
||||
{
|
||||
Debug.WriteLine(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user