diff --git a/src/DesktopMagic.Installer/DesktopMagic-Installer.exe b/src/DesktopMagic.Installer/DesktopMagic-Installer.exe index cef97e4..cc4f6a5 100644 Binary files a/src/DesktopMagic.Installer/DesktopMagic-Installer.exe and b/src/DesktopMagic.Installer/DesktopMagic-Installer.exe differ diff --git a/src/DesktopMagic/DesktopMagic.csproj b/src/DesktopMagic/DesktopMagic.csproj index 71ed275..7fe4c9f 100644 --- a/src/DesktopMagic/DesktopMagic.csproj +++ b/src/DesktopMagic/DesktopMagic.csproj @@ -12,6 +12,7 @@ + @@ -29,6 +30,11 @@ - + + Always + + + Always + \ No newline at end of file diff --git a/src/DesktopMagic/MainWindow.xaml.cs b/src/DesktopMagic/MainWindow.xaml.cs index 9b22cbc..8f7a415 100644 --- a/src/DesktopMagic/MainWindow.xaml.cs +++ b/src/DesktopMagic/MainWindow.xaml.cs @@ -72,6 +72,7 @@ namespace DesktopMagic notifyIcon.Visible = true; notifyIcon.Text = AppName; notifyIcon.Icon = new System.Drawing.Icon(iconStream); + notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); InitializeComponent(); diff --git a/src/DesktopMagic/Plugin/PluginData.cs b/src/DesktopMagic/Plugin/PluginData.cs index 04b0018..f301d7f 100644 --- a/src/DesktopMagic/Plugin/PluginData.cs +++ b/src/DesktopMagic/Plugin/PluginData.cs @@ -20,9 +20,6 @@ namespace DesktopMagic public Point WindowPosition => new Point((int)window.Left, (int)window.Top); - public void UpdateWindow() - { - window.UpdatePluginWindow(); - } + public void UpdateWindow() => window.UpdatePluginWindow(); } } \ No newline at end of file diff --git a/src/DesktopMagic/Plugin/PluginWindow.xaml.cs b/src/DesktopMagic/Plugin/PluginWindow.xaml.cs index 08cf1e0..7217fd0 100644 --- a/src/DesktopMagic/Plugin/PluginWindow.xaml.cs +++ b/src/DesktopMagic/Plugin/PluginWindow.xaml.cs @@ -13,6 +13,7 @@ using System.Threading; using System.Timers; using System.Windows; using System.Windows.Interop; +using System.Windows.Media; using System.Windows.Media.Imaging; namespace DesktopMagic @@ -249,11 +250,13 @@ namespace DesktopMagic { //Set Arguments SolidBrush newBrush = (SolidBrush)MainWindow.GlobalSystemColor; - Color color = newBrush.Color; + System.Drawing.Color color = newBrush.Color; string font = MainWindow.GlobalFont; Bitmap result = pluginClassInstance.Main(); + valueTimer.Interval = pluginClassInstance.UpdateInterval; + //Update Image Dispatcher.Invoke(() => { @@ -312,12 +315,20 @@ namespace DesktopMagic private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { - Clicked(new System.Drawing.Point((int)e.GetPosition(this).X, (int)e.GetPosition(this).Y)); + ImageSource imageSource = image.Source; + BitmapSource bitmapImage = (BitmapSource)imageSource; + double pixelMousePositionX = e.GetPosition(image).X * bitmapImage.PixelWidth / image.ActualHeight; + double pixelMousePositionY = e.GetPosition(image).Y * bitmapImage.PixelHeight / image.ActualHeight; + Clicked(new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY)); } private void Window_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { - Moved(new System.Drawing.Point((int)e.GetPosition(this).X, (int)e.GetPosition(this).Y)); + ImageSource imageSource = image.Source; + BitmapSource bitmapImage = (BitmapSource)imageSource; + double pixelMousePositionX = e.GetPosition(image).X * bitmapImage.PixelWidth / image.ActualHeight; + double pixelMousePositionY = e.GetPosition(image).Y * bitmapImage.PixelHeight / image.ActualHeight; + Moved(new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY)); } #endregion Window Events diff --git a/src/DesktopMagic/icon.ico b/src/DesktopMagic/icon.ico index 0151a8f..f0a01c0 100644 Binary files a/src/DesktopMagic/icon.ico and b/src/DesktopMagic/icon.ico differ diff --git a/src/DesktopMagic/icon_Dark.ico b/src/DesktopMagic/icon_Dark.ico new file mode 100644 index 0000000..ff58950 Binary files /dev/null and b/src/DesktopMagic/icon_Dark.ico differ diff --git a/src/DesktopMagicPlugin.Test/PluginScript.cs b/src/DesktopMagicPlugin.Test/PluginScript.cs index 0ffe3eb..4d4c927 100644 --- a/src/DesktopMagicPlugin.Test/PluginScript.cs +++ b/src/DesktopMagicPlugin.Test/PluginScript.cs @@ -2,6 +2,8 @@ using DesktopMagicPluginAPI.Inputs; using DesktopMagicPluginAPI.Drawing; using System.Drawing; +using System.Diagnostics; +using System.Drawing.Drawing2D; namespace DesktopMagicPlugin.Test { @@ -12,6 +14,8 @@ namespace DesktopMagicPlugin.Test [Element("Text:")] //Mark the property as element with the specified description private TextBox textBox = new TextBox("abc"); //Create a text box with the specified default value. + private Color color = Color.Black; + public InputExamplePlugin() { textBox.OnValueChanged += TextBox_OnValueChanged; //Add an event handler to the "OnValueChanged" event. @@ -19,7 +23,23 @@ namespace DesktopMagicPlugin.Test private void TextBox_OnValueChanged() { - Application.UpdateWindow(); //Update the pugin window. (Calls the "Main" method.) + Application.UpdateWindow(); //Update the plugin window. (Calls the "Main" method.) + } + + public override void OnMouseMove(Point position) + { + Debug.WriteLine(position.X); + Debug.WriteLine(500); + if (500 < position.X && color == Color.Black) + { + color = Color.White; + Application.UpdateWindow(); + } + else if (500 > position.X && color == Color.White) + { + color = Color.Black; + Application.UpdateWindow(); + } } public override Bitmap Main() @@ -28,8 +48,9 @@ namespace DesktopMagicPlugin.Test using (Graphics g = Graphics.FromImage(bmp)) { - g.Clear(Application.Color); //Set the background color to the color specified in the Desktop Magic application. - + g.InterpolationMode = InterpolationMode.HighQualityBilinear; + g.PixelOffsetMode = PixelOffsetMode.HighQuality; + g.Clear(color); g.DrawStringFixedWidth(textBox.Value, new Font(Application.Font, 100), Brushes.Black, new PointF(0, 0), 120); //Draw the value of the text box to the image. } diff --git a/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.csproj b/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.csproj index 6c7be81..b6dbfaf 100644 --- a/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.csproj +++ b/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.csproj @@ -10,6 +10,7 @@ true 0.0.0.2 + 0.0.0.2 diff --git a/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.md b/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.md index 9fd0421..c0d0e9b 100644 --- a/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.md +++ b/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.md @@ -338,7 +338,7 @@ Gets the window size of the main application. ##### Summary -Updates the plugin window +Updates the plugin window. ##### Parameters @@ -445,14 +445,14 @@ DesktopMagicPluginAPI ##### Summary -The plugin class +The plugin class. ### Application `property` ##### Summary -Informations about the main application +Informations about the main application. ### UpdateInterval `property` diff --git a/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.xml b/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.xml index 468b558..ad99239 100644 --- a/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.xml +++ b/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.xml @@ -263,17 +263,17 @@ - Updates the plugin window + Updates the plugin window. - The plugin class + The plugin class. - Informations about the main application + Informations about the main application. diff --git a/src/DesktopMagicPluginAPI/IPluginData.cs b/src/DesktopMagicPluginAPI/IPluginData.cs index f31780b..3b05e01 100644 --- a/src/DesktopMagicPluginAPI/IPluginData.cs +++ b/src/DesktopMagicPluginAPI/IPluginData.cs @@ -28,7 +28,7 @@ namespace DesktopMagicPluginAPI Point WindowPosition { get; } /// - /// Updates the plugin window + /// Updates the plugin window. /// void UpdateWindow(); } diff --git a/src/DesktopMagicPluginAPI/Plugin.cs b/src/DesktopMagicPluginAPI/Plugin.cs index 38449be..cba7bc8 100644 --- a/src/DesktopMagicPluginAPI/Plugin.cs +++ b/src/DesktopMagicPluginAPI/Plugin.cs @@ -4,14 +4,14 @@ using System.Drawing; namespace DesktopMagicPluginAPI { /// - /// The plugin class + /// The plugin class. /// public abstract class Plugin { private IPluginData application = null; /// - /// Informations about the main application + /// Informations about the main application. /// public IPluginData Application {