mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
Merge branch 'develop'
This commit is contained in:
Binary file not shown.
@@ -2,7 +2,7 @@
|
|||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
#define MyAppName "DesktopMagic"
|
#define MyAppName "DesktopMagic"
|
||||||
#define MyAppVersion "0.0.2.1"
|
#define MyAppVersion "0.0.2.2"
|
||||||
#define MyAppPublisher "Stone_Red"
|
#define MyAppPublisher "Stone_Red"
|
||||||
#define MyAppExeName "DesktopMagic.exe"
|
#define MyAppExeName "DesktopMagic.exe"
|
||||||
|
|
||||||
@@ -36,40 +36,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
|||||||
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
|
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "..\DesktopMagic\bin\Release\net5.0-windows\publish\DesktopMagic.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Stone_Red-C-Sharp-Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.deps.json"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.exe"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.pdb"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.runtimeconfig.dev.json"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagic.runtimeconfig.json"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagicPluginAPI.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\DesktopMagicPluginAPI.pdb"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Google.Apis.Auth.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Google.Apis.Auth.PlatformServices.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Google.Apis.Calendar.v3.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Google.Apis.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Google.Apis.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Hardcodet.NotifyIcon.Wpf.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\MaterialDesignColors.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\MaterialDesignThemes.Wpf.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.Asio.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.Midi.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.Wasapi.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.WinForms.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\NAudio.WinMM.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\System.Drawing.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\System.Management.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Xceed.Wpf.AvalonDock.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Xceed.Wpf.AvalonDock.Themes.Aero.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Xceed.Wpf.AvalonDock.Themes.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Xceed.Wpf.AvalonDock.Themes.VS2010.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\Xceed.Wpf.Toolkit.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
Source: "..\DesktopMagic\bin\Release\net5.0-windows\runtimes\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
VisualStudioVersion = 16.0.31205.134
|
VisualStudioVersion = 16.0.31205.134
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagic", "DesktopMagic\DesktopMagic.csproj", "{B56B4CCC-CF92-4C05-9DEA-57666D81889A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagic", "DesktopMagic\DesktopMagic.csproj", "{B56B4CCC-CF92-4C05-9DEA-57666D81889A}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{A06BD685-7F92-4799-846B-3EC38345108E} = {A06BD685-7F92-4799-846B-3EC38345108E}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagicPluginAPI", "DesktopMagicPluginAPI\DesktopMagicPluginAPI.csproj", "{9D193A10-3E8E-447F-89F1-4B316C2EE37D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagicPluginAPI", "DesktopMagicPluginAPI\DesktopMagicPluginAPI.csproj", "{9D193A10-3E8E-447F-89F1-4B316C2EE37D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System.Windows;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace DesktopMagic
|
namespace DesktopMagic
|
||||||
{
|
{
|
||||||
@@ -7,5 +9,30 @@ namespace DesktopMagic
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
private Mutex _mutex;
|
||||||
|
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
// Try to grab mutex
|
||||||
|
bool createdNew;
|
||||||
|
_mutex = new Mutex(true, $"Stone_Red{DesktopMagic.MainWindow.AppName}", out createdNew);
|
||||||
|
|
||||||
|
//check if creating new was succesfull
|
||||||
|
if (!createdNew)
|
||||||
|
{
|
||||||
|
//Shutdown Aplication
|
||||||
|
Current.Shutdown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Add Event handler to exit event.
|
||||||
|
Exit += CloseMutexHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void CloseMutexHandler(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_mutex?.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,11 +7,16 @@
|
|||||||
<RootNamespace>DesktopMagic</RootNamespace>
|
<RootNamespace>DesktopMagic</RootNamespace>
|
||||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
|
<Authors>Stone_Red</Authors>
|
||||||
|
<Version>0.0.2.2</Version>
|
||||||
|
<PackageProjectUrl>https://github.com/Stone-Red-Code/DesktopMagic</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="icon.ico" />
|
<None Remove="icon.ico" />
|
||||||
<None Remove="icons8_volunteering_26_85L_icon.ico" />
|
<None Remove="icons8_volunteering_26_85L_icon.ico" />
|
||||||
|
<None Remove="icon_Dark.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -29,6 +34,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="icon.ico" />
|
<Resource Include="icon_Dark.ico">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="icon.ico">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -72,6 +72,7 @@ namespace DesktopMagic
|
|||||||
notifyIcon.Visible = true;
|
notifyIcon.Visible = true;
|
||||||
notifyIcon.Text = AppName;
|
notifyIcon.Text = AppName;
|
||||||
notifyIcon.Icon = new System.Drawing.Icon(iconStream);
|
notifyIcon.Icon = new System.Drawing.Icon(iconStream);
|
||||||
|
notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
@@ -772,7 +773,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void NewLayoutButton_Click(object sender, RoutedEventArgs e)
|
private void NewLayoutButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
InputDialog inputDialog = new("Layoutnamen eingeben:");
|
InputDialog inputDialog = new((string)FindResource("enterLayoutName"));
|
||||||
if (inputDialog.ShowDialog() == true)
|
if (inputDialog.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
string content = "";
|
string content = "";
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
public Point WindowPosition => new Point((int)window.Left, (int)window.Top);
|
public Point WindowPosition => new Point((int)window.Left, (int)window.Top);
|
||||||
|
|
||||||
public void UpdateWindow()
|
public void UpdateWindow() => window.UpdatePluginWindow();
|
||||||
{
|
|
||||||
window.UpdatePluginWindow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ using System.Threading;
|
|||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace DesktopMagic
|
namespace DesktopMagic
|
||||||
@@ -190,19 +191,13 @@ namespace DesktopMagic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instanceType.Namespace == nameof(DesktopMagic))
|
|
||||||
{
|
|
||||||
MessageBox.Show("NO!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
Exit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadOptions(instance);
|
LoadOptions(instance);
|
||||||
|
|
||||||
valueTimer = new System.Timers.Timer();
|
valueTimer = new System.Timers.Timer();
|
||||||
valueTimer.Interval = 1000;
|
valueTimer.Interval = 1000;
|
||||||
valueTimer.Elapsed += ValueTimer_Elapsed;
|
valueTimer.Elapsed += ValueTimer_Elapsed;
|
||||||
|
|
||||||
|
pluginClassInstance.Start();
|
||||||
UpdatePluginWindow();
|
UpdatePluginWindow();
|
||||||
|
|
||||||
if (pluginClassInstance.UpdateInterval > 0)
|
if (pluginClassInstance.UpdateInterval > 0)
|
||||||
@@ -249,16 +244,35 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
//Set Arguments
|
//Set Arguments
|
||||||
SolidBrush newBrush = (SolidBrush)MainWindow.GlobalSystemColor;
|
SolidBrush newBrush = (SolidBrush)MainWindow.GlobalSystemColor;
|
||||||
Color color = newBrush.Color;
|
System.Drawing.Color color = newBrush.Color;
|
||||||
string font = MainWindow.GlobalFont;
|
string font = MainWindow.GlobalFont;
|
||||||
|
|
||||||
Bitmap result = pluginClassInstance.Main();
|
try
|
||||||
|
|
||||||
//Update Image
|
|
||||||
Dispatcher.Invoke(() =>
|
|
||||||
{
|
{
|
||||||
image.Source = BitmapToImageSource(result);
|
Bitmap result = pluginClassInstance.Main();
|
||||||
});
|
|
||||||
|
if (pluginClassInstance.UpdateInterval > 0)
|
||||||
|
{
|
||||||
|
valueTimer.Interval = pluginClassInstance.UpdateInterval;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valueTimer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update Image
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
image.Source = BitmapToImageSource(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MainWindow.Logger.Log(ex.ToString(), "Plugin");
|
||||||
|
MessageBox.Show("File execution error:\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
Exit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (stop)
|
if (stop)
|
||||||
{
|
{
|
||||||
@@ -312,12 +326,20 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
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)
|
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
|
#endregion Window Events
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<system:String x:Key="deleteLayout">Layout Löschen</system:String>
|
<system:String x:Key="deleteLayout">Layout Löschen</system:String>
|
||||||
<system:String x:Key="ok">Ok</system:String>
|
<system:String x:Key="ok">Ok</system:String>
|
||||||
<system:String x:Key="cancel">Abbrechen</system:String>
|
<system:String x:Key="cancel">Abbrechen</system:String>
|
||||||
|
<system:String x:Key="enterLayoutName">Layoutnamen eingeben:</system:String>
|
||||||
<col:ArrayList x:Key="musicVisualizerOptionsComboboxItems">
|
<col:ArrayList x:Key="musicVisualizerOptionsComboboxItems">
|
||||||
<system:String>Unten</system:String>
|
<system:String>Unten</system:String>
|
||||||
<system:String>Mitte</system:String>
|
<system:String>Mitte</system:String>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<system:String x:Key="deleteLayout">Delete Layout</system:String>
|
<system:String x:Key="deleteLayout">Delete Layout</system:String>
|
||||||
<system:String x:Key="ok">Ok</system:String>
|
<system:String x:Key="ok">Ok</system:String>
|
||||||
<system:String x:Key="cancel">Cancel</system:String>
|
<system:String x:Key="cancel">Cancel</system:String>
|
||||||
|
<system:String x:Key="enterLayoutName">Enter layout name</system:String>
|
||||||
<col:ArrayList x:Key="musicVisualizerOptionsComboboxItems">
|
<col:ArrayList x:Key="musicVisualizerOptionsComboboxItems">
|
||||||
<system:String>Bottom</system:String>
|
<system:String>Bottom</system:String>
|
||||||
<system:String>Middle</system:String>
|
<system:String>Middle</system:String>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
@@ -1,39 +1,54 @@
|
|||||||
using DesktopMagicPluginAPI;
|
using DesktopMagicPluginAPI;
|
||||||
using DesktopMagicPluginAPI.Inputs;
|
using DesktopMagicPluginAPI.Inputs;
|
||||||
using DesktopMagicPluginAPI.Drawing;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DesktopMagicPlugin.Test
|
namespace DesktopMagicPlugin.Test
|
||||||
{
|
{
|
||||||
public class InputExamplePlugin : Plugin
|
public class GifPlugin : Plugin
|
||||||
{
|
{
|
||||||
public override int UpdateInterval { get; set; } = 0;
|
[Element("Gif path:")]
|
||||||
|
private TextBox input = new TextBox("");
|
||||||
|
|
||||||
[Element("Text:")] //Mark the property as element with the specified description
|
private List<Bitmap> bitmaps = new List<Bitmap>();
|
||||||
private TextBox textBox = new TextBox("abc"); //Create a text box with the specified default value.
|
|
||||||
|
|
||||||
public InputExamplePlugin()
|
public override int UpdateInterval { get; set; } = 100;
|
||||||
|
private int frameCount = -1;
|
||||||
|
|
||||||
|
public GifPlugin()
|
||||||
{
|
{
|
||||||
textBox.OnValueChanged += TextBox_OnValueChanged; //Add an event handler to the "OnValueChanged" event.
|
input.OnValueChanged += Input_OnValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextBox_OnValueChanged()
|
private void Input_OnValueChanged()
|
||||||
{
|
{
|
||||||
Application.UpdateWindow(); //Update the pugin window. (Calls the "Main" method.)
|
if (File.Exists(input.Value))
|
||||||
|
{
|
||||||
|
Image gif = Image.FromFile(input.Value);
|
||||||
|
bitmaps.Clear();
|
||||||
|
for (int i = 0; i < gif.GetFrameCount(FrameDimension.Time); i++)
|
||||||
|
{
|
||||||
|
gif.SelectActiveFrame(FrameDimension.Time, i);
|
||||||
|
|
||||||
|
bitmaps.Add(new Bitmap(gif));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap Main()
|
public override Bitmap Main()
|
||||||
{
|
{
|
||||||
Bitmap bmp = new Bitmap(1000, 1000);
|
if (bitmaps.Count == 0)
|
||||||
|
return new Bitmap(1, 1);
|
||||||
|
|
||||||
using (Graphics g = Graphics.FromImage(bmp))
|
frameCount++;
|
||||||
{
|
|
||||||
g.Clear(Application.Color); //Set the background color to the color specified in the Desktop Magic application.
|
|
||||||
|
|
||||||
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.
|
if (frameCount >= bitmaps.Count)
|
||||||
}
|
frameCount = 0;
|
||||||
|
|
||||||
return bmp; //Return the image.
|
return bitmaps[frameCount];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<AssemblyVersion>0.0.0.2</AssemblyVersion>
|
<AssemblyVersion>0.0.0.2</AssemblyVersion>
|
||||||
<PackageProjectUrl></PackageProjectUrl>
|
<PackageProjectUrl></PackageProjectUrl>
|
||||||
|
<FileVersion>0.0.0.2</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
- [Main()](#M-DesktopMagicPluginAPI-Plugin-Main 'DesktopMagicPluginAPI.Plugin.Main')
|
- [Main()](#M-DesktopMagicPluginAPI-Plugin-Main 'DesktopMagicPluginAPI.Plugin.Main')
|
||||||
- [OnMouseClick(position)](#M-DesktopMagicPluginAPI-Plugin-OnMouseClick-System-Drawing-Point- 'DesktopMagicPluginAPI.Plugin.OnMouseClick(System.Drawing.Point)')
|
- [OnMouseClick(position)](#M-DesktopMagicPluginAPI-Plugin-OnMouseClick-System-Drawing-Point- 'DesktopMagicPluginAPI.Plugin.OnMouseClick(System.Drawing.Point)')
|
||||||
- [OnMouseMove(position)](#M-DesktopMagicPluginAPI-Plugin-OnMouseMove-System-Drawing-Point- 'DesktopMagicPluginAPI.Plugin.OnMouseMove(System.Drawing.Point)')
|
- [OnMouseMove(position)](#M-DesktopMagicPluginAPI-Plugin-OnMouseMove-System-Drawing-Point- 'DesktopMagicPluginAPI.Plugin.OnMouseMove(System.Drawing.Point)')
|
||||||
|
- [Start()](#M-DesktopMagicPluginAPI-Plugin-Start 'DesktopMagicPluginAPI.Plugin.Start')
|
||||||
- [Slider](#T-DesktopMagicPluginAPI-Inputs-Slider 'DesktopMagicPluginAPI.Inputs.Slider')
|
- [Slider](#T-DesktopMagicPluginAPI-Inputs-Slider 'DesktopMagicPluginAPI.Inputs.Slider')
|
||||||
- [#ctor(min,max,value)](#M-DesktopMagicPluginAPI-Inputs-Slider-#ctor-System-Double,System-Double,System-Double- 'DesktopMagicPluginAPI.Inputs.Slider.#ctor(System.Double,System.Double,System.Double)')
|
- [#ctor(min,max,value)](#M-DesktopMagicPluginAPI-Inputs-Slider-#ctor-System-Double,System-Double,System-Double- 'DesktopMagicPluginAPI.Inputs.Slider.#ctor(System.Double,System.Double,System.Double)')
|
||||||
- [Maximum](#P-DesktopMagicPluginAPI-Inputs-Slider-Maximum 'DesktopMagicPluginAPI.Inputs.Slider.Maximum')
|
- [Maximum](#P-DesktopMagicPluginAPI-Inputs-Slider-Maximum 'DesktopMagicPluginAPI.Inputs.Slider.Maximum')
|
||||||
@@ -338,7 +339,7 @@ Gets the window size of the main application.
|
|||||||
|
|
||||||
##### Summary
|
##### Summary
|
||||||
|
|
||||||
Updates the plugin window
|
Updates the plugin window.
|
||||||
|
|
||||||
##### Parameters
|
##### Parameters
|
||||||
|
|
||||||
@@ -445,14 +446,14 @@ DesktopMagicPluginAPI
|
|||||||
|
|
||||||
##### Summary
|
##### Summary
|
||||||
|
|
||||||
The plugin class
|
The plugin class.
|
||||||
|
|
||||||
<a name='P-DesktopMagicPluginAPI-Plugin-Application'></a>
|
<a name='P-DesktopMagicPluginAPI-Plugin-Application'></a>
|
||||||
### Application `property`
|
### Application `property`
|
||||||
|
|
||||||
##### Summary
|
##### Summary
|
||||||
|
|
||||||
Informations about the main application
|
Informations about the main application.
|
||||||
|
|
||||||
<a name='P-DesktopMagicPluginAPI-Plugin-UpdateInterval'></a>
|
<a name='P-DesktopMagicPluginAPI-Plugin-UpdateInterval'></a>
|
||||||
### UpdateInterval `property`
|
### UpdateInterval `property`
|
||||||
@@ -502,6 +503,17 @@ Occurs when the mouse pointer is moved over the control.
|
|||||||
| ---- | ---- | ----------- |
|
| ---- | ---- | ----------- |
|
||||||
| position | [System.Drawing.Point](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Point 'System.Drawing.Point') | |
|
| position | [System.Drawing.Point](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Point 'System.Drawing.Point') | |
|
||||||
|
|
||||||
|
<a name='M-DesktopMagicPluginAPI-Plugin-Start'></a>
|
||||||
|
### Start() `method`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Occurs once when the pugin gets activated.
|
||||||
|
|
||||||
|
##### Parameters
|
||||||
|
|
||||||
|
This method has no parameters.
|
||||||
|
|
||||||
<a name='T-DesktopMagicPluginAPI-Inputs-Slider'></a>
|
<a name='T-DesktopMagicPluginAPI-Inputs-Slider'></a>
|
||||||
## Slider `type`
|
## Slider `type`
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="E:DesktopMagicPluginAPI.Inputs.Button.OnClick">
|
<member name="E:DesktopMagicPluginAPI.Inputs.Button.OnClick">
|
||||||
<summary>
|
<summary>
|
||||||
Occurs when the button is clicked.
|
Occurs when the button gets clicked.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:DesktopMagicPluginAPI.Inputs.Button.Value">
|
<member name="P:DesktopMagicPluginAPI.Inputs.Button.Value">
|
||||||
@@ -263,17 +263,17 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="M:DesktopMagicPluginAPI.IPluginData.UpdateWindow">
|
<member name="M:DesktopMagicPluginAPI.IPluginData.UpdateWindow">
|
||||||
<summary>
|
<summary>
|
||||||
Updates the plugin window
|
Updates the plugin window.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:DesktopMagicPluginAPI.Plugin">
|
<member name="T:DesktopMagicPluginAPI.Plugin">
|
||||||
<summary>
|
<summary>
|
||||||
The plugin class
|
The plugin class.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:DesktopMagicPluginAPI.Plugin.Application">
|
<member name="P:DesktopMagicPluginAPI.Plugin.Application">
|
||||||
<summary>
|
<summary>
|
||||||
Informations about the main application
|
Informations about the main application.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:DesktopMagicPluginAPI.Plugin.UpdateInterval">
|
<member name="P:DesktopMagicPluginAPI.Plugin.UpdateInterval">
|
||||||
@@ -281,6 +281,11 @@
|
|||||||
Gets or sets the interval, expressed in milliseconds, at which to call the <see cref="M:DesktopMagicPluginAPI.Plugin.Main"/> method.
|
Gets or sets the interval, expressed in milliseconds, at which to call the <see cref="M:DesktopMagicPluginAPI.Plugin.Main"/> method.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DesktopMagicPluginAPI.Plugin.Start">
|
||||||
|
<summary>
|
||||||
|
Occurs once when the pugin gets activated.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:DesktopMagicPluginAPI.Plugin.Main">
|
<member name="M:DesktopMagicPluginAPI.Plugin.Main">
|
||||||
<summary>
|
<summary>
|
||||||
Occurs when the <see cref="P:DesktopMagicPluginAPI.Plugin.UpdateInterval"/> elapses.
|
Occurs when the <see cref="P:DesktopMagicPluginAPI.Plugin.UpdateInterval"/> elapses.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace DesktopMagicPluginAPI
|
|||||||
Point WindowPosition { get; }
|
Point WindowPosition { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the plugin window
|
/// Updates the plugin window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void UpdateWindow();
|
void UpdateWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace DesktopMagicPluginAPI.Inputs
|
|||||||
public class Button : Element
|
public class Button : Element
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the button is clicked.
|
/// Occurs when the button gets clicked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action OnClick;
|
public event Action OnClick;
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ using System.Drawing;
|
|||||||
namespace DesktopMagicPluginAPI
|
namespace DesktopMagicPluginAPI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The plugin class
|
/// The plugin class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class Plugin
|
public abstract class Plugin
|
||||||
{
|
{
|
||||||
private IPluginData application = null;
|
private IPluginData application = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Informations about the main application
|
/// Informations about the main application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IPluginData Application
|
public IPluginData Application
|
||||||
{
|
{
|
||||||
@@ -34,6 +34,13 @@ namespace DesktopMagicPluginAPI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual int UpdateInterval { get; set; } = 1000;
|
public virtual int UpdateInterval { get; set; } = 1000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs once when the pugin gets activated.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void Start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the <see cref="UpdateInterval"/> elapses.
|
/// Occurs when the <see cref="UpdateInterval"/> elapses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user