mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 17:06:12 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b0f208098 | ||
|
|
ac49916308 | ||
|
|
83f5b28d5c | ||
|
|
d8a895b240 | ||
|
|
ef27ace78b | ||
|
|
0f6e8437fd | ||
|
|
5bc35cf92b | ||
|
|
2df2ef3b11 | ||
|
|
603a78935b | ||
|
|
40d1232e33 | ||
|
|
1cde9442ef | ||
|
|
90ee56be94 | ||
|
|
aed4b7de64 | ||
|
|
101b516ca8 | ||
|
|
c551dafeed | ||
|
|
7d2f68a66a | ||
|
|
efd75b0a42 | ||
|
|
74bff47ce3 | ||
|
|
6e4757adea | ||
|
|
e00c873bd5 | ||
|
|
d70e6229cc | ||
|
|
f94f24297e | ||
|
|
36e09acd0e |
@@ -4,6 +4,7 @@
|
|||||||
> You can add useful elements to your desktop like a clock, a audio visualizer or even your own plugins!
|
> You can add useful elements to your desktop like a clock, a audio visualizer or even your own plugins!
|
||||||
|
|
||||||
- [Releases](https://github.com/Stone-Red-Code/DesktopMagic/releases)
|
- [Releases](https://github.com/Stone-Red-Code/DesktopMagic/releases)
|
||||||
|
- [Download Plugins](https://github.com/Stone-Red-Code/DesktopMagic-Plugins)
|
||||||
- [Plugin Documentation](https://github.com/Stone-Red-Code/DesktopMagic/wiki)
|
- [Plugin Documentation](https://github.com/Stone-Red-Code/DesktopMagic/wiki)
|
||||||
- [Licence](https://github.com/Stone-Red-Code/DesktopMagic/blob/main/LICENSE)
|
- [Licence](https://github.com/Stone-Red-Code/DesktopMagic/blob/main/LICENSE)
|
||||||
|
|
||||||
|
|||||||
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.2"
|
#define MyAppVersion "0.0.3.0"
|
||||||
#define MyAppPublisher "Stone_Red"
|
#define MyAppPublisher "Stone_Red"
|
||||||
#define MyAppExeName "DesktopMagic.exe"
|
#define MyAppExeName "DesktopMagic.exe"
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagicPlugin.Test", "
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagic.Installer", "DesktopMagic.Installer\DesktopMagic.Installer.csproj", "{A06BD685-7F92-4799-846B-3EC38345108E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagic.Installer", "DesktopMagic.Installer\DesktopMagic.Installer.csproj", "{A06BD685-7F92-4799-846B-3EC38345108E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{10A138D6-41F0-4DBB-BC39-D93467B4D982}"
|
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
.editorconfig = .editorconfig
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
using System;
|
using AlwaysUpToDate;
|
||||||
|
|
||||||
|
using Stone_Red_Utilities.Logging;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
@@ -9,30 +13,118 @@ namespace DesktopMagic
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private Mutex _mutex;
|
private readonly string logFilePath;
|
||||||
|
private readonly Mutex _mutex;
|
||||||
|
#if DEBUG
|
||||||
|
private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/develop/update/updateInfo.json");
|
||||||
|
#else
|
||||||
|
private readonly Updater updater = new Updater(TimeSpan.FromHours(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/main/update/updateInfo.json");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public const string AppName = "Desktop Magic";
|
||||||
|
public static string ApplicationDataPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + AppName;
|
||||||
|
|
||||||
|
public static Logger Logger { get; } = new Logger();
|
||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
|
logFilePath = ApplicationDataPath + "\\Log.log";
|
||||||
|
Setup();
|
||||||
// Try to grab mutex
|
// Try to grab mutex
|
||||||
bool createdNew;
|
_mutex = new Mutex(true, $"Stone_Red{AppName}", out bool createdNew);
|
||||||
_mutex = new Mutex(true, $"Stone_Red{DesktopMagic.MainWindow.AppName}", out createdNew);
|
|
||||||
|
|
||||||
//check if creating new was succesfull
|
//check if creating new was succesfull
|
||||||
if (!createdNew)
|
if (!createdNew)
|
||||||
{
|
{
|
||||||
|
Logger.Log("Shutting down because other instance already running.", "Setup");
|
||||||
//Shutdown Aplication
|
//Shutdown Aplication
|
||||||
Current.Shutdown();
|
Current.Shutdown();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add Event handler to exit event.
|
|
||||||
Exit += CloseMutexHandler;
|
Exit += CloseMutexHandler;
|
||||||
|
|
||||||
|
updater.ProgressChanged += Updater_ProgressChanged;
|
||||||
|
updater.OnException += Updater_OnException;
|
||||||
|
updater.NoUpdateAvailible += Updater_NoUpdateAvailible;
|
||||||
|
updater.UpdateAvailible += Updater_UpdateAvailible;
|
||||||
|
updater.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void CloseMutexHandler(object sender, EventArgs e)
|
private void Updater_UpdateAvailible(string version, string additionalInformation)
|
||||||
|
{
|
||||||
|
updater.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Updater_NoUpdateAvailible()
|
||||||
|
{
|
||||||
|
Logger.Log("No update avalible.", "Updater");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Updater_OnException(Exception exception)
|
||||||
|
{
|
||||||
|
Logger.Log(exception.ToString(), "Updater");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Updater_ProgressChanged(long? totalFileSize, long totalBytesDownloaded, double? progressPercentage)
|
||||||
|
{
|
||||||
|
Logger.Log($"{progressPercentage}% {totalBytesDownloaded}/{totalFileSize}", "Updater");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CloseMutexHandler(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_mutex?.Close();
|
_mutex?.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Setup()
|
||||||
|
{
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
|
Logger.Config = new LogConfig()
|
||||||
|
{
|
||||||
|
FatalConfig = new OutputConfig()
|
||||||
|
{
|
||||||
|
Color = ConsoleColor.DarkRed,
|
||||||
|
LogTarget = LogTarget.DebugConsole | LogTarget.File,
|
||||||
|
FilePath = logFilePath
|
||||||
|
},
|
||||||
|
ErrorConfig = new OutputConfig()
|
||||||
|
{
|
||||||
|
Color = ConsoleColor.Red,
|
||||||
|
LogTarget = LogTarget.DebugConsole | LogTarget.File,
|
||||||
|
FilePath = logFilePath
|
||||||
|
},
|
||||||
|
WarnConfig = new OutputConfig()
|
||||||
|
{
|
||||||
|
Color = ConsoleColor.Yellow,
|
||||||
|
LogTarget = LogTarget.DebugConsole | LogTarget.File,
|
||||||
|
FilePath = logFilePath
|
||||||
|
},
|
||||||
|
InfoConfig = new OutputConfig()
|
||||||
|
{
|
||||||
|
Color = ConsoleColor.White,
|
||||||
|
LogTarget = LogTarget.Console | LogTarget.File,
|
||||||
|
FilePath = logFilePath
|
||||||
|
},
|
||||||
|
DebugConfig = new OutputConfig()
|
||||||
|
{
|
||||||
|
Color = ConsoleColor.Gray,
|
||||||
|
LogTarget = LogTarget.DebugConsole,
|
||||||
|
},
|
||||||
|
FormatConfig = new FormatConfig()
|
||||||
|
{
|
||||||
|
DebugConsoleFormat = $"> {{{LogFormatType.DateTime}:hh:mm:ss}} | {{{LogFormatType.LogSeverity},-5}} | {{{LogFormatType.Message}}}\n> at {{{LogFormatType.LineNumber},3}} | {{{LogFormatType.FilePath}}}"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Logger.ClearLogFile(LogSeverity.Info);
|
||||||
|
Logger.Log("Log setup complete.", "Setup");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
Exception exception = (Exception)e.ExceptionObject;
|
||||||
|
Logger.Log(exception + (e.IsTerminating ? "\t Process terminating!" : ""), exception.Source, LogSeverity.Fatal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,10 @@ using Google.Apis.Calendar.v3;
|
|||||||
using Google.Apis.Calendar.v3.Data;
|
using Google.Apis.Calendar.v3.Data;
|
||||||
using Google.Apis.Services;
|
using Google.Apis.Services;
|
||||||
using Google.Apis.Util.Store;
|
using Google.Apis.Util.Store;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@@ -14,21 +16,22 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
private static string[] Scopes = { CalendarService.Scope.CalendarReadonly };
|
private static string[] Scopes = { CalendarService.Scope.CalendarReadonly };
|
||||||
|
|
||||||
private static string ApplicationName = "Google Calendar API .NET " + MainWindow.AppName;
|
private static string ApplicationName = "Google Calendar API .NET " + App.AppName;
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public (List<string>, List<string>) GetEvents()
|
public (List<string>, List<string>) GetEvents()
|
||||||
{
|
{
|
||||||
List<string> upcomingEventNames = new List<string>();
|
List<string> upcomingEventNames = new List<string>();
|
||||||
List<string> upcomingEventTimes = new List<string>();
|
List<string> upcomingEventTimes = new List<string>();
|
||||||
UserCredential credential;
|
UserCredential credential;
|
||||||
Console.WriteLine("1");
|
|
||||||
|
|
||||||
if (!File.Exists("credentials.json"))
|
if (!File.Exists("credentials.json"))
|
||||||
return (new(), new());
|
|
||||||
using (var stream =
|
|
||||||
new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
{
|
||||||
Console.WriteLine("2");
|
return (new(), new());
|
||||||
|
}
|
||||||
|
|
||||||
|
using (FileStream stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
// The file token.json stores the user's access and refresh tokens, and is created
|
// The file token.json stores the user's access and refresh tokens, and is created
|
||||||
// automatically when the authorization flow completes for the first time.
|
// automatically when the authorization flow completes for the first time.
|
||||||
string credPath = "token.json";
|
string credPath = "token.json";
|
||||||
@@ -38,19 +41,16 @@ namespace DesktopMagic
|
|||||||
"user",
|
"user",
|
||||||
CancellationToken.None,
|
CancellationToken.None,
|
||||||
new FileDataStore(credPath, true)).Result;
|
new FileDataStore(credPath, true)).Result;
|
||||||
Console.WriteLine("Credential file saved to: " + credPath);
|
Debug.WriteLine("Credential file saved to: " + credPath);
|
||||||
}
|
}
|
||||||
Console.WriteLine("3");
|
|
||||||
|
|
||||||
// Create Google Calendar API service.
|
// Create Google Calendar API service.
|
||||||
var service = new CalendarService(new BaseClientService.Initializer()
|
CalendarService service = new CalendarService(new BaseClientService.Initializer()
|
||||||
{
|
{
|
||||||
HttpClientInitializer = credential,
|
HttpClientInitializer = credential,
|
||||||
ApplicationName = ApplicationName,
|
ApplicationName = ApplicationName,
|
||||||
});
|
});
|
||||||
|
|
||||||
Console.WriteLine("4");
|
|
||||||
|
|
||||||
// Define parameters of request.
|
// Define parameters of request.
|
||||||
EventsResource.ListRequest request = service.Events.List("primary");
|
EventsResource.ListRequest request = service.Events.List("primary");
|
||||||
request.TimeMin = DateTime.Now;
|
request.TimeMin = DateTime.Now;
|
||||||
@@ -59,14 +59,11 @@ namespace DesktopMagic
|
|||||||
request.MaxResults = 10;
|
request.MaxResults = 10;
|
||||||
request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;
|
request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;
|
||||||
|
|
||||||
Console.WriteLine("5");
|
|
||||||
// List events.
|
// List events.
|
||||||
Events events = request.Execute();
|
Events events = request.Execute();
|
||||||
Console.WriteLine("6");
|
|
||||||
Console.WriteLine("Upcoming events:");
|
|
||||||
if (events.Items != null && events.Items.Count > 0)
|
if (events.Items != null && events.Items.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var eventItem in events.Items)
|
foreach (Event eventItem in events.Items)
|
||||||
{
|
{
|
||||||
if (upcomingEventNames.Count < 10)
|
if (upcomingEventNames.Count < 10)
|
||||||
{
|
{
|
||||||
@@ -80,8 +77,6 @@ namespace DesktopMagic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("7");
|
|
||||||
return (upcomingEventNames, upcomingEventTimes);
|
return (upcomingEventNames, upcomingEventTimes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -33,7 +34,7 @@ namespace DesktopMagic
|
|||||||
w.WindowStyle = WindowStyle.ToolWindow;
|
w.WindowStyle = WindowStyle.ToolWindow;
|
||||||
w.ShowInTaskbar = false;
|
w.ShowInTaskbar = false;
|
||||||
w.Show();
|
w.Show();
|
||||||
this.Owner = w;
|
Owner = w;
|
||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
Timer t = new Timer();
|
Timer t = new Timer();
|
||||||
@@ -43,14 +44,15 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
Timer valueTimer = new Timer();
|
Timer valueTimer = new Timer();
|
||||||
valueTimer.Interval = 600000;
|
valueTimer.Interval = 600000;
|
||||||
valueTimer.Elapsed += ValueTimer_Elapsed; ;
|
valueTimer.Elapsed += ValueTimer_Elapsed;
|
||||||
|
;
|
||||||
valueTimer.Start();
|
valueTimer.Start();
|
||||||
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + MainWindow.AppName);
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
this.Top = double.Parse(key.GetValue("CalendarWindowTop", 100).ToString());
|
Top = double.Parse(key.GetValue("CalendarWindowTop", 100).ToString());
|
||||||
this.Left = double.Parse(key.GetValue("CalendarWindowLeft", 100).ToString());
|
Left = double.Parse(key.GetValue("CalendarWindowLeft", 100).ToString());
|
||||||
this.Height = double.Parse(key.GetValue("CalendarWindowHeight", 200).ToString());
|
Height = double.Parse(key.GetValue("CalendarWindowHeight", 200).ToString());
|
||||||
this.Width = double.Parse(key.GetValue("CalendarWindowWidth", 500).ToString());
|
Width = double.Parse(key.GetValue("CalendarWindowWidth", 500).ToString());
|
||||||
//this.IsEnabled = false;
|
//this.IsEnabled = false;
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
@@ -68,7 +70,7 @@ namespace DesktopMagic
|
|||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
|
|
||||||
//Set the window style to noactivate.
|
//Set the window style to noactivate.
|
||||||
var helper = new WindowInteropHelper(this);
|
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||||
}
|
}
|
||||||
@@ -92,12 +94,12 @@ namespace DesktopMagic
|
|||||||
if (MainWindow.EditMode)
|
if (MainWindow.EditMode)
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Visible;
|
panel.Visibility = Visibility.Visible;
|
||||||
new WindowPos().SetIsLocked(this, false);
|
WindowPos.SetIsLocked(this, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
new WindowPos().SetIsLocked(this, true);
|
WindowPos.SetIsLocked(this, true);
|
||||||
}
|
}
|
||||||
if (MainWindow.GlobalFont != oldFont || MainWindow.GlobalColor != oldColor)
|
if (MainWindow.GlobalFont != oldFont || MainWindow.GlobalColor != oldColor)
|
||||||
{
|
{
|
||||||
@@ -143,15 +145,15 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_LocationChanged(object sender, EventArgs e)
|
private void Window_LocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("CalendarWindowTop", this.Top);
|
key.SetValue("CalendarWindowTop", Top);
|
||||||
key.SetValue("CalendarWindowLeft", this.Left);
|
key.SetValue("CalendarWindowLeft", Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("CalendarWindowHeight", this.Height);
|
key.SetValue("CalendarWindowHeight", Height);
|
||||||
key.SetValue("CalendarWindowWidth", this.Width);
|
key.SetValue("CalendarWindowWidth", Width);
|
||||||
tileBar.CaptionHeight = this.ActualHeight - 10;
|
tileBar.CaptionHeight = ActualHeight - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
@@ -31,7 +32,7 @@ namespace DesktopMagic
|
|||||||
ShowInTaskbar = false
|
ShowInTaskbar = false
|
||||||
};
|
};
|
||||||
w.Show();
|
w.Show();
|
||||||
this.Owner = w;
|
Owner = w;
|
||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
cpuCounter.CategoryName = "Processor";
|
cpuCounter.CategoryName = "Processor";
|
||||||
@@ -45,15 +46,16 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
Timer valueTimer = new Timer();
|
Timer valueTimer = new Timer();
|
||||||
valueTimer.Interval = 1000;
|
valueTimer.Interval = 1000;
|
||||||
valueTimer.Elapsed += ValueTimer_Elapsed; ;
|
valueTimer.Elapsed += ValueTimer_Elapsed;
|
||||||
|
;
|
||||||
valueTimer.Start();
|
valueTimer.Start();
|
||||||
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + MainWindow.AppName);
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
this.Top = double.Parse(key.GetValue("CpuUsageWindowTop", 100).ToString());
|
Top = double.Parse(key.GetValue("CpuUsageWindowTop", 100).ToString());
|
||||||
this.Left = double.Parse(key.GetValue("CpuUsageWindowLeft", 100).ToString());
|
Left = double.Parse(key.GetValue("CpuUsageWindowLeft", 100).ToString());
|
||||||
this.Height = double.Parse(key.GetValue("CpuUsageWindowHeight", 200).ToString());
|
Height = double.Parse(key.GetValue("CpuUsageWindowHeight", 200).ToString());
|
||||||
this.Width = double.Parse(key.GetValue("CpuUsageWindowWidth", 500).ToString());
|
Width = double.Parse(key.GetValue("CpuUsageWindowWidth", 500).ToString());
|
||||||
this.IsEnabled = false;
|
IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSourceInitialized(EventArgs e)
|
protected override void OnSourceInitialized(EventArgs e)
|
||||||
@@ -61,7 +63,7 @@ namespace DesktopMagic
|
|||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
|
|
||||||
//Set the window style to noactivate.
|
//Set the window style to noactivate.
|
||||||
var helper = new WindowInteropHelper(this);
|
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||||
}
|
}
|
||||||
@@ -73,12 +75,12 @@ namespace DesktopMagic
|
|||||||
if (MainWindow.EditMode)
|
if (MainWindow.EditMode)
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Visible;
|
panel.Visibility = Visibility.Visible;
|
||||||
new WindowPos().SetIsLocked(this, false);
|
WindowPos.SetIsLocked(this, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
new WindowPos().SetIsLocked(this, true);
|
WindowPos.SetIsLocked(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||||
@@ -88,9 +90,10 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void ValueTimer_Elapsed(object sender, ElapsedEventArgs e)
|
private void ValueTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
|
string cpuUsage = GetCpuUsage();
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
textBlock.Text = GetCpuUsage();
|
textBlock.Text = cpuUsage;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,15 +104,15 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_LocationChanged(object sender, EventArgs e)
|
private void Window_LocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("CpuUsageWindowTop", this.Top);
|
key.SetValue("CpuUsageWindowTop", Top);
|
||||||
key.SetValue("CpuUsageWindowLeft", this.Left);
|
key.SetValue("CpuUsageWindowLeft", Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("CpuUsageWindowHeight", this.Height);
|
key.SetValue("CpuUsageWindowHeight", Height);
|
||||||
key.SetValue("CpuUsageWindowWidth", this.Width);
|
key.SetValue("CpuUsageWindowWidth", Width);
|
||||||
tileBar.CaptionHeight = this.ActualHeight - 10;
|
tileBar.CaptionHeight = ActualHeight - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -27,7 +28,7 @@ namespace DesktopMagic
|
|||||||
w.WindowStyle = WindowStyle.ToolWindow;
|
w.WindowStyle = WindowStyle.ToolWindow;
|
||||||
w.ShowInTaskbar = false;
|
w.ShowInTaskbar = false;
|
||||||
w.Show();
|
w.Show();
|
||||||
this.Owner = w;
|
Owner = w;
|
||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
Timer t = new Timer();
|
Timer t = new Timer();
|
||||||
@@ -35,12 +36,12 @@ namespace DesktopMagic
|
|||||||
t.Elapsed += T_Elapsed;
|
t.Elapsed += T_Elapsed;
|
||||||
t.Start();
|
t.Start();
|
||||||
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + MainWindow.AppName);
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
this.Top = double.Parse(key.GetValue("DateWindowTop", 100).ToString());
|
Top = double.Parse(key.GetValue("DateWindowTop", 100).ToString());
|
||||||
this.Left = double.Parse(key.GetValue("DateWindowLeft", 100).ToString());
|
Left = double.Parse(key.GetValue("DateWindowLeft", 100).ToString());
|
||||||
this.Height = double.Parse(key.GetValue("DateWindowHeight", 200).ToString());
|
Height = double.Parse(key.GetValue("DateWindowHeight", 200).ToString());
|
||||||
this.Width = double.Parse(key.GetValue("DateWindowWidth", 500).ToString());
|
Width = double.Parse(key.GetValue("DateWindowWidth", 500).ToString());
|
||||||
this.IsEnabled = false;
|
IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSourceInitialized(EventArgs e)
|
protected override void OnSourceInitialized(EventArgs e)
|
||||||
@@ -48,7 +49,7 @@ namespace DesktopMagic
|
|||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
|
|
||||||
//Set the window style to noactivate.
|
//Set the window style to noactivate.
|
||||||
var helper = new WindowInteropHelper(this);
|
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||||
}
|
}
|
||||||
@@ -60,12 +61,12 @@ namespace DesktopMagic
|
|||||||
if (MainWindow.EditMode)
|
if (MainWindow.EditMode)
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Visible;
|
panel.Visibility = Visibility.Visible;
|
||||||
new WindowPos().SetIsLocked(this, false);
|
WindowPos.SetIsLocked(this, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
new WindowPos().SetIsLocked(this, true);
|
WindowPos.SetIsLocked(this, true);
|
||||||
}
|
}
|
||||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||||
textBlock.Foreground = MainWindow.GlobalColor;
|
textBlock.Foreground = MainWindow.GlobalColor;
|
||||||
@@ -75,15 +76,15 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_LocationChanged(object sender, EventArgs e)
|
private void Window_LocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("DateWindowTop", this.Top);
|
key.SetValue("DateWindowTop", Top);
|
||||||
key.SetValue("DateWindowLeft", this.Left);
|
key.SetValue("DateWindowLeft", Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("DateWindowHeight", this.Height);
|
key.SetValue("DateWindowHeight", Height);
|
||||||
key.SetValue("DateWindowWidth", this.Width);
|
key.SetValue("DateWindowWidth", Width);
|
||||||
tileBar.CaptionHeight = this.ActualHeight - 10;
|
tileBar.CaptionHeight = ActualHeight - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,9 +8,15 @@
|
|||||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
<Authors>Stone_Red</Authors>
|
<Authors>Stone_Red</Authors>
|
||||||
<Version>0.0.2.2</Version>
|
<Version>0.0.3.0</Version>
|
||||||
<PackageProjectUrl>https://github.com/Stone-Red-Code/DesktopMagic</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Stone-Red-Code/DesktopMagic</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
|
||||||
|
<AssemblyVersion>0.0.3.0</AssemblyVersion>
|
||||||
|
<FileVersion>0.0.3.0</FileVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -20,12 +26,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AlwaysUpToDate" Version="1.0.0.4" />
|
||||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.1.0" />
|
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.1.0" />
|
||||||
<PackageReference Include="Google.Apis.Calendar.v3" Version="1.51.0.2312" />
|
<PackageReference Include="Google.Apis.Calendar.v3" Version="1.55.0.2410" />
|
||||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="4.0.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="4.0.0" />
|
||||||
<PackageReference Include="NAudio" Version="2.0.0" />
|
<PackageReference Include="NAudio" Version="2.0.1" />
|
||||||
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.2.1" />
|
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.3.1" />
|
||||||
<PackageReference Include="System.Management" Version="5.0.0" />
|
<PackageReference Include="System.Management" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -6,3 +6,4 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
[assembly: SuppressMessage("Performance", "CA1822:Member als statisch markieren", Justification = "<Ausstehend>", Scope = "member", Target = "~M:DesktopMagic.PluginWindow.LoadOptions(System.Object)")]
|
[assembly: SuppressMessage("Performance", "CA1822:Member als statisch markieren", Justification = "<Ausstehend>", Scope = "member", Target = "~M:DesktopMagic.PluginWindow.LoadOptions(System.Object)")]
|
||||||
|
[assembly: SuppressMessage("Style", "IDE0090:Use 'new(...)'", Justification = "<Pending>", Scope = "member", Target = "~M:DesktopMagic.MainWindow.GithubButton_Click(System.Object,System.Windows.RoutedEventArgs)")]
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
Background="{DynamicResource MaterialDesignPaper}"
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
FontFamily="{DynamicResource MaterialDesignFont}"
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
Height="520"
|
Height="520"
|
||||||
Width="550"
|
Width="570"
|
||||||
MinHeight="520"
|
MinHeight="520"
|
||||||
MinWidth="500"
|
MinWidth="570"
|
||||||
WindowState="Minimized"
|
WindowState="Minimized"
|
||||||
StateChanged="Window_StateChanged"
|
StateChanged="Window_StateChanged"
|
||||||
Loaded="Window_Loaded">
|
Loaded="Window_Loaded">
|
||||||
@@ -38,14 +38,14 @@
|
|||||||
<CheckBox x:Name="TimeCb" Content="{DynamicResource time}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
<CheckBox x:Name="TimeCb" Content="{DynamicResource time}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
||||||
<CheckBox x:Name="DateCb" Content="{DynamicResource date}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
<CheckBox x:Name="DateCb" Content="{DynamicResource date}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
||||||
<CheckBox x:Name="CpuUsageCb" Content="{DynamicResource cpuUsage}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
<CheckBox x:Name="CpuUsageCb" Content="{DynamicResource cpuUsage}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
||||||
<CheckBox x:Name="CalendarCb" Content="{DynamicResource googleCalendar}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
<CheckBox x:Name="CalendarCb" Content="{DynamicResource googleCalendar}" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" Visibility="Collapsed"/> <!--Currently disabled because it's not working-->
|
||||||
<CheckBox x:Name="MusicVisualizerCb" Content="{DynamicResource musicVisualizer}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
<CheckBox x:Name="MusicVisualizerCb" Content="{DynamicResource musicVisualizer}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="CheckBox_Click" Style="{StaticResource MaterialDesignDarkCheckBox}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
<DockPanel Grid.Column="1" Margin="2.5,0,0,0">
|
<DockPanel Grid.Column="1" Margin="2.5,0,0,0">
|
||||||
<ComboBox x:Name="optionsComboBox" DockPanel.Dock="Top" Height="24" SelectedIndex="0" DisplayMemberPath="Item1" SelectionChanged="OptionsComboBox_SelectionChanged" Background="#FFECECEC" />
|
<ComboBox x:Name="optionsComboBox" DockPanel.Dock="Top" Height="24" SelectedIndex="0" DisplayMemberPath="Item1" SelectionChanged="OptionsComboBox_SelectionChanged" Background="#FFECECEC" Padding="4" VerticalAlignment="Center"/>
|
||||||
<ScrollViewer Background="#FFBBBBBB">
|
<ScrollViewer Background="#FFBBBBBB">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel x:Name="optionsPanel" Margin="3,3,3,0" HorizontalAlignment="Stretch" Visibility="Collapsed" >
|
<StackPanel x:Name="optionsPanel" Margin="3,3,3,0" HorizontalAlignment="Stretch" Visibility="Collapsed" >
|
||||||
@@ -104,15 +104,20 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Rectangle Fill="#FFC5C5C5" Stroke="#FFC5C5C5" Grid.ColumnSpan="2" />
|
<Rectangle Fill="#FFC5C5C5" Stroke="#FFC5C5C5" Grid.ColumnSpan="3" />
|
||||||
<StackPanel Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
<StackPanel Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
||||||
<ComboBox x:Name="layoutsComboBox" HorizontalAlignment="Left" Margin="0,0,0,5" Width="170" Height="20" SelectionChanged="LayoutsComboBox_SelectionChanged" />
|
<ComboBox x:Name="layoutsComboBox" HorizontalAlignment="Left" Margin="0,0,0,5" Width="170" Height="20" SelectionChanged="LayoutsComboBox_SelectionChanged" />
|
||||||
<Button x:Name="newLayoutButton" Content="{DynamicResource newLayout}" Margin="0,0,0,5" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="170" Click="NewLayoutButton_Click" FontWeight="Regular" />
|
<Button x:Name="newLayoutButton" Content="{DynamicResource newLayout}" Margin="0,0,0,5" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="170" Click="NewLayoutButton_Click" FontWeight="Regular" />
|
||||||
<Button x:Name="removeLayoutButton" Content="{DynamicResource deleteLayout}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="170" Click="RemoveLayoutButton_Click" FontWeight="Regular" />
|
<Button x:Name="removeLayoutButton" Content="{DynamicResource deleteLayout}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="170" Click="RemoveLayoutButton_Click" FontWeight="Regular" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="1" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="1" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
||||||
|
<Button x:Name="downloadPluginsButton" Content="{DynamicResource downloadPlugins}" Margin="0,0,0,5" HorizontalAlignment="Center" Width="170" Click="DownloadPluginsButton_Click" FontWeight="Regular" Cursor="Hand" />
|
||||||
|
<Button x:Name="githubButton" Content="GitHub" HorizontalAlignment="Center" Width="170" Click="GithubButton_Click" FontWeight="Regular" Cursor="Hand" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="2" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
||||||
<Button x:Name="updatePluginsButton" Content="{DynamicResource updatePlugins}" Margin="0,0,0,5" HorizontalAlignment="Right" Width="170" Click="UpdatePluginsButton_Click" FontWeight="Regular" />
|
<Button x:Name="updatePluginsButton" Content="{DynamicResource updatePlugins}" Margin="0,0,0,5" HorizontalAlignment="Right" Width="170" Click="UpdatePluginsButton_Click" FontWeight="Regular" />
|
||||||
<Button x:Name="openPluginsFolderButton" Content="{DynamicResource openPluginsFolder}" HorizontalAlignment="Right" Width="170" Click="OpenPluginsFolderButton_Click" FontWeight="Regular" />
|
<Button x:Name="openPluginsFolderButton" Content="{DynamicResource openPluginsFolder}" HorizontalAlignment="Right" Width="170" Click="OpenPluginsFolderButton_Click" FontWeight="Regular" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
+156
-117
@@ -1,15 +1,16 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Text.Json;
|
|
||||||
using Stone_Red_Utilities.Logging;
|
|
||||||
|
|
||||||
namespace DesktopMagic
|
namespace DesktopMagic
|
||||||
{
|
{
|
||||||
@@ -44,17 +45,11 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
#endregion Plugins settings
|
#endregion Plugins settings
|
||||||
|
|
||||||
public const string AppName = "Desktop Magic";
|
|
||||||
|
|
||||||
public static Logger Logger { get; private set; }
|
|
||||||
|
|
||||||
public static List<Window> Windows { get; protected set; } = new List<Window>();
|
public static List<Window> Windows { get; protected set; } = new List<Window>();
|
||||||
public static List<string> WindowNames { get; protected set; } = new List<string>();
|
public static List<string> WindowNames { get; protected set; } = new List<string>();
|
||||||
private readonly RegistryKey key;
|
private readonly RegistryKey key;
|
||||||
private readonly System.Windows.Forms.NotifyIcon notifyIcon = new();
|
private readonly System.Windows.Forms.NotifyIcon notifyIcon = new();
|
||||||
|
|
||||||
private readonly string applicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + AppName;
|
|
||||||
private readonly string logFilePath;
|
|
||||||
private bool loaded = false;
|
private bool loaded = false;
|
||||||
|
|
||||||
private bool blockWindowsClosing = true;
|
private bool blockWindowsClosing = true;
|
||||||
@@ -63,25 +58,23 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logFilePath = applicationDataPath + "\\Log.txt";
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
Logger = new Logger(LogTarget.File, logFilePath, "{<dateTime>:HH:mm:ss} | {<level>,-7} | {<source>,-15} | {<lineNumber>,-4} | {<memberName>,10} | {<message>}");
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + AppName);
|
|
||||||
|
|
||||||
Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/DesktopMagic;component/icon.ico")).Stream;
|
Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/DesktopMagic;component/icon.ico")).Stream;
|
||||||
notifyIcon.Click += TaskbarIcon_TrayLeftClick;
|
notifyIcon.Click += TaskbarIcon_TrayLeftClick;
|
||||||
notifyIcon.Visible = true;
|
notifyIcon.Visible = true;
|
||||||
notifyIcon.Text = AppName;
|
notifyIcon.Text = App.AppName;
|
||||||
notifyIcon.Icon = new System.Drawing.Icon(iconStream);
|
notifyIcon.Icon = new System.Drawing.Icon(iconStream);
|
||||||
notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
|
notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
SetLanguageDictionary();
|
SetLanguageDictionary();
|
||||||
this.Title = AppName;
|
Title = $"{App.AppName} - {Assembly.GetExecutingAssembly().GetName().Version}";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.ToString());
|
_ = MessageBox.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,39 +84,37 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.ClearLogFile();
|
if (!Directory.Exists(App.ApplicationDataPath))
|
||||||
|
|
||||||
if (!Directory.Exists(applicationDataPath))
|
|
||||||
{
|
{
|
||||||
_ = Directory.CreateDirectory(applicationDataPath);
|
_ = Directory.CreateDirectory(App.ApplicationDataPath);
|
||||||
}
|
}
|
||||||
Logger.Log("Created ApplicationData Folder", "Main");
|
App.Logger.Log("Created ApplicationData Folder", "Main");
|
||||||
|
|
||||||
if (!Directory.Exists(applicationDataPath + "\\Plugins"))
|
if (!Directory.Exists(App.ApplicationDataPath + "\\Plugins"))
|
||||||
{
|
{
|
||||||
_ = Directory.CreateDirectory(applicationDataPath + "\\Plugins");
|
_ = Directory.CreateDirectory(App.ApplicationDataPath + "\\Plugins");
|
||||||
}
|
}
|
||||||
Logger.Log("Created Plugins Folder", "Main");
|
App.Logger.Log("Created Plugins Folder", "Main");
|
||||||
|
|
||||||
if (!File.Exists(applicationDataPath + "\\layouts.save"))
|
if (!File.Exists(App.ApplicationDataPath + "\\layouts.save"))
|
||||||
{
|
{
|
||||||
File.WriteAllText(applicationDataPath + "\\layouts.save", ";" + (string)FindResource("default"));
|
File.WriteAllText(App.ApplicationDataPath + "\\layouts.save", ";" + (string)FindResource("default"));
|
||||||
}
|
}
|
||||||
Logger.Log("Created layouts.save file", "Main");
|
App.Logger.Log("Created layouts.save file", "Main");
|
||||||
|
|
||||||
_ = optionsComboBox.Items.Add(new Tuple<string, int>((string)FindResource("musicVisualizer"), 0));
|
_ = optionsComboBox.Items.Add(new Tuple<string, int>((string)FindResource("musicVisualizer"), 0));
|
||||||
|
|
||||||
//Write To Log File and Load Elements
|
//Write To Log File and Load Elements
|
||||||
|
|
||||||
Logger.Log("Loading Plugin names", "Main");
|
App.Logger.Log("Loading Plugin names", "Main");
|
||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
Logger.Log("Loading Layout names", "Main");
|
App.Logger.Log("Loading Layout names", "Main");
|
||||||
LoadLayoutNames();
|
LoadLayoutNames();
|
||||||
Logger.Log("Loading Layout", "Main");
|
App.Logger.Log("Loading Layout", "Main");
|
||||||
LoadLayout();
|
LoadLayout();
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
Logger.Log("Window Loaded", "Main");
|
App.Logger.Log("Window Loaded", "Main");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -133,7 +124,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void LoadPlugins()
|
private void LoadPlugins()
|
||||||
{
|
{
|
||||||
string PluginsPath = applicationDataPath + "\\Plugins";
|
string PluginsPath = App.ApplicationDataPath + "\\Plugins";
|
||||||
|
|
||||||
foreach (string fileName in Directory.GetFiles(PluginsPath, "*.dll"))
|
foreach (string fileName in Directory.GetFiles(PluginsPath, "*.dll"))
|
||||||
{
|
{
|
||||||
@@ -206,11 +197,26 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
switch (checkBox.Name)
|
switch (checkBox.Name)
|
||||||
{
|
{
|
||||||
case "TimeCb": window = new TimeWindow(); break;
|
case "TimeCb":
|
||||||
case "DateCb": window = new DateWindow(); break;
|
window = new TimeWindow();
|
||||||
case "CpuUsageCb": window = new CpuUsageWindow(); break;
|
break;
|
||||||
case "CalendarCb": window = new CalendarWindow(); break;
|
|
||||||
case "MusicVisualizerCb": window = new MusicVisualizerWindow(); break;
|
case "DateCb":
|
||||||
|
window = new DateWindow();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "CpuUsageCb":
|
||||||
|
window = new CpuUsageWindow();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "CalendarCb":
|
||||||
|
window = new CalendarWindow();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "MusicVisualizerCb":
|
||||||
|
window = new MusicVisualizerWindow();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (checkBox.Name.Contains("_PluginCb_"))
|
if (checkBox.Name.Contains("_PluginCb_"))
|
||||||
{
|
{
|
||||||
@@ -262,6 +268,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
window.ShowInTaskbar = false;
|
window.ShowInTaskbar = false;
|
||||||
window.Show();
|
window.Show();
|
||||||
|
window.ContentRendered += PluginWindow_ContentRendered;
|
||||||
window.Closing += DisplayWindow_Closing;
|
window.Closing += DisplayWindow_Closing;
|
||||||
Windows.Add(window);
|
Windows.Add(window);
|
||||||
WindowNames.Add(window.Title);
|
WindowNames.Add(window.Title);
|
||||||
@@ -282,6 +289,12 @@ namespace DesktopMagic
|
|||||||
SaveLayout();
|
SaveLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PluginWindow_ContentRendered(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
WindowPos.SendWpfWindowBack(sender as Window);
|
||||||
|
WindowPos.SendWpfWindowBack(sender as Window);
|
||||||
|
}
|
||||||
|
|
||||||
private void DisplayWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
private void DisplayWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
{
|
{
|
||||||
e.Cancel = blockWindowsClosing;
|
e.Cancel = blockWindowsClosing;
|
||||||
@@ -289,14 +302,14 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
{
|
{
|
||||||
MessageBoxResult msbRes = MessageBox.Show((string)FindResource("wantToCloseProgram"), AppName, MessageBoxButton.YesNo);
|
MessageBoxResult msbRes = MessageBox.Show((string)FindResource("wantToCloseProgram"), App.AppName, MessageBoxButton.YesNo);
|
||||||
e.Cancel = msbRes != MessageBoxResult.Yes;
|
e.Cancel = msbRes != MessageBoxResult.Yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Closed(object sender, EventArgs e)
|
private void Window_Closed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
Visibility = Visibility.Collapsed;
|
||||||
this.UpdateLayout();
|
UpdateLayout();
|
||||||
foreach (Window window in Windows)
|
foreach (Window window in Windows)
|
||||||
{
|
{
|
||||||
window.Hide();
|
window.Hide();
|
||||||
@@ -306,12 +319,17 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_StateChanged(object sender, EventArgs e)
|
private void Window_StateChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.WindowState == WindowState.Minimized)
|
if (WindowState == WindowState.Minimized)
|
||||||
{
|
{
|
||||||
EditCheckBox.IsChecked = false;
|
EditCheckBox.IsChecked = false;
|
||||||
EditCheckBox_Click(null, null);
|
EditCheckBox_Click(null, null);
|
||||||
this.ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
this.Visibility = Visibility.Collapsed;
|
Visibility = Visibility.Collapsed;
|
||||||
|
foreach (Window item in Windows)
|
||||||
|
{
|
||||||
|
WindowPos.SendWpfWindowBack(item);
|
||||||
|
WindowPos.SendWpfWindowBack(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,7 +491,6 @@ namespace DesktopMagic
|
|||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
label.Text = eLabel.Value;
|
label.Text = eLabel.Value;
|
||||||
Option_ValueChanged();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -491,14 +508,20 @@ namespace DesktopMagic
|
|||||||
};
|
};
|
||||||
button.Click += (_s, _e) =>
|
button.Click += (_s, _e) =>
|
||||||
{
|
{
|
||||||
eButton.Click();
|
try
|
||||||
|
{
|
||||||
|
eButton.Click();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DisplayException(ex.Message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
eButton.OnValueChanged += () =>
|
eButton.OnValueChanged += () =>
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
button.Content = eButton.Value;
|
button.Content = eButton.Value;
|
||||||
Option_ValueChanged();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -515,14 +538,20 @@ namespace DesktopMagic
|
|||||||
};
|
};
|
||||||
checkBox.Click += (_s, _e) =>
|
checkBox.Click += (_s, _e) =>
|
||||||
{
|
{
|
||||||
eCheckBox.Value = checkBox.IsChecked.GetValueOrDefault();
|
try
|
||||||
|
{
|
||||||
|
eCheckBox.Value = checkBox.IsChecked.GetValueOrDefault();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DisplayException(ex.Message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
eCheckBox.OnValueChanged += () =>
|
eCheckBox.OnValueChanged += () =>
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
checkBox.IsChecked = eCheckBox.Value;
|
checkBox.IsChecked = eCheckBox.Value;
|
||||||
Option_ValueChanged();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -539,14 +568,20 @@ namespace DesktopMagic
|
|||||||
};
|
};
|
||||||
textBox.TextChanged += (_s, _e) =>
|
textBox.TextChanged += (_s, _e) =>
|
||||||
{
|
{
|
||||||
eTextBox.Value = textBox.Text;
|
try
|
||||||
|
{
|
||||||
|
eTextBox.Value = textBox.Text;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DisplayException(ex.Message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
eTextBox.OnValueChanged += () =>
|
eTextBox.OnValueChanged += () =>
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
textBox.Text = eTextBox.Value;
|
textBox.Text = eTextBox.Value;
|
||||||
Option_ValueChanged();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
_ = stackPanel.Children.Add(textBox);
|
_ = stackPanel.Children.Add(textBox);
|
||||||
@@ -563,14 +598,20 @@ namespace DesktopMagic
|
|||||||
};
|
};
|
||||||
integerUpDown.ValueChanged += (_s, _e) =>
|
integerUpDown.ValueChanged += (_s, _e) =>
|
||||||
{
|
{
|
||||||
eIntegerUpDown.Value = integerUpDown.Value.GetValueOrDefault();
|
try
|
||||||
|
{
|
||||||
|
eIntegerUpDown.Value = integerUpDown.Value.GetValueOrDefault();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DisplayException(ex.Message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
eIntegerUpDown.OnValueChanged += () =>
|
eIntegerUpDown.OnValueChanged += () =>
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
integerUpDown.Value = eIntegerUpDown.Value;
|
integerUpDown.Value = eIntegerUpDown.Value;
|
||||||
Option_ValueChanged();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
_ = stackPanel.Children.Add(integerUpDown);
|
_ = stackPanel.Children.Add(integerUpDown);
|
||||||
@@ -589,14 +630,20 @@ namespace DesktopMagic
|
|||||||
};
|
};
|
||||||
slider.ValueChanged += (_s, _e) =>
|
slider.ValueChanged += (_s, _e) =>
|
||||||
{
|
{
|
||||||
eSlider.Value = slider.Value;
|
try
|
||||||
|
{
|
||||||
|
eSlider.Value = slider.Value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DisplayException(ex.Message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
eSlider.OnValueChanged += () =>
|
eSlider.OnValueChanged += () =>
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
slider.Value = eSlider.Value;
|
slider.Value = eSlider.Value;
|
||||||
Option_ValueChanged();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -606,18 +653,14 @@ namespace DesktopMagic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Option_ValueChanged()
|
private void DisplayException(string message)
|
||||||
{
|
{
|
||||||
//Plugin settings save currenty disabled. Not sure if I want to add it back in the future.
|
App.Logger.Log(message, "PluginInput");
|
||||||
/*
|
_ = MessageBox.Show("File execution error:\n" + message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
string pluginName = ((Tuple<string, int>)optionsComboBox.SelectedItem).Item1.ToString();
|
int index = WindowNames.IndexOf(((Tuple<string, int>)optionsComboBox.SelectedItem).Item1.ToString());
|
||||||
|
|
||||||
if (PluginsSettings.ContainsKey(pluginName))
|
PluginWindow window = Windows[index] as PluginWindow;
|
||||||
{
|
window?.Exit();
|
||||||
string jsonSettings = JsonSerializer.Serialize(PluginsSettings[pluginName]);
|
|
||||||
File.WriteAllText($"{applicationDataPath}\\Plugins\\{pluginName}\\{pluginName}.save", jsonSettings);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion options
|
#endregion options
|
||||||
@@ -625,45 +668,20 @@ namespace DesktopMagic
|
|||||||
private void TextBlock_Loaded(object sender, RoutedEventArgs e)
|
private void TextBlock_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
char[] chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
|
||||||
foreach (FontFamily ff in Fonts.SystemFontFamilies)
|
foreach (FontFamily ff in Fonts.SystemFontFamilies)
|
||||||
{
|
{
|
||||||
double charWidth = -1;
|
ComboBoxItem comboBoxItem = new()
|
||||||
bool monospace = true;
|
|
||||||
|
|
||||||
textBlock.FontFamily = ff;
|
|
||||||
|
|
||||||
foreach (char c in chars)
|
|
||||||
{
|
{
|
||||||
textBlock.Text = "";
|
FontFamily = ff,
|
||||||
for (int i = 0; i < 100; i++)
|
Content = ff.ToString()
|
||||||
{
|
};
|
||||||
textBlock.Text += c.ToString();
|
_ = fontComboBox.Items.Add(comboBoxItem);
|
||||||
}
|
|
||||||
textBlock.UpdateLayout();
|
|
||||||
|
|
||||||
if (charWidth != textBlock.ActualWidth && charWidth != -1)
|
if (ff.ToString() == GlobalFont)
|
||||||
{
|
|
||||||
monospace = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
charWidth = textBlock.ActualWidth;
|
|
||||||
}
|
|
||||||
if (monospace)
|
|
||||||
{
|
{
|
||||||
ComboBoxItem comboBoxItem = new()
|
fontComboBox.SelectedIndex = index;
|
||||||
{
|
|
||||||
FontFamily = ff,
|
|
||||||
Content = ff.ToString()
|
|
||||||
};
|
|
||||||
_ = fontComboBox.Items.Add(comboBoxItem);
|
|
||||||
|
|
||||||
if (ff.ToString() == GlobalFont)
|
|
||||||
{
|
|
||||||
fontComboBox.SelectedIndex = index;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
if (fontComboBox.SelectedIndex == -1)
|
if (fontComboBox.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
@@ -749,7 +767,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
key.SetValue("SelectedLayout", layoutsComboBox.SelectedIndex);
|
key.SetValue("SelectedLayout", layoutsComboBox.SelectedIndex);
|
||||||
|
|
||||||
string[] lines = File.ReadAllLines(applicationDataPath + "\\layouts.save");
|
string[] lines = File.ReadAllLines(App.ApplicationDataPath + "\\layouts.save");
|
||||||
string[] data = lines[layoutsComboBox.SelectedIndex].Split(';');
|
string[] data = lines[layoutsComboBox.SelectedIndex].Split(';');
|
||||||
foreach (string dat in data)
|
foreach (string dat in data)
|
||||||
{
|
{
|
||||||
@@ -786,7 +804,7 @@ namespace DesktopMagic
|
|||||||
}
|
}
|
||||||
content += inputDialog.ResponseText + "\n";
|
content += inputDialog.ResponseText + "\n";
|
||||||
|
|
||||||
File.AppendAllText(applicationDataPath + "\\layouts.save", content);
|
File.AppendAllText(App.ApplicationDataPath + "\\layouts.save", content);
|
||||||
key.SetValue("SelectedLayout", -1);
|
key.SetValue("SelectedLayout", -1);
|
||||||
LoadLayoutNames();
|
LoadLayoutNames();
|
||||||
layoutsComboBox.SelectedIndex = layoutsComboBox.Items.Count - 1;
|
layoutsComboBox.SelectedIndex = layoutsComboBox.Items.Count - 1;
|
||||||
@@ -800,9 +818,9 @@ namespace DesktopMagic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> lines = File.ReadAllLines(applicationDataPath + "\\layouts.save").ToList();
|
List<string> lines = File.ReadAllLines(App.ApplicationDataPath + "\\layouts.save").ToList();
|
||||||
lines.RemoveAt(layoutsComboBox.SelectedIndex);
|
lines.RemoveAt(layoutsComboBox.SelectedIndex);
|
||||||
File.WriteAllLines(applicationDataPath + "\\layouts.save", lines);
|
File.WriteAllLines(App.ApplicationDataPath + "\\layouts.save", lines);
|
||||||
LoadLayoutNames();
|
LoadLayoutNames();
|
||||||
layoutsComboBox.SelectedIndex = 0;
|
layoutsComboBox.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
@@ -811,9 +829,9 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
_ = Task.Run(() =>
|
_ = Task.Run(() =>
|
||||||
{
|
{
|
||||||
lock (applicationDataPath)
|
lock (App.ApplicationDataPath)
|
||||||
{
|
{
|
||||||
List<string> lines = File.ReadAllLines(applicationDataPath + "\\layouts.save").ToList();
|
List<string> lines = File.ReadAllLines(App.ApplicationDataPath + "\\layouts.save").ToList();
|
||||||
string content = "";
|
string content = "";
|
||||||
foreach (string valueName in key.GetValueNames())
|
foreach (string valueName in key.GetValueNames())
|
||||||
{
|
{
|
||||||
@@ -827,7 +845,7 @@ namespace DesktopMagic
|
|||||||
content += layoutsComboBox.SelectedItem.ToString();
|
content += layoutsComboBox.SelectedItem.ToString();
|
||||||
lines[layoutsComboBox.SelectedIndex] = content;
|
lines[layoutsComboBox.SelectedIndex] = content;
|
||||||
});
|
});
|
||||||
File.WriteAllLines(applicationDataPath + "\\layouts.save", lines);
|
File.WriteAllLines(App.ApplicationDataPath + "\\layouts.save", lines);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -835,7 +853,7 @@ namespace DesktopMagic
|
|||||||
private void LoadLayoutNames()
|
private void LoadLayoutNames()
|
||||||
{
|
{
|
||||||
layoutsComboBox.Items.Clear();
|
layoutsComboBox.Items.Clear();
|
||||||
string[] lines = File.ReadAllLines(applicationDataPath + "\\layouts.save");
|
string[] lines = File.ReadAllLines(App.ApplicationDataPath + "\\layouts.save");
|
||||||
|
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
@@ -895,14 +913,14 @@ namespace DesktopMagic
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Log(ex.ToString(), "Main");
|
App.Logger.Log(ex.ToString(), "Main");
|
||||||
MessageBox.Show(ex.ToString());
|
MessageBox.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Log(ex.ToString(), "Main");
|
App.Logger.Log(ex.ToString(), "Main");
|
||||||
_ = MessageBox.Show(ex.ToString());
|
_ = MessageBox.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,18 +941,21 @@ namespace DesktopMagic
|
|||||||
private void UpdatePluginsButton_Click(object sender, RoutedEventArgs e)
|
private void UpdatePluginsButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
foreach (Window window in Windows)
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (window.GetType() == typeof(PluginWindow))
|
foreach (Window window in Windows.ToArray())
|
||||||
{
|
{
|
||||||
((PluginWindow)window).UpdatePluginWindow();
|
if (window.GetType() == typeof(PluginWindow))
|
||||||
|
{
|
||||||
|
((PluginWindow)window).UpdatePluginWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenPluginsFolderButton_Click(object sender, RoutedEventArgs e)
|
private void OpenPluginsFolderButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_ = System.Diagnostics.Process.Start("explorer.exe", applicationDataPath + "\\Plugins");
|
_ = Process.Start("explorer.exe", App.ApplicationDataPath + "\\Plugins");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||||
@@ -948,19 +969,19 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
this.ShowInTaskbar = true;
|
ShowInTaskbar = true;
|
||||||
this.Visibility = Visibility.Visible;
|
Visibility = Visibility.Visible;
|
||||||
SystemCommands.RestoreWindow(this);
|
SystemCommands.RestoreWindow(this);
|
||||||
this.Topmost = true;
|
Topmost = true;
|
||||||
this.Activate();
|
Activate();
|
||||||
this.Topmost = false;
|
Topmost = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetLanguageDictionary()
|
private void SetLanguageDictionary()
|
||||||
{
|
{
|
||||||
ResourceDictionary dict = new ResourceDictionary();
|
ResourceDictionary dict = new ResourceDictionary();
|
||||||
string currentCulture = Thread.CurrentThread.CurrentCulture.ToString();
|
string currentCulture = Thread.CurrentThread.CurrentUICulture.ToString();
|
||||||
|
|
||||||
if (currentCulture.Contains("de"))
|
if (currentCulture.Contains("de"))
|
||||||
{
|
{
|
||||||
@@ -970,7 +991,25 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
dict.Source = new Uri("..\\Resources\\StringResources.en.xaml", UriKind.Relative);
|
dict.Source = new Uri("..\\Resources\\StringResources.en.xaml", UriKind.Relative);
|
||||||
}
|
}
|
||||||
this.Resources.MergedDictionaries.Add(dict);
|
Resources.MergedDictionaries.Add(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GithubButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
string uri = "https://github.com/Stone-Red-Code/DesktopMagic";
|
||||||
|
ProcessStartInfo psi = new ProcessStartInfo();
|
||||||
|
psi.UseShellExecute = true;
|
||||||
|
psi.FileName = uri;
|
||||||
|
_ = Process.Start(psi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DownloadPluginsButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
string uri = "https://github.com/Stone-Red-Code/DesktopMagic-Plugins";
|
||||||
|
ProcessStartInfo psi = new ProcessStartInfo();
|
||||||
|
psi.UseShellExecute = true;
|
||||||
|
psi.FileName = uri;
|
||||||
|
_ = Process.Start(psi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using NAudio.Wave;
|
using NAudio.Wave;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -42,7 +44,7 @@ namespace DesktopMagic
|
|||||||
};
|
};
|
||||||
|
|
||||||
w.Show();
|
w.Show();
|
||||||
this.Owner = w;
|
Owner = w;
|
||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
sampleAggregator.FftCalculated += new EventHandler<FftEventArgs>(FftCalculated);
|
sampleAggregator.FftCalculated += new EventHandler<FftEventArgs>(FftCalculated);
|
||||||
@@ -58,17 +60,17 @@ namespace DesktopMagic
|
|||||||
t.Elapsed += T_Elapsed;
|
t.Elapsed += T_Elapsed;
|
||||||
t.Start();
|
t.Start();
|
||||||
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + MainWindow.AppName);
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
|
|
||||||
this.Top = double.Parse(key.GetValue("MusicVisualizerWindowTop", 100).ToString());
|
Top = double.Parse(key.GetValue("MusicVisualizerWindowTop", 100).ToString());
|
||||||
|
|
||||||
this.Left = double.Parse(key.GetValue("MusicVisualizerWindowLeft", 100).ToString());
|
Left = double.Parse(key.GetValue("MusicVisualizerWindowLeft", 100).ToString());
|
||||||
|
|
||||||
this.Height = double.Parse(key.GetValue("MusicVisualizerWindowHeight", 200).ToString());
|
Height = double.Parse(key.GetValue("MusicVisualizerWindowHeight", 200).ToString());
|
||||||
|
|
||||||
this.Width = double.Parse(key.GetValue("MusicVisualizerWindowWidth", 500).ToString());
|
Width = double.Parse(key.GetValue("MusicVisualizerWindowWidth", 500).ToString());
|
||||||
|
|
||||||
this.IsEnabled = false;
|
IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSourceInitialized(EventArgs e)
|
protected override void OnSourceInitialized(EventArgs e)
|
||||||
@@ -76,7 +78,7 @@ namespace DesktopMagic
|
|||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
|
|
||||||
//Set the window style to noactivate.
|
//Set the window style to noactivate.
|
||||||
var helper = new WindowInteropHelper(this);
|
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||||
}
|
}
|
||||||
@@ -88,14 +90,14 @@ namespace DesktopMagic
|
|||||||
if (MainWindow.EditMode)
|
if (MainWindow.EditMode)
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Visible;
|
panel.Visibility = Visibility.Visible;
|
||||||
new WindowPos().SetIsLocked(this, false);
|
WindowPos.SetIsLocked(this, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
new WindowPos().SetIsLocked(this, true);
|
WindowPos.SetIsLocked(this, true);
|
||||||
}
|
}
|
||||||
if (!this.IsLoaded)
|
if (!IsLoaded)
|
||||||
{
|
{
|
||||||
calculate = false;
|
calculate = false;
|
||||||
}
|
}
|
||||||
@@ -126,7 +128,10 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void FftCalculated(object sender, FftEventArgs e)
|
private void FftCalculated(object sender, FftEventArgs e)
|
||||||
{
|
{
|
||||||
if (!calculate) return;
|
if (!calculate)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<double> fft = new List<double>();
|
List<double> fft = new List<double>();
|
||||||
for (int i = 0; i < e.Result.Length / 2 - 70; i++)
|
for (int i = 0; i < e.Result.Length / 2 - 70; i++)
|
||||||
@@ -193,7 +198,9 @@ namespace DesktopMagic
|
|||||||
for (int j = 0; j < flattenValue; j++)
|
for (int j = 0; j < flattenValue; j++)
|
||||||
{
|
{
|
||||||
if (i + j < scaledFft.Count)
|
if (i + j < scaledFft.Count)
|
||||||
|
{
|
||||||
temp += scaledFft[i + j];
|
temp += scaledFft[i + j];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scaledFft[i] = temp / flattenValue;
|
scaledFft[i] = temp / flattenValue;
|
||||||
}
|
}
|
||||||
@@ -207,7 +214,9 @@ namespace DesktopMagic
|
|||||||
for (int j = 0; j < flattenValue; j++)
|
for (int j = 0; j < flattenValue; j++)
|
||||||
{
|
{
|
||||||
if (i - j >= 0)
|
if (i - j >= 0)
|
||||||
|
{
|
||||||
temp += scaledFft[i - j];
|
temp += scaledFft[i - j];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scaledFft[i] = temp / flattenValue;
|
scaledFft[i] = temp / flattenValue;
|
||||||
}
|
}
|
||||||
@@ -224,10 +233,14 @@ namespace DesktopMagic
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
if (!MainWindow.MirrorMode && MainWindow.SpectrumMode != 1)
|
if (!MainWindow.MirrorMode && MainWindow.SpectrumMode != 1)
|
||||||
|
{
|
||||||
scaledFft.Insert(0, 0);
|
scaledFft.Insert(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!MainWindow.LineMode)
|
if (!MainWindow.LineMode)
|
||||||
|
{
|
||||||
offset = 1;
|
offset = 1;
|
||||||
|
}
|
||||||
|
|
||||||
using (Graphics gr = Graphics.FromImage(bm))
|
using (Graphics gr = Graphics.FromImage(bm))
|
||||||
{
|
{
|
||||||
@@ -256,8 +269,13 @@ namespace DesktopMagic
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: points[pointIndex + 1] = new PointF(2 * pointIndex, value); break;
|
case 2:
|
||||||
default: points[pointIndex + 1] = new PointF(2 * pointIndex, bm.Height - value - 1 + offset); break;
|
points[pointIndex + 1] = new PointF(2 * pointIndex, value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
points[pointIndex + 1] = new PointF(2 * pointIndex, bm.Height - value - 1 + offset);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MainWindow.MirrorMode || MainWindow.SpectrumMode == 1)
|
if (MainWindow.MirrorMode || MainWindow.SpectrumMode == 1)
|
||||||
@@ -364,9 +382,9 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("MusicVisualizerWindowHeight", this.Height);
|
key.SetValue("MusicVisualizerWindowHeight", Height);
|
||||||
key.SetValue("MusicVisualizerWindowWidth", this.Width);
|
key.SetValue("MusicVisualizerWindowWidth", Width);
|
||||||
tileBar.CaptionHeight = this.ActualHeight - 10;
|
tileBar.CaptionHeight = ActualHeight - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,10 @@ 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 string PluginName => window.PluginName;
|
||||||
|
|
||||||
|
public string PluginPath => window.PluginFolderPath;
|
||||||
|
|
||||||
public void UpdateWindow() => window.UpdatePluginWindow();
|
public void UpdateWindow() => window.UpdatePluginWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,12 +13,11 @@
|
|||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
Closing="Window_Closing"
|
Closing="Window_Closing"
|
||||||
ContentRendered="Window_ContentRendered"
|
ContentRendered="Window_ContentRendered"
|
||||||
|
|
||||||
x:Name="window">
|
x:Name="window">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Rectangle x:Name="panel" Fill="#4CBAFFEF" Stroke="White" Margin="0,0,0,0" Visibility="Collapsed" />
|
<Rectangle x:Name="panel" Fill="#4CBAFFEF" Stroke="White" Margin="0,0,0,0" Visibility="Collapsed" />
|
||||||
<Viewbox StretchDirection="Both" Stretch="Uniform">
|
<Viewbox StretchDirection="Both" Stretch="Uniform">
|
||||||
<Image x:Name="image" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" MouseDown="Window_MouseDown" MouseMove="Window_MouseMove" />
|
<Image x:Name="image" HorizontalAlignment="Left" RenderOptions.EdgeMode="Aliased" Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" MouseDown="Window_MouseDown" MouseMove="Window_MouseMove" MouseWheel="Window_MouseWheel"/>
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Grid>
|
</Grid>
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using DesktopMagicPluginAPI;
|
using DesktopMagicPluginAPI;
|
||||||
|
using DesktopMagicPluginAPI.Drawing;
|
||||||
using DesktopMagicPluginAPI.Inputs;
|
using DesktopMagicPluginAPI.Inputs;
|
||||||
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -29,8 +31,8 @@ namespace DesktopMagic
|
|||||||
private System.Timers.Timer valueTimer;
|
private System.Timers.Timer valueTimer;
|
||||||
|
|
||||||
private Plugin pluginClassInstance;
|
private Plugin pluginClassInstance;
|
||||||
private readonly string pluginName = "";
|
public string PluginName { get; private set; }
|
||||||
private string pluginFolderPath = "";
|
public string PluginFolderPath { get; private set; }
|
||||||
private bool stop = false;
|
private bool stop = false;
|
||||||
|
|
||||||
public event Action PluginLoaded;
|
public event Action PluginLoaded;
|
||||||
@@ -52,7 +54,7 @@ namespace DesktopMagic
|
|||||||
ShowInTaskbar = false
|
ShowInTaskbar = false
|
||||||
};
|
};
|
||||||
w.Show();
|
w.Show();
|
||||||
this.Owner = w;
|
Owner = w;
|
||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
System.Timers.Timer t = new System.Timers.Timer();
|
System.Timers.Timer t = new System.Timers.Timer();
|
||||||
@@ -60,13 +62,13 @@ namespace DesktopMagic
|
|||||||
t.Elapsed += Elapsed;
|
t.Elapsed += Elapsed;
|
||||||
t.Start();
|
t.Start();
|
||||||
|
|
||||||
this.pluginName = pluginName;
|
PluginName = pluginName;
|
||||||
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + MainWindow.AppName);
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
this.Top = double.Parse(key.GetValue(pluginName + "WindowTop", 100).ToString());
|
Top = double.Parse(key.GetValue(pluginName + "WindowTop", 100).ToString());
|
||||||
this.Left = double.Parse(key.GetValue(pluginName + "WindowLeft", 100).ToString());
|
Left = double.Parse(key.GetValue(pluginName + "WindowLeft", 100).ToString());
|
||||||
this.Height = double.Parse(key.GetValue(pluginName + "WindowHeight", 200).ToString());
|
Height = double.Parse(key.GetValue(pluginName + "WindowHeight", 200).ToString());
|
||||||
this.Width = double.Parse(key.GetValue(pluginName + "WindowWidth", 500).ToString());
|
Width = double.Parse(key.GetValue(pluginName + "WindowWidth", 500).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSourceInitialized(EventArgs e)
|
protected override void OnSourceInitialized(EventArgs e)
|
||||||
@@ -88,7 +90,10 @@ namespace DesktopMagic
|
|||||||
pluginThread.Start();
|
pluginThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePluginWindow() => ValueTimer_Elapsed(valueTimer, null);
|
public void UpdatePluginWindow()
|
||||||
|
{
|
||||||
|
ValueTimer_Elapsed(valueTimer, null);
|
||||||
|
}
|
||||||
|
|
||||||
private void Elapsed(object sender, ElapsedEventArgs e)
|
private void Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -97,16 +102,16 @@ namespace DesktopMagic
|
|||||||
if (MainWindow.EditMode)
|
if (MainWindow.EditMode)
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Visible;
|
panel.Visibility = Visibility.Visible;
|
||||||
new WindowPos().SetIsLocked(this, false);
|
WindowPos.SetIsLocked(this, false);
|
||||||
tileBar.CaptionHeight = tileBar.CaptionHeight = this.ActualHeight - 10 < 0 ? 0 : this.ActualHeight - 10;
|
tileBar.CaptionHeight = tileBar.CaptionHeight = ActualHeight - 10 < 0 ? 0 : ActualHeight - 10;
|
||||||
this.ResizeMode = ResizeMode.CanResize;
|
ResizeMode = ResizeMode.CanResize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
new WindowPos().SetIsLocked(this, true);
|
WindowPos.SetIsLocked(this, true);
|
||||||
tileBar.CaptionHeight = 0;
|
tileBar.CaptionHeight = 0;
|
||||||
this.ResizeMode = ResizeMode.NoResize;
|
ResizeMode = ResizeMode.NoResize;
|
||||||
}
|
}
|
||||||
if (stop)
|
if (stop)
|
||||||
{
|
{
|
||||||
@@ -117,63 +122,38 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void LoadPlugin()
|
private void LoadPlugin()
|
||||||
{
|
{
|
||||||
string sourceText;
|
PluginFolderPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\{App.AppName}\\Plugins\\{PluginName}";
|
||||||
string PluginPath;
|
|
||||||
|
|
||||||
pluginFolderPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\{MainWindow.AppName}\\Plugins\\{pluginName}";
|
if (!File.Exists($"{PluginFolderPath}\\{PluginName}.dll"))
|
||||||
|
|
||||||
if (File.Exists($"{pluginFolderPath}\\{pluginName}.dll"))
|
|
||||||
{
|
{
|
||||||
PluginPath = $"{pluginFolderPath}\\{pluginName}.dll";
|
_ = MessageBox.Show("File does not exist!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("File does not exist!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sourceText = File.ReadAllText(PluginPath);
|
ExecuteSource();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainWindow.Logger.Log(ex.ToString(), "Plugin");
|
App.Logger.Log(ex.ToString(), "Plugin");
|
||||||
MessageBox.Show("File could not be read:\n" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
_ = MessageBox.Show("File execution error:\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Exit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ExecuteSource(sourceText);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MainWindow.Logger.Log(ex.ToString(), "Plugin");
|
|
||||||
MessageBox.Show("File execution error:\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PluginLoaded?.Invoke();
|
PluginLoaded?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteSource(string sourceText)
|
private void ExecuteSource()
|
||||||
{
|
{
|
||||||
byte[] assemblyBytes = File.ReadAllBytes($"{pluginFolderPath}\\{pluginName}.dll");
|
byte[] assemblyBytes = File.ReadAllBytes($"{PluginFolderPath}\\{PluginName}.dll");
|
||||||
Assembly dll = Assembly.Load(assemblyBytes);
|
Assembly dll = Assembly.Load(assemblyBytes);
|
||||||
Type instanceType = dll.GetTypes().FirstOrDefault(type => type.GetTypeInfo().BaseType == typeof(Plugin));
|
Type instanceType = dll.GetTypes().FirstOrDefault(type => type.GetTypeInfo().BaseType == typeof(Plugin));
|
||||||
|
|
||||||
foreach (var item in dll.GetTypes())
|
|
||||||
{
|
|
||||||
Debug.WriteLine(item.Name);
|
|
||||||
Debug.WriteLine(typeof(Plugin).Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instanceType is null)
|
if (instanceType is null)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
_ = MessageBox.Show($"The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -186,7 +166,7 @@ namespace DesktopMagic
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show($"The \"Plugin\" class has to inherit from \"{typeof(Plugin).FullName}\"", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
_ = MessageBox.Show($"The \"Plugin\" class has to inherit from \"{typeof(Plugin).FullName}\"", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -209,67 +189,88 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void LoadOptions(object instance)
|
private void LoadOptions(object instance)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(instance.GetType().FullName);
|
try
|
||||||
FieldInfo[] props = instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
|
|
||||||
|
|
||||||
List<SettingElement> settingElements = new List<SettingElement>();
|
|
||||||
foreach (FieldInfo prop in props)
|
|
||||||
{
|
{
|
||||||
if (prop.GetValue(instance) is Element element)
|
FieldInfo[] props = instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.GetField);
|
||||||
|
|
||||||
|
List<SettingElement> settingElements = new List<SettingElement>();
|
||||||
|
foreach (FieldInfo prop in props)
|
||||||
{
|
{
|
||||||
object[] attrs = prop.GetCustomAttributes(true);
|
if (prop.GetValue(instance) is Element element)
|
||||||
foreach (object attr in attrs)
|
|
||||||
{
|
{
|
||||||
if (attr is ElementAttribute elementAttribute)
|
object[] attrs = prop.GetCustomAttributes(true);
|
||||||
|
foreach (object attr in attrs)
|
||||||
{
|
{
|
||||||
settingElements.Add(new SettingElement(element, elementAttribute.Name, elementAttribute.OrderIndex));
|
if (attr is ElementAttribute elementAttribute)
|
||||||
break;
|
{
|
||||||
|
settingElements.Add(new SettingElement(element, elementAttribute.Name, elementAttribute.OrderIndex));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
settingElements = settingElements.OrderBy(x => x.OrderIndex).ToList();
|
settingElements = settingElements.OrderBy(x => x.OrderIndex).ToList();
|
||||||
if (MainWindow.PluginsSettings.ContainsKey(pluginName))
|
if (MainWindow.PluginsSettings.ContainsKey(PluginName))
|
||||||
{
|
{
|
||||||
MainWindow.PluginsSettings[pluginName] = settingElements;
|
MainWindow.PluginsSettings[PluginName] = settingElements;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.PluginsSettings.Add(PluginName, settingElements);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainWindow.PluginsSettings.Add(pluginName, settingElements);
|
stop = true;
|
||||||
|
App.Logger.Log(ex.ToString(), "Plugin");
|
||||||
|
_ = MessageBox.Show("File execution error:\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
Exit();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ValueTimer_Elapsed(object sender, ElapsedEventArgs e)
|
private void ValueTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
//Set Arguments
|
|
||||||
SolidBrush newBrush = (SolidBrush)MainWindow.GlobalSystemColor;
|
|
||||||
System.Drawing.Color color = newBrush.Color;
|
|
||||||
string font = MainWindow.GlobalFont;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Bitmap result = pluginClassInstance.Main();
|
if (!stop)
|
||||||
|
{
|
||||||
|
Bitmap result = pluginClassInstance.Main();
|
||||||
|
|
||||||
if (pluginClassInstance.UpdateInterval > 0)
|
if (pluginClassInstance.UpdateInterval > 0)
|
||||||
{
|
{
|
||||||
valueTimer.Interval = pluginClassInstance.UpdateInterval;
|
valueTimer.Interval = pluginClassInstance.UpdateInterval;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
valueTimer.Stop();
|
valueTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update Image
|
if (result is not null)
|
||||||
Dispatcher.Invoke(() =>
|
{
|
||||||
{
|
BitmapScalingMode renderOptions = pluginClassInstance.RenderQuality switch
|
||||||
image.Source = BitmapToImageSource(result);
|
{
|
||||||
});
|
RenderQuality.High => BitmapScalingMode.HighQuality,
|
||||||
|
RenderQuality.Low => BitmapScalingMode.LowQuality,
|
||||||
|
RenderQuality.Performance => BitmapScalingMode.NearestNeighbor,
|
||||||
|
_ => BitmapScalingMode.Unspecified
|
||||||
|
};
|
||||||
|
|
||||||
|
//Update Image
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
RenderOptions.SetBitmapScalingMode(image, renderOptions);
|
||||||
|
image.Source = BitmapToImageSource(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainWindow.Logger.Log(ex.ToString(), "Plugin");
|
stop = true;
|
||||||
MessageBox.Show("File execution error:\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
App.Logger.Log(ex.ToString(), "Plugin");
|
||||||
|
_ = MessageBox.Show("File execution error:\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -296,8 +297,9 @@ namespace DesktopMagic
|
|||||||
return bitmapSource;
|
return bitmapSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Exit()
|
public void Exit()
|
||||||
{
|
{
|
||||||
|
stop = true;
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
OnExit?.Invoke();
|
OnExit?.Invoke();
|
||||||
@@ -308,15 +310,15 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_LocationChanged(object sender, EventArgs e)
|
private void Window_LocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue(pluginName + "WindowTop", this.Top);
|
key.SetValue(PluginName + "WindowTop", Top);
|
||||||
key.SetValue(pluginName + "WindowLeft", this.Left);
|
key.SetValue(PluginName + "WindowLeft", Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue(pluginName + "WindowHeight", this.Height);
|
key.SetValue(PluginName + "WindowHeight", Height);
|
||||||
key.SetValue(pluginName + "WindowWidth", this.Width);
|
key.SetValue(PluginName + "WindowWidth", Width);
|
||||||
tileBar.CaptionHeight = this.ActualHeight - 10;
|
tileBar.CaptionHeight = ActualHeight - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
@@ -330,7 +332,29 @@ namespace DesktopMagic
|
|||||||
BitmapSource bitmapImage = (BitmapSource)imageSource;
|
BitmapSource bitmapImage = (BitmapSource)imageSource;
|
||||||
double pixelMousePositionX = e.GetPosition(image).X * bitmapImage.PixelWidth / image.ActualHeight;
|
double pixelMousePositionX = e.GetPosition(image).X * bitmapImage.PixelWidth / image.ActualHeight;
|
||||||
double pixelMousePositionY = e.GetPosition(image).Y * bitmapImage.PixelHeight / image.ActualHeight;
|
double pixelMousePositionY = e.GetPosition(image).Y * bitmapImage.PixelHeight / image.ActualHeight;
|
||||||
Clicked(new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY));
|
|
||||||
|
MouseButton mouseButton;
|
||||||
|
|
||||||
|
switch (e.ChangedButton)
|
||||||
|
{
|
||||||
|
case System.Windows.Input.MouseButton.Left:
|
||||||
|
mouseButton = MouseButton.Left;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case System.Windows.Input.MouseButton.Middle:
|
||||||
|
mouseButton = MouseButton.Middle;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case System.Windows.Input.MouseButton.Right:
|
||||||
|
mouseButton = MouseButton.Right;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
System.Drawing.Point point = new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY);
|
||||||
|
pluginClassInstance.OnMouseClick(point, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
private void Window_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
||||||
@@ -339,23 +363,22 @@ namespace DesktopMagic
|
|||||||
BitmapSource bitmapImage = (BitmapSource)imageSource;
|
BitmapSource bitmapImage = (BitmapSource)imageSource;
|
||||||
double pixelMousePositionX = e.GetPosition(image).X * bitmapImage.PixelWidth / image.ActualHeight;
|
double pixelMousePositionX = e.GetPosition(image).X * bitmapImage.PixelWidth / image.ActualHeight;
|
||||||
double pixelMousePositionY = e.GetPosition(image).Y * bitmapImage.PixelHeight / image.ActualHeight;
|
double pixelMousePositionY = e.GetPosition(image).Y * bitmapImage.PixelHeight / image.ActualHeight;
|
||||||
Moved(new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY));
|
|
||||||
|
System.Drawing.Point point = new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY);
|
||||||
|
pluginClassInstance.OnMouseMove(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
System.Drawing.Point point = new System.Drawing.Point((int)pixelMousePositionX, (int)pixelMousePositionY);
|
||||||
|
pluginClassInstance.OnMouseWheel(point, e.Delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Window Events
|
#endregion Window Events
|
||||||
|
|
||||||
#region Plugin Methods
|
|
||||||
|
|
||||||
private void Clicked(System.Drawing.Point positon)
|
|
||||||
{
|
|
||||||
pluginClassInstance.OnMouseClick(positon);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Moved(System.Drawing.Point positon)
|
|
||||||
{
|
|
||||||
pluginClassInstance.OnMouseMove(positon);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Plugin Methods
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
<system:String x:Key="mirrorPlugine">Spiegeln</system:String>
|
<system:String x:Key="mirrorPlugine">Spiegeln</system:String>
|
||||||
<system:String x:Key="updatePlugins">Plugins Neu Laden</system:String>
|
<system:String x:Key="updatePlugins">Plugins Neu Laden</system:String>
|
||||||
<system:String x:Key="openPluginsFolder">Plugins Ordner Öffnen</system:String>
|
<system:String x:Key="openPluginsFolder">Plugins Ordner Öffnen</system:String>
|
||||||
|
<system:String x:Key="downloadPlugins">Plugins Herunterladen</system:String>
|
||||||
<system:String x:Key="color">Farbe:</system:String>
|
<system:String x:Key="color">Farbe:</system:String>
|
||||||
<system:String x:Key="default">Standard</system:String>
|
<system:String x:Key="default">Standard</system:String>
|
||||||
<system:String x:Key="wantToCloseProgram">Wollen sie das Programm wirklich schließen?</system:String>
|
<system:String x:Key="wantToCloseProgram">Wollen sie das Programm wirklich schließen?</system:String>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<system:String x:Key="mirrorPlugine">Mirror</system:String>
|
<system:String x:Key="mirrorPlugine">Mirror</system:String>
|
||||||
<system:String x:Key="updatePlugins">Reload Plugins</system:String>
|
<system:String x:Key="updatePlugins">Reload Plugins</system:String>
|
||||||
<system:String x:Key="openPluginsFolder">Open Plugins Folder</system:String>
|
<system:String x:Key="openPluginsFolder">Open Plugins Folder</system:String>
|
||||||
|
<system:String x:Key="downloadPlugins">Download Plugins</system:String>
|
||||||
<system:String x:Key="color">Color:</system:String>
|
<system:String x:Key="color">Color:</system:String>
|
||||||
<system:String x:Key="default">Default</system:String>
|
<system:String x:Key="default">Default</system:String>
|
||||||
<system:String x:Key="wantToCloseProgram">Do you really want to close the program?</system:String>
|
<system:String x:Key="wantToCloseProgram">Do you really want to close the program?</system:String>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -27,7 +28,7 @@ namespace DesktopMagic
|
|||||||
w.WindowStyle = WindowStyle.ToolWindow;
|
w.WindowStyle = WindowStyle.ToolWindow;
|
||||||
w.ShowInTaskbar = false;
|
w.ShowInTaskbar = false;
|
||||||
w.Show();
|
w.Show();
|
||||||
this.Owner = w;
|
Owner = w;
|
||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
Timer t = new Timer();
|
Timer t = new Timer();
|
||||||
@@ -35,12 +36,12 @@ namespace DesktopMagic
|
|||||||
t.Elapsed += T_Elapsed;
|
t.Elapsed += T_Elapsed;
|
||||||
t.Start();
|
t.Start();
|
||||||
|
|
||||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + MainWindow.AppName);
|
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||||
this.Top = double.Parse(key.GetValue("TimeWindowTop", 100).ToString());
|
Top = double.Parse(key.GetValue("TimeWindowTop", 100).ToString());
|
||||||
this.Left = double.Parse(key.GetValue("TimeWindowLeft", 100).ToString());
|
Left = double.Parse(key.GetValue("TimeWindowLeft", 100).ToString());
|
||||||
this.Height = double.Parse(key.GetValue("TimeWindowHeight", 200).ToString());
|
Height = double.Parse(key.GetValue("TimeWindowHeight", 200).ToString());
|
||||||
this.Width = double.Parse(key.GetValue("TimeWindowWidth", 500).ToString());
|
Width = double.Parse(key.GetValue("TimeWindowWidth", 500).ToString());
|
||||||
this.IsEnabled = false;
|
IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSourceInitialized(EventArgs e)
|
protected override void OnSourceInitialized(EventArgs e)
|
||||||
@@ -48,7 +49,7 @@ namespace DesktopMagic
|
|||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
|
|
||||||
//Set the window style to noactivate.
|
//Set the window style to noactivate.
|
||||||
var helper = new WindowInteropHelper(this);
|
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||||
}
|
}
|
||||||
@@ -60,12 +61,12 @@ namespace DesktopMagic
|
|||||||
if (MainWindow.EditMode)
|
if (MainWindow.EditMode)
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Visible;
|
panel.Visibility = Visibility.Visible;
|
||||||
new WindowPos().SetIsLocked(this, false);
|
WindowPos.SetIsLocked(this, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
new WindowPos().SetIsLocked(this, true);
|
WindowPos.SetIsLocked(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||||
@@ -77,15 +78,15 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void Window_LocationChanged(object sender, EventArgs e)
|
private void Window_LocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("TimeWindowTop", this.Top);
|
key.SetValue("TimeWindowTop", Top);
|
||||||
key.SetValue("TimeWindowLeft", this.Left);
|
key.SetValue("TimeWindowLeft", Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
key.SetValue("TimeWindowHeight", this.Height);
|
key.SetValue("TimeWindowHeight", Height);
|
||||||
key.SetValue("TimeWindowWidth", this.Width);
|
key.SetValue("TimeWindowWidth", Width);
|
||||||
tileBar.CaptionHeight = this.ActualHeight - 10;
|
tileBar.CaptionHeight = ActualHeight - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ namespace DesktopMagic
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern int GetWindowRect(IntPtr hwnd, out Rectangle rect);
|
private static extern int GetWindowRect(IntPtr hwnd, out Rectangle rect);
|
||||||
|
|
||||||
public void SendWpfWindowBack(Window window)
|
public static void SendWpfWindowBack(Window window)
|
||||||
{
|
{
|
||||||
var hWnd = new WindowInteropHelper(window).Handle;
|
var hWnd = new WindowInteropHelper(window).Handle;
|
||||||
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE1 | SWP_NOMOVE1);
|
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE1 | SWP_NOMOVE1);
|
||||||
@@ -51,7 +51,7 @@ namespace DesktopMagic
|
|||||||
return (bool)obj.GetValue(IsLockedProperty);
|
return (bool)obj.GetValue(IsLockedProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIsLocked(DependencyObject obj, bool value)
|
public static void SetIsLocked(DependencyObject obj, bool value)
|
||||||
{
|
{
|
||||||
obj.SetValue(IsLockedProperty, value);
|
obj.SetValue(IsLockedProperty, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
using DesktopMagicPluginAPI.Inputs;
|
using DesktopMagicPluginAPI.Inputs;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace DesktopMagicPlugin.Test
|
namespace DesktopMagicPlugin.Test
|
||||||
{
|
{
|
||||||
@@ -13,29 +14,58 @@ namespace DesktopMagicPlugin.Test
|
|||||||
[Element("Gif path:")]
|
[Element("Gif path:")]
|
||||||
private TextBox input = new TextBox("");
|
private TextBox input = new TextBox("");
|
||||||
|
|
||||||
|
[Element]
|
||||||
|
private Label info = new Label("");
|
||||||
|
|
||||||
private List<Bitmap> bitmaps = new List<Bitmap>();
|
private List<Bitmap> bitmaps = new List<Bitmap>();
|
||||||
|
|
||||||
public override int UpdateInterval { get; set; } = 100;
|
|
||||||
private int frameCount = -1;
|
private int frameCount = -1;
|
||||||
|
|
||||||
public GifPlugin()
|
private const string SaveFilePath = "gifPath.txt";
|
||||||
|
|
||||||
|
public override void Start()
|
||||||
{
|
{
|
||||||
input.OnValueChanged += Input_OnValueChanged;
|
input.OnValueChanged += Input_OnValueChanged;
|
||||||
|
if (File.Exists(SaveFilePath))
|
||||||
|
{
|
||||||
|
input.Value = File.ReadAllText(SaveFilePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Input_OnValueChanged()
|
private void Input_OnValueChanged()
|
||||||
{
|
{
|
||||||
if (File.Exists(input.Value))
|
_ = Task.Run(() =>
|
||||||
{
|
{
|
||||||
Image gif = Image.FromFile(input.Value);
|
try
|
||||||
bitmaps.Clear();
|
|
||||||
for (int i = 0; i < gif.GetFrameCount(FrameDimension.Time); i++)
|
|
||||||
{
|
{
|
||||||
gif.SelectActiveFrame(FrameDimension.Time, i);
|
if (File.Exists(input.Value))
|
||||||
|
{
|
||||||
|
info.Value = "Loading...";
|
||||||
|
Image gif = Image.FromFile(input.Value);
|
||||||
|
|
||||||
bitmaps.Add(new Bitmap(gif));
|
PropertyItem item = gif.GetPropertyItem(0x5100); // FrameDelay in libgdiplus
|
||||||
|
|
||||||
|
UpdateInterval = (item.Value[0] + item.Value[1] * 256) * 10; //FrameDelay in ms
|
||||||
|
bitmaps.Clear();
|
||||||
|
for (int i = 0; i < gif.GetFrameCount(FrameDimension.Time); i++)
|
||||||
|
{
|
||||||
|
gif.SelectActiveFrame(FrameDimension.Time, i);
|
||||||
|
|
||||||
|
bitmaps.Add(new Bitmap(gif));
|
||||||
|
}
|
||||||
|
File.WriteAllText(SaveFilePath, input.Value);
|
||||||
|
info.Value = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info.Value = "File not found!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
info.Value = $"Error: {ex.Message}";
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap Main()
|
public override Bitmap Main()
|
||||||
|
|||||||
@@ -4,19 +4,23 @@
|
|||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Company>Stone_Red</Company>
|
<Company>Stone_Red</Company>
|
||||||
<Product>Stone_Red</Product>
|
<Product>Stone_Red</Product>
|
||||||
<Version>0.0.0.2</Version>
|
<Version>0.0.0.4</Version>
|
||||||
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<AssemblyVersion>0.0.0.2</AssemblyVersion>
|
<AssemblyVersion>0.0.0.4</AssemblyVersion>
|
||||||
<PackageProjectUrl></PackageProjectUrl>
|
<PackageProjectUrl></PackageProjectUrl>
|
||||||
<FileVersion>0.0.0.2</FileVersion>
|
<FileVersion>0.0.0.4</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DocumentationFile>C:\Users\David\Programmieren\DesktopMagic\src\DesktopMagicPluginAPI\DesktopMagicPluginAPI.xml</DocumentationFile>
|
<DocumentationFile>C:\Users\David\Programmieren\DesktopMagic\src\DesktopMagicPluginAPI\DesktopMagicPluginAPI.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DocumentationFile>C:\Users\David\Programmieren\DesktopMagic\src\DesktopMagicPluginAPI\DesktopMagicPluginAPI.xml</DocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
|
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
|
||||||
<PackageReference Include="Vsxmd" Version="1.4.5">
|
<PackageReference Include="Vsxmd" Version="1.4.5">
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
- [IPluginData](#T-DesktopMagicPluginAPI-IPluginData 'DesktopMagicPluginAPI.IPluginData')
|
- [IPluginData](#T-DesktopMagicPluginAPI-IPluginData 'DesktopMagicPluginAPI.IPluginData')
|
||||||
- [Color](#P-DesktopMagicPluginAPI-IPluginData-Color 'DesktopMagicPluginAPI.IPluginData.Color')
|
- [Color](#P-DesktopMagicPluginAPI-IPluginData-Color 'DesktopMagicPluginAPI.IPluginData.Color')
|
||||||
- [Font](#P-DesktopMagicPluginAPI-IPluginData-Font 'DesktopMagicPluginAPI.IPluginData.Font')
|
- [Font](#P-DesktopMagicPluginAPI-IPluginData-Font 'DesktopMagicPluginAPI.IPluginData.Font')
|
||||||
|
- [PluginName](#P-DesktopMagicPluginAPI-IPluginData-PluginName 'DesktopMagicPluginAPI.IPluginData.PluginName')
|
||||||
|
- [PluginPath](#P-DesktopMagicPluginAPI-IPluginData-PluginPath 'DesktopMagicPluginAPI.IPluginData.PluginPath')
|
||||||
- [WindowPosition](#P-DesktopMagicPluginAPI-IPluginData-WindowPosition 'DesktopMagicPluginAPI.IPluginData.WindowPosition')
|
- [WindowPosition](#P-DesktopMagicPluginAPI-IPluginData-WindowPosition 'DesktopMagicPluginAPI.IPluginData.WindowPosition')
|
||||||
- [WindowSize](#P-DesktopMagicPluginAPI-IPluginData-WindowSize 'DesktopMagicPluginAPI.IPluginData.WindowSize')
|
- [WindowSize](#P-DesktopMagicPluginAPI-IPluginData-WindowSize 'DesktopMagicPluginAPI.IPluginData.WindowSize')
|
||||||
- [UpdateWindow()](#M-DesktopMagicPluginAPI-IPluginData-UpdateWindow 'DesktopMagicPluginAPI.IPluginData.UpdateWindow')
|
- [UpdateWindow()](#M-DesktopMagicPluginAPI-IPluginData-UpdateWindow 'DesktopMagicPluginAPI.IPluginData.UpdateWindow')
|
||||||
@@ -38,13 +40,23 @@
|
|||||||
- [#ctor(value,bold)](#M-DesktopMagicPluginAPI-Inputs-Label-#ctor-System-String,System-Boolean- 'DesktopMagicPluginAPI.Inputs.Label.#ctor(System.String,System.Boolean)')
|
- [#ctor(value,bold)](#M-DesktopMagicPluginAPI-Inputs-Label-#ctor-System-String,System-Boolean- 'DesktopMagicPluginAPI.Inputs.Label.#ctor(System.String,System.Boolean)')
|
||||||
- [Bold](#P-DesktopMagicPluginAPI-Inputs-Label-Bold 'DesktopMagicPluginAPI.Inputs.Label.Bold')
|
- [Bold](#P-DesktopMagicPluginAPI-Inputs-Label-Bold 'DesktopMagicPluginAPI.Inputs.Label.Bold')
|
||||||
- [Value](#P-DesktopMagicPluginAPI-Inputs-Label-Value 'DesktopMagicPluginAPI.Inputs.Label.Value')
|
- [Value](#P-DesktopMagicPluginAPI-Inputs-Label-Value 'DesktopMagicPluginAPI.Inputs.Label.Value')
|
||||||
|
- [MouseButton](#T-DesktopMagicPluginAPI-Inputs-MouseButton 'DesktopMagicPluginAPI.Inputs.MouseButton')
|
||||||
|
- [Left](#F-DesktopMagicPluginAPI-Inputs-MouseButton-Left 'DesktopMagicPluginAPI.Inputs.MouseButton.Left')
|
||||||
|
- [Middle](#F-DesktopMagicPluginAPI-Inputs-MouseButton-Middle 'DesktopMagicPluginAPI.Inputs.MouseButton.Middle')
|
||||||
|
- [Right](#F-DesktopMagicPluginAPI-Inputs-MouseButton-Right 'DesktopMagicPluginAPI.Inputs.MouseButton.Right')
|
||||||
- [Plugin](#T-DesktopMagicPluginAPI-Plugin 'DesktopMagicPluginAPI.Plugin')
|
- [Plugin](#T-DesktopMagicPluginAPI-Plugin 'DesktopMagicPluginAPI.Plugin')
|
||||||
- [Application](#P-DesktopMagicPluginAPI-Plugin-Application 'DesktopMagicPluginAPI.Plugin.Application')
|
- [Application](#P-DesktopMagicPluginAPI-Plugin-Application 'DesktopMagicPluginAPI.Plugin.Application')
|
||||||
|
- [RenderQuality](#P-DesktopMagicPluginAPI-Plugin-RenderQuality 'DesktopMagicPluginAPI.Plugin.RenderQuality')
|
||||||
- [UpdateInterval](#P-DesktopMagicPluginAPI-Plugin-UpdateInterval 'DesktopMagicPluginAPI.Plugin.UpdateInterval')
|
- [UpdateInterval](#P-DesktopMagicPluginAPI-Plugin-UpdateInterval 'DesktopMagicPluginAPI.Plugin.UpdateInterval')
|
||||||
- [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,mouseButton)](#M-DesktopMagicPluginAPI-Plugin-OnMouseClick-System-Drawing-Point,DesktopMagicPluginAPI-Inputs-MouseButton- 'DesktopMagicPluginAPI.Plugin.OnMouseClick(System.Drawing.Point,DesktopMagicPluginAPI.Inputs.MouseButton)')
|
||||||
- [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)')
|
||||||
|
- [OnMouseWheel(position,Delta)](#M-DesktopMagicPluginAPI-Plugin-OnMouseWheel-System-Drawing-Point,System-Int32- 'DesktopMagicPluginAPI.Plugin.OnMouseWheel(System.Drawing.Point,System.Int32)')
|
||||||
- [Start()](#M-DesktopMagicPluginAPI-Plugin-Start 'DesktopMagicPluginAPI.Plugin.Start')
|
- [Start()](#M-DesktopMagicPluginAPI-Plugin-Start 'DesktopMagicPluginAPI.Plugin.Start')
|
||||||
|
- [RenderQuality](#T-DesktopMagicPluginAPI-Drawing-RenderQuality 'DesktopMagicPluginAPI.Drawing.RenderQuality')
|
||||||
|
- [High](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-High 'DesktopMagicPluginAPI.Drawing.RenderQuality.High')
|
||||||
|
- [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low')
|
||||||
|
- [Performance](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Performance 'DesktopMagicPluginAPI.Drawing.RenderQuality.Performance')
|
||||||
- [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')
|
||||||
@@ -320,19 +332,33 @@ Gets the color of the main application.
|
|||||||
|
|
||||||
Gets the font of the main application.
|
Gets the font of the main application.
|
||||||
|
|
||||||
|
<a name='P-DesktopMagicPluginAPI-IPluginData-PluginName'></a>
|
||||||
|
### PluginName `property`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Gets the name of the plugin.
|
||||||
|
|
||||||
|
<a name='P-DesktopMagicPluginAPI-IPluginData-PluginPath'></a>
|
||||||
|
### PluginPath `property`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Gets the path of the parent directory of the plugin.
|
||||||
|
|
||||||
<a name='P-DesktopMagicPluginAPI-IPluginData-WindowPosition'></a>
|
<a name='P-DesktopMagicPluginAPI-IPluginData-WindowPosition'></a>
|
||||||
### WindowPosition `property`
|
### WindowPosition `property`
|
||||||
|
|
||||||
##### Summary
|
##### Summary
|
||||||
|
|
||||||
Gets the window position of the main application.
|
Gets the window position of the plugin window.
|
||||||
|
|
||||||
<a name='P-DesktopMagicPluginAPI-IPluginData-WindowSize'></a>
|
<a name='P-DesktopMagicPluginAPI-IPluginData-WindowSize'></a>
|
||||||
### WindowSize `property`
|
### WindowSize `property`
|
||||||
|
|
||||||
##### Summary
|
##### Summary
|
||||||
|
|
||||||
Gets the window size of the main application.
|
Gets the window size of the plugin window.
|
||||||
|
|
||||||
<a name='M-DesktopMagicPluginAPI-IPluginData-UpdateWindow'></a>
|
<a name='M-DesktopMagicPluginAPI-IPluginData-UpdateWindow'></a>
|
||||||
### UpdateWindow() `method`
|
### UpdateWindow() `method`
|
||||||
@@ -437,6 +463,38 @@ Gets or set a value indicating whether the content of the [Label](#T-DesktopMagi
|
|||||||
|
|
||||||
Gets or sets the text associated with this [Label](#T-DesktopMagicPluginAPI-Inputs-Label 'DesktopMagicPluginAPI.Inputs.Label').
|
Gets or sets the text associated with this [Label](#T-DesktopMagicPluginAPI-Inputs-Label 'DesktopMagicPluginAPI.Inputs.Label').
|
||||||
|
|
||||||
|
<a name='T-DesktopMagicPluginAPI-Inputs-MouseButton'></a>
|
||||||
|
## MouseButton `type`
|
||||||
|
|
||||||
|
##### Namespace
|
||||||
|
|
||||||
|
DesktopMagicPluginAPI.Inputs
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Mouse Buttons
|
||||||
|
|
||||||
|
<a name='F-DesktopMagicPluginAPI-Inputs-MouseButton-Left'></a>
|
||||||
|
### Left `constants`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
The left mouse button.
|
||||||
|
|
||||||
|
<a name='F-DesktopMagicPluginAPI-Inputs-MouseButton-Middle'></a>
|
||||||
|
### Middle `constants`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
The middle mouse button.
|
||||||
|
|
||||||
|
<a name='F-DesktopMagicPluginAPI-Inputs-MouseButton-Right'></a>
|
||||||
|
### Right `constants`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
The right mouse button.
|
||||||
|
|
||||||
<a name='T-DesktopMagicPluginAPI-Plugin'></a>
|
<a name='T-DesktopMagicPluginAPI-Plugin'></a>
|
||||||
## Plugin `type`
|
## Plugin `type`
|
||||||
|
|
||||||
@@ -455,6 +513,13 @@ The plugin class.
|
|||||||
|
|
||||||
Informations about the main application.
|
Informations about the main application.
|
||||||
|
|
||||||
|
<a name='P-DesktopMagicPluginAPI-Plugin-RenderQuality'></a>
|
||||||
|
### RenderQuality `property`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Gets or sets the render quality of the bitmap image.
|
||||||
|
|
||||||
<a name='P-DesktopMagicPluginAPI-Plugin-UpdateInterval'></a>
|
<a name='P-DesktopMagicPluginAPI-Plugin-UpdateInterval'></a>
|
||||||
### UpdateInterval `property`
|
### UpdateInterval `property`
|
||||||
|
|
||||||
@@ -477,8 +542,8 @@ Occurs when the [UpdateInterval](#P-DesktopMagicPluginAPI-Plugin-UpdateInterval
|
|||||||
|
|
||||||
This method has no parameters.
|
This method has no parameters.
|
||||||
|
|
||||||
<a name='M-DesktopMagicPluginAPI-Plugin-OnMouseClick-System-Drawing-Point-'></a>
|
<a name='M-DesktopMagicPluginAPI-Plugin-OnMouseClick-System-Drawing-Point,DesktopMagicPluginAPI-Inputs-MouseButton-'></a>
|
||||||
### OnMouseClick(position) `method`
|
### OnMouseClick(position,mouseButton) `method`
|
||||||
|
|
||||||
##### Summary
|
##### Summary
|
||||||
|
|
||||||
@@ -488,7 +553,8 @@ Occurs when the window is clicked by the mouse.
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---- | ---- | ----------- |
|
| ---- | ---- | ----------- |
|
||||||
| 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') | The x- and y-coordinates of the mouse pointer position relative to the plugin window. |
|
||||||
|
| mouseButton | [DesktopMagicPluginAPI.Inputs.MouseButton](#T-DesktopMagicPluginAPI-Inputs-MouseButton 'DesktopMagicPluginAPI.Inputs.MouseButton') | The button associated with the event. |
|
||||||
|
|
||||||
<a name='M-DesktopMagicPluginAPI-Plugin-OnMouseMove-System-Drawing-Point-'></a>
|
<a name='M-DesktopMagicPluginAPI-Plugin-OnMouseMove-System-Drawing-Point-'></a>
|
||||||
### OnMouseMove(position) `method`
|
### OnMouseMove(position) `method`
|
||||||
@@ -501,7 +567,21 @@ Occurs when the mouse pointer is moved over the control.
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---- | ---- | ----------- |
|
| ---- | ---- | ----------- |
|
||||||
| 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') | The x- and y-coordinates of the mouse pointer position relative to the plugin window. |
|
||||||
|
|
||||||
|
<a name='M-DesktopMagicPluginAPI-Plugin-OnMouseWheel-System-Drawing-Point,System-Int32-'></a>
|
||||||
|
### OnMouseWheel(position,Delta) `method`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Occurs when the user rotates the mouse wheel while the mouse pointer is over this element.
|
||||||
|
|
||||||
|
##### Parameters
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ---- | ---- | ----------- |
|
||||||
|
| position | [System.Drawing.Point](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Point 'System.Drawing.Point') | The x- and y-coordinates of the mouse pointer position relative to the plugin window. |
|
||||||
|
| Delta | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | A value that indicates the amount that the mouse wheel has changed. |
|
||||||
|
|
||||||
<a name='M-DesktopMagicPluginAPI-Plugin-Start'></a>
|
<a name='M-DesktopMagicPluginAPI-Plugin-Start'></a>
|
||||||
### Start() `method`
|
### Start() `method`
|
||||||
@@ -514,6 +594,38 @@ Occurs once when the pugin gets activated.
|
|||||||
|
|
||||||
This method has no parameters.
|
This method has no parameters.
|
||||||
|
|
||||||
|
<a name='T-DesktopMagicPluginAPI-Drawing-RenderQuality'></a>
|
||||||
|
## RenderQuality `type`
|
||||||
|
|
||||||
|
##### Namespace
|
||||||
|
|
||||||
|
DesktopMagicPluginAPI.Drawing
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Specifies which render quality is used to display the bitmap images.
|
||||||
|
|
||||||
|
<a name='F-DesktopMagicPluginAPI-Drawing-RenderQuality-High'></a>
|
||||||
|
### High `constants`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Slower then [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low') but produces higher quality output.
|
||||||
|
|
||||||
|
<a name='F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low'></a>
|
||||||
|
### Low `constants`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Faster then [High](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-High 'DesktopMagicPluginAPI.Drawing.RenderQuality.High') but produces lower quality output.
|
||||||
|
|
||||||
|
<a name='F-DesktopMagicPluginAPI-Drawing-RenderQuality-Performance'></a>
|
||||||
|
### Performance `constants`
|
||||||
|
|
||||||
|
##### Summary
|
||||||
|
|
||||||
|
Provides performance benefits over [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low')
|
||||||
|
|
||||||
<a name='T-DesktopMagicPluginAPI-Inputs-Slider'></a>
|
<a name='T-DesktopMagicPluginAPI-Inputs-Slider'></a>
|
||||||
## Slider `type`
|
## Slider `type`
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,26 @@
|
|||||||
<param name="point"><see cref="T:System.Drawing.PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
<param name="point"><see cref="T:System.Drawing.PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
||||||
<param name="width">The specified width.</param>
|
<param name="width">The specified width.</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DesktopMagicPluginAPI.Drawing.RenderQuality">
|
||||||
|
<summary>
|
||||||
|
Specifies which render quality is used to display the bitmap images.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DesktopMagicPluginAPI.Drawing.RenderQuality.High">
|
||||||
|
<summary>
|
||||||
|
Slower then <see cref="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Low"/> but produces higher quality output.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Low">
|
||||||
|
<summary>
|
||||||
|
Faster then <see cref="F:DesktopMagicPluginAPI.Drawing.RenderQuality.High"/> but produces lower quality output.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Performance">
|
||||||
|
<summary>
|
||||||
|
Provides performance benefits over <see cref="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Low"/>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:DesktopMagicPluginAPI.Inputs.Button">
|
<member name="T:DesktopMagicPluginAPI.Inputs.Button">
|
||||||
<summary>
|
<summary>
|
||||||
Represents a button control.
|
Represents a button control.
|
||||||
@@ -192,6 +212,26 @@
|
|||||||
<param name="value">The text associated with this <see cref="T:DesktopMagicPluginAPI.Inputs.Label"/></param>
|
<param name="value">The text associated with this <see cref="T:DesktopMagicPluginAPI.Inputs.Label"/></param>
|
||||||
<param name="bold">A value indicating whether the content of the <see cref="T:DesktopMagicPluginAPI.Inputs.Label"/> is bold or not.</param>
|
<param name="bold">A value indicating whether the content of the <see cref="T:DesktopMagicPluginAPI.Inputs.Label"/> is bold or not.</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DesktopMagicPluginAPI.Inputs.MouseButton">
|
||||||
|
<summary>
|
||||||
|
Mouse Buttons
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DesktopMagicPluginAPI.Inputs.MouseButton.Left">
|
||||||
|
<summary>
|
||||||
|
The left mouse button.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DesktopMagicPluginAPI.Inputs.MouseButton.Middle">
|
||||||
|
<summary>
|
||||||
|
The middle mouse button.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DesktopMagicPluginAPI.Inputs.MouseButton.Right">
|
||||||
|
<summary>
|
||||||
|
The right mouse button.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:DesktopMagicPluginAPI.Inputs.Slider">
|
<member name="T:DesktopMagicPluginAPI.Inputs.Slider">
|
||||||
<summary>
|
<summary>
|
||||||
Represents a slider control.
|
Represents a slider control.
|
||||||
@@ -253,12 +293,22 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:DesktopMagicPluginAPI.IPluginData.WindowSize">
|
<member name="P:DesktopMagicPluginAPI.IPluginData.WindowSize">
|
||||||
<summary>
|
<summary>
|
||||||
Gets the window size of the main application.
|
Gets the window size of the plugin window.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:DesktopMagicPluginAPI.IPluginData.WindowPosition">
|
<member name="P:DesktopMagicPluginAPI.IPluginData.WindowPosition">
|
||||||
<summary>
|
<summary>
|
||||||
Gets the window position of the main application.
|
Gets the window position of the plugin window.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DesktopMagicPluginAPI.IPluginData.PluginName">
|
||||||
|
<summary>
|
||||||
|
Gets the name of the plugin.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DesktopMagicPluginAPI.IPluginData.PluginPath">
|
||||||
|
<summary>
|
||||||
|
Gets the path of the parent directory of the plugin.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DesktopMagicPluginAPI.IPluginData.UpdateWindow">
|
<member name="M:DesktopMagicPluginAPI.IPluginData.UpdateWindow">
|
||||||
@@ -281,6 +331,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="P:DesktopMagicPluginAPI.Plugin.RenderQuality">
|
||||||
|
<summary>
|
||||||
|
Gets or sets the render quality of the bitmap image.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:DesktopMagicPluginAPI.Plugin.Start">
|
<member name="M:DesktopMagicPluginAPI.Plugin.Start">
|
||||||
<summary>
|
<summary>
|
||||||
Occurs once when the pugin gets activated.
|
Occurs once when the pugin gets activated.
|
||||||
@@ -292,17 +347,25 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DesktopMagicPluginAPI.Plugin.OnMouseClick(System.Drawing.Point)">
|
<member name="M:DesktopMagicPluginAPI.Plugin.OnMouseClick(System.Drawing.Point,DesktopMagicPluginAPI.Inputs.MouseButton)">
|
||||||
<summary>
|
<summary>
|
||||||
Occurs when the window is clicked by the mouse.
|
Occurs when the window is clicked by the mouse.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="position"></param>
|
<param name="position">The x- and y-coordinates of the mouse pointer position relative to the plugin window.</param>
|
||||||
|
<param name="mouseButton">The button associated with the event.</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DesktopMagicPluginAPI.Plugin.OnMouseMove(System.Drawing.Point)">
|
<member name="M:DesktopMagicPluginAPI.Plugin.OnMouseMove(System.Drawing.Point)">
|
||||||
<summary>
|
<summary>
|
||||||
Occurs when the mouse pointer is moved over the control.
|
Occurs when the mouse pointer is moved over the control.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="position"></param>
|
<param name="position">The x- and y-coordinates of the mouse pointer position relative to the plugin window.</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DesktopMagicPluginAPI.Plugin.OnMouseWheel(System.Drawing.Point,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
Occurs when the user rotates the mouse wheel while the mouse pointer is over this element.
|
||||||
|
</summary>
|
||||||
|
<param name="position">The x- and y-coordinates of the mouse pointer position relative to the plugin window.</param>
|
||||||
|
<param name="Delta">A value that indicates the amount that the mouse wheel has changed.</param>
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DesktopMagicPluginAPI.Drawing
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies which render quality is used to display the bitmap images.
|
||||||
|
/// </summary>
|
||||||
|
public enum RenderQuality
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Slower then <see cref="Low"/> but produces higher quality output.
|
||||||
|
/// </summary>
|
||||||
|
High,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Faster then <see cref="High"/> but produces lower quality output.
|
||||||
|
/// </summary>
|
||||||
|
Low,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides performance benefits over <see cref="Low"/>
|
||||||
|
/// </summary>
|
||||||
|
Performance
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,15 +18,25 @@ namespace DesktopMagicPluginAPI
|
|||||||
Color Color { get; }
|
Color Color { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the window size of the main application.
|
/// Gets the window size of the plugin window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Point WindowSize { get; }
|
Point WindowSize { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the window position of the main application.
|
/// Gets the window position of the plugin window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Point WindowPosition { get; }
|
Point WindowPosition { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the plugin.
|
||||||
|
/// </summary>
|
||||||
|
string PluginName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the path of the parent directory of the plugin.
|
||||||
|
/// </summary>
|
||||||
|
string PluginPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the plugin window.
|
/// Updates the plugin window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DesktopMagicPluginAPI.Inputs
|
namespace DesktopMagicPluginAPI.Inputs
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DesktopMagicPluginAPI.Inputs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Mouse Buttons
|
||||||
|
/// </summary>
|
||||||
|
public enum MouseButton
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The left mouse button.
|
||||||
|
/// </summary>
|
||||||
|
Left,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The middle mouse button.
|
||||||
|
/// </summary>
|
||||||
|
Middle,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The right mouse button.
|
||||||
|
/// </summary>
|
||||||
|
Right,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
using System;
|
using DesktopMagicPluginAPI.Drawing;
|
||||||
|
using DesktopMagicPluginAPI.Inputs;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace DesktopMagicPluginAPI
|
namespace DesktopMagicPluginAPI
|
||||||
@@ -34,6 +37,11 @@ namespace DesktopMagicPluginAPI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual int UpdateInterval { get; set; } = 1000;
|
public virtual int UpdateInterval { get; set; } = 1000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the render quality of the bitmap image.
|
||||||
|
/// </summary>
|
||||||
|
public virtual RenderQuality RenderQuality { get; set; } = RenderQuality.High;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs once when the pugin gets activated.
|
/// Occurs once when the pugin gets activated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -50,17 +58,27 @@ namespace DesktopMagicPluginAPI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the window is clicked by the mouse.
|
/// Occurs when the window is clicked by the mouse.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position"></param>
|
/// <param name="position">The x- and y-coordinates of the mouse pointer position relative to the plugin window.</param>
|
||||||
public virtual void OnMouseClick(Point position)
|
/// <param name="mouseButton">The button associated with the event.</param>
|
||||||
|
public virtual void OnMouseClick(Point position, MouseButton mouseButton)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the mouse pointer is moved over the control.
|
/// Occurs when the mouse pointer is moved over the control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position"></param>
|
/// <param name="position">The x- and y-coordinates of the mouse pointer position relative to the plugin window.</param>
|
||||||
public virtual void OnMouseMove(Point position)
|
public virtual void OnMouseMove(Point position)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when the user rotates the mouse wheel while the mouse pointer is over this element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">The x- and y-coordinates of the mouse pointer position relative to the plugin window.</param>
|
||||||
|
/// <param name="Delta">A value that indicates the amount that the mouse wheel has changed.</param>
|
||||||
|
public virtual void OnMouseWheel(Point position, int Delta)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"Version":"0.0.2.3",
|
||||||
|
"FileUrl":"http://github.com/Stone-Red-Code/DesktopMagic/blob/develop/update/DesktopMagic.zip?raw=true"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user