mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
- Improve code structure
- Improve log output format
This commit is contained in:
@@ -33,11 +33,11 @@ namespace DesktopMagic
|
||||
// Try to grab mutex
|
||||
_mutex = new Mutex(true, $"Stone_Red{AppName}", out bool createdNew);
|
||||
|
||||
//check if creating new was succesfull
|
||||
//check if creating new was successful
|
||||
if (!createdNew)
|
||||
{
|
||||
Logger.Log("Shutting down because other instance already running.", "Setup");
|
||||
//Shutdown Aplication
|
||||
//Shutdown Application
|
||||
Current.Shutdown();
|
||||
}
|
||||
else
|
||||
@@ -59,7 +59,7 @@ namespace DesktopMagic
|
||||
|
||||
private void Updater_NoUpdateAvailible()
|
||||
{
|
||||
Logger.Log("No update avalible.", "Updater");
|
||||
Logger.Log("No update available.", "Updater");
|
||||
}
|
||||
|
||||
private void Updater_OnException(Exception exception)
|
||||
@@ -114,7 +114,7 @@ namespace DesktopMagic
|
||||
},
|
||||
FormatConfig = new FormatConfig()
|
||||
{
|
||||
DebugConsoleFormat = $"> {{{LogFormatType.DateTime}:hh:mm:ss}} | {{{LogFormatType.LogSeverity},-5}} | {{{LogFormatType.Message}}}\n> at {{{LogFormatType.LineNumber},3}} | {{{LogFormatType.FilePath}}}"
|
||||
DebugConsoleFormat = $"> {{{LogFormatType.DateTime}:hh:mm:ss}} | {{{LogFormatType.LogSeverity},-5}} | {{{LogFormatType.Message}}}\nat {{{LogFormatType.LineNumber}}} | {{{LogFormatType.FilePath}}}"
|
||||
}
|
||||
};
|
||||
Logger.ClearLogFile(LogSeverity.Info);
|
||||
|
||||
+11
-17
@@ -10,9 +10,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für TimeWindow.xaml
|
||||
/// </summary>
|
||||
[Obsolete("Disabled due to lack of support (too much work)")]
|
||||
public partial class CalendarWindow : Window
|
||||
{
|
||||
@@ -40,7 +37,7 @@ namespace DesktopMagic
|
||||
|
||||
Timer t = new Timer();
|
||||
t.Interval = 100;
|
||||
t.Elapsed += T_Elapsed;
|
||||
t.Elapsed += UpdateTimer_Elapsed;
|
||||
t.Start();
|
||||
|
||||
Timer valueTimer = new Timer();
|
||||
@@ -88,7 +85,7 @@ namespace DesktopMagic
|
||||
});
|
||||
}
|
||||
|
||||
private void T_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
@@ -102,10 +99,10 @@ namespace DesktopMagic
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
if (MainWindow.GlobalFont != oldFont || MainWindow.GlobalColor != oldColor)
|
||||
if (MainWindow.Theme.Font != oldFont || MainWindow.Theme.PrimaryBrush != oldColor)
|
||||
{
|
||||
oldColor = MainWindow.GlobalColor;
|
||||
oldFont = MainWindow.GlobalFont;
|
||||
oldColor = MainWindow.Theme.PrimaryBrush;
|
||||
oldFont = MainWindow.Theme.Font;
|
||||
LoadEvents();
|
||||
}
|
||||
listBox.SelectedIndex = -1;
|
||||
@@ -117,22 +114,19 @@ namespace DesktopMagic
|
||||
listBox.Items.Clear();
|
||||
CalendarItems calendarItem = new CalendarItems();
|
||||
calendarItem.eventname = "Termine: ";
|
||||
calendarItem.font = MainWindow.GlobalFont;
|
||||
calendarItem.color = MainWindow.GlobalColor.ToString();
|
||||
calendarItem.font = MainWindow.Theme.Font;
|
||||
calendarItem.color = MainWindow.Theme.PrimaryColor.ToString();
|
||||
listBox.Items.Add(calendarItem);
|
||||
|
||||
for (int i = 0; i < upcomingEventNames.Count; i++)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
DateTime.TryParse(upcomingEventTimes[i], out dateTime);
|
||||
|
||||
calendarItem = new CalendarItems();
|
||||
calendarItem.eventname = upcomingEventNames[i];
|
||||
calendarItem.dateTime = dateTime.ToString("dd-MM-yyyy");
|
||||
calendarItem.font = MainWindow.GlobalFont;
|
||||
calendarItem.color = MainWindow.GlobalColor.ToString();
|
||||
calendarItem.dateTime = DateTime.Now.ToString("dd-MM-yyyy");
|
||||
calendarItem.font = MainWindow.Theme.Font;
|
||||
calendarItem.color = MainWindow.Theme.PrimaryBrush.ToString();
|
||||
|
||||
if (dateTime < DateTime.Today.AddMonths(12) || upcomingEventTimes[i] == "-")
|
||||
if (DateTime.Now < DateTime.Today.AddMonths(12) || upcomingEventTimes[i] == "-")
|
||||
{
|
||||
listBox.Items.Add(calendarItem);
|
||||
}
|
||||
+5
-7
@@ -6,12 +6,10 @@ using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für TimeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class CpuUsageWindow : Window
|
||||
{
|
||||
private RegistryKey key;
|
||||
@@ -41,7 +39,7 @@ namespace DesktopMagic
|
||||
|
||||
Timer t = new Timer();
|
||||
t.Interval = 100;
|
||||
t.Elapsed += T_Elapsed;
|
||||
t.Elapsed += UpdateTimer_Elapsed;
|
||||
t.Start();
|
||||
|
||||
Timer valueTimer = new Timer();
|
||||
@@ -68,7 +66,7 @@ namespace DesktopMagic
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
private void T_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
@@ -83,8 +81,8 @@ namespace DesktopMagic
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||
textBlock.Foreground = MainWindow.GlobalColor;
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.Theme.Font);
|
||||
textBlock.Foreground = MainWindow.Theme.PrimaryBrush;
|
||||
});
|
||||
}
|
||||
|
||||
+4
-7
@@ -8,9 +8,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für TimeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class DateWindow : Window
|
||||
{
|
||||
private RegistryKey key;
|
||||
@@ -33,7 +30,7 @@ namespace DesktopMagic
|
||||
|
||||
Timer t = new Timer();
|
||||
t.Interval = 100;
|
||||
t.Elapsed += T_Elapsed;
|
||||
t.Elapsed += UpdateTimer_Elapsed;
|
||||
t.Start();
|
||||
|
||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||
@@ -54,7 +51,7 @@ namespace DesktopMagic
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
private void T_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
@@ -68,8 +65,8 @@ namespace DesktopMagic
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||
textBlock.Foreground = MainWindow.GlobalColor;
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.Theme.Font);
|
||||
textBlock.Foreground = MainWindow.Theme.PrimaryBrush;
|
||||
textBlock.Text = DateTime.Now.ToString("D");
|
||||
});
|
||||
}
|
||||
+10
-10
@@ -57,7 +57,7 @@ namespace DesktopMagic
|
||||
|
||||
Timer t = new Timer();
|
||||
t.Interval = 100;
|
||||
t.Elapsed += T_Elapsed;
|
||||
t.Elapsed += UpdateTimer_Elapsed;
|
||||
t.Start();
|
||||
|
||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||
@@ -83,7 +83,7 @@ namespace DesktopMagic
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
private void T_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
@@ -299,13 +299,13 @@ namespace DesktopMagic
|
||||
SetPoints(points, bm.Width, bm.Height, offset);
|
||||
|
||||
Brush brush;
|
||||
if (MainWindow.MusicVisualzerColor == null)
|
||||
if (MainWindow.MusicVisualzerColor.HasValue)
|
||||
{
|
||||
brush = MainWindow.GlobalSystemColor;
|
||||
brush = new SolidBrush(MainWindow.MusicVisualzerColor.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
brush = MainWindow.MusicVisualzerColor;
|
||||
brush = new SolidBrush(MainWindow.Theme.PrimaryColor);
|
||||
}
|
||||
|
||||
if (MainWindow.LineMode)
|
||||
@@ -340,7 +340,7 @@ namespace DesktopMagic
|
||||
{
|
||||
case 1:
|
||||
points[0] = new PointF(width, height / 2);
|
||||
points[points.Length - 1] = new PointF(0, height / 2);
|
||||
points[^1] = new PointF(0, height / 2);
|
||||
|
||||
points[points.Length / 2] = new PointF(width, height / 2);
|
||||
points[points.Length / 2 - 1] = new PointF(0, height / 2);
|
||||
@@ -348,12 +348,12 @@ namespace DesktopMagic
|
||||
|
||||
case 2:
|
||||
points[0] = new PointF(0, 0 - offset);
|
||||
points[points.Length - 1] = new PointF(points[points.Length - 2].X, 0 - offset);
|
||||
points[^1] = new PointF(points[^2].X, 0 - offset);
|
||||
break;
|
||||
|
||||
default:
|
||||
points[0] = new PointF(0, height);
|
||||
points[points.Length - 1] = new PointF(points[points.Length - 2].X, height);
|
||||
points[^1] = new PointF(points[^2].X, height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -376,8 +376,8 @@ namespace DesktopMagic
|
||||
|
||||
private void Window_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
key.SetValue("MusicVisualizerWindowTop", this.Top);
|
||||
key.SetValue("MusicVisualizerWindowLeft", this.Left);
|
||||
key.SetValue("MusicVisualizerWindowTop", Top);
|
||||
key.SetValue("MusicVisualizerWindowLeft", Left);
|
||||
}
|
||||
|
||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
+4
-7
@@ -8,9 +8,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für TimeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class TimeWindow : Window
|
||||
{
|
||||
private RegistryKey key;
|
||||
@@ -33,7 +30,7 @@ namespace DesktopMagic
|
||||
|
||||
Timer t = new Timer();
|
||||
t.Interval = 100;
|
||||
t.Elapsed += T_Elapsed;
|
||||
t.Elapsed += UpdateTimer_Elapsed;
|
||||
t.Start();
|
||||
|
||||
key = Registry.CurrentUser.CreateSubKey(@"Software\" + App.AppName);
|
||||
@@ -54,7 +51,7 @@ namespace DesktopMagic
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
private void T_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
@@ -69,8 +66,8 @@ namespace DesktopMagic
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||
textBlock.Foreground = MainWindow.GlobalColor;
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.Theme.Font);
|
||||
textBlock.Foreground = MainWindow.Theme.PrimaryBrush;
|
||||
//textBlock.Text = DateTime.Now.ToString("hh:mm:ss tt");
|
||||
textBlock.Text = DateTime.Now.ToString("HH:mm:ss");
|
||||
});
|
||||
@@ -5,5 +5,4 @@
|
||||
|
||||
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("Style", "IDE0090:Use 'new(...)'", Justification = "<Pending>", Scope = "member", Target = "~M:DesktopMagic.MainWindow.GithubButton_Click(System.Object,System.Windows.RoutedEventArgs)")]
|
||||
[assembly: SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "Windows only application")]
|
||||
@@ -4,23 +4,20 @@ using System.Windows;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für InputDialog.xaml
|
||||
/// </summary>
|
||||
public partial class InputDialog : Window
|
||||
{
|
||||
public InputDialog(string content, string title = "InputDialog")
|
||||
{
|
||||
InitializeComponent();
|
||||
label.Content = content;
|
||||
this.Title = title;
|
||||
Title = title;
|
||||
SetLanguageDictionary();
|
||||
}
|
||||
|
||||
public string ResponseText
|
||||
{
|
||||
get { return textBox.Text; }
|
||||
set { textBox.Text = value; }
|
||||
get => textBox.Text;
|
||||
set => textBox.Text = value;
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, RoutedEventArgs e)
|
||||
@@ -46,7 +43,7 @@ namespace DesktopMagic
|
||||
{
|
||||
dict.Source = new Uri("..\\Resources\\StringResources.en.xaml", UriKind.Relative);
|
||||
}
|
||||
this.Resources.MergedDictionaries.Add(dict);
|
||||
Resources.MergedDictionaries.Add(dict);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Win32;
|
||||
using DesktopMagic.Plugins;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,17 +16,11 @@ using System.Windows.Media;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainWindow.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
#region Global settings
|
||||
|
||||
public static string GlobalFont { get; protected set; } = "Segoe UI";
|
||||
public static Brush GlobalColor { get; protected set; } = Brushes.White;
|
||||
public static System.Drawing.Brush GlobalSystemColor { get; protected set; } = System.Drawing.Brushes.White;
|
||||
internal static Theme Theme = new Theme();
|
||||
public static bool EditMode { get; protected set; } = false;
|
||||
|
||||
#endregion Global settings
|
||||
@@ -35,7 +31,7 @@ namespace DesktopMagic
|
||||
public static int AmplifierLevel { get; protected set; } = 0;
|
||||
public static bool MirrorMode { get; protected set; } = false;
|
||||
public static bool LineMode { get; protected set; } = false;
|
||||
public static System.Drawing.Brush MusicVisualzerColor { get; protected set; }
|
||||
public static System.Drawing.Color? MusicVisualzerColor { get; protected set; }
|
||||
|
||||
#endregion Music Visualizer Settings
|
||||
|
||||
@@ -160,17 +156,17 @@ namespace DesktopMagic
|
||||
checkBox.Style = (Style)FindResource("MaterialDesignDarkCheckBox");
|
||||
checkBox.Click += CheckBox_Click;
|
||||
|
||||
bool exsists = false;
|
||||
bool exists = false;
|
||||
foreach (UIElement item in stackPanel.Children)
|
||||
{
|
||||
if (((CheckBox)item).Name == "_PluginCb_" + clearPluginName)
|
||||
{
|
||||
exsists = true;
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exsists)
|
||||
if (!exists)
|
||||
{
|
||||
_ = stackPanel.Children.Add(checkBox);
|
||||
}
|
||||
@@ -396,9 +392,8 @@ namespace DesktopMagic
|
||||
hex = hex.Replace("#", "");
|
||||
|
||||
System.Drawing.Color systemColor = System.Drawing.Color.FromArgb((byte)int.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber), (byte)int.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber), (byte)int.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber));
|
||||
System.Drawing.Brush systemBrush = new System.Drawing.SolidBrush(systemColor);
|
||||
|
||||
MusicVisualzerColor = systemBrush;
|
||||
MusicVisualzerColor = systemColor;
|
||||
musicVisualizerColorTextBox.Foreground = Brushes.Black;
|
||||
|
||||
key.SetValue("MusicVisualizerColor", musicVisualizerColorTextBox.Text);
|
||||
@@ -419,8 +414,8 @@ namespace DesktopMagic
|
||||
|
||||
private void FontComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
GlobalFont = fontComboBox.SelectedValue.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");
|
||||
key.SetValue("Font", GlobalFont);
|
||||
Theme.Font = fontComboBox.SelectedValue.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");
|
||||
key.SetValue("Font", Theme.Font);
|
||||
SaveLayout();
|
||||
}
|
||||
|
||||
@@ -679,7 +674,7 @@ namespace DesktopMagic
|
||||
};
|
||||
_ = fontComboBox.Items.Add(comboBoxItem);
|
||||
|
||||
if (ff.ToString() == GlobalFont)
|
||||
if (ff.ToString() == Theme.Font)
|
||||
{
|
||||
fontComboBox.SelectedIndex = index;
|
||||
}
|
||||
@@ -738,10 +733,9 @@ namespace DesktopMagic
|
||||
blueSlider.Value = color.B;
|
||||
|
||||
Brush brush = new SolidColorBrush(color);
|
||||
System.Drawing.Brush systemBrush = new System.Drawing.SolidBrush(systemColor);
|
||||
|
||||
GlobalColor = brush;
|
||||
GlobalSystemColor = systemBrush;
|
||||
Theme.PrimaryBrush = brush;
|
||||
Theme.PrimaryColor = systemColor;
|
||||
colorRechtangle.Fill = brush;
|
||||
colorHexTextBox.Foreground = Brushes.Black;
|
||||
|
||||
@@ -784,7 +778,7 @@ namespace DesktopMagic
|
||||
for (int i = 0; i < fontComboBox.Items.Count; i++)
|
||||
{
|
||||
ComboBoxItem comboBoxItem = (ComboBoxItem)fontComboBox.Items[i];
|
||||
if (comboBoxItem.FontFamily.ToString() == GlobalFont)
|
||||
if (comboBoxItem.FontFamily.ToString() == Theme.Font)
|
||||
{
|
||||
fontComboBox.SelectedIndex = i;
|
||||
}
|
||||
@@ -867,7 +861,7 @@ namespace DesktopMagic
|
||||
|
||||
private void LoadLayout(bool minimize = true)
|
||||
{
|
||||
GlobalFont = key.GetValue("Font", "Segoe UI").ToString();
|
||||
Theme.Font = key.GetValue("Font", "Segoe UI").ToString();
|
||||
spectrumModeComboBox.SelectedIndex = int.Parse(key.GetValue("SpectrumMode", "0").ToString());
|
||||
amplifierLevelSlider.Value = int.Parse(key.GetValue("AmplifierLevel", "0").ToString());
|
||||
mirrorModeCheckBox.IsChecked = bool.Parse(key.GetValue("MirrorMode", "false").ToString());
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
using DesktopMagicPluginAPI;
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace DesktopMagic
|
||||
namespace DesktopMagic.Plugins
|
||||
{
|
||||
internal class PluginData : IPluginData
|
||||
{
|
||||
private readonly PluginWindow window;
|
||||
|
||||
public PluginData(PluginWindow win)
|
||||
public PluginData(PluginWindow window)
|
||||
{
|
||||
window = win;
|
||||
this.window = window;
|
||||
Theme = MainWindow.Theme;
|
||||
}
|
||||
|
||||
public string Font => MainWindow.GlobalFont;
|
||||
public string Font => Theme.Font;
|
||||
|
||||
public Color Color => (MainWindow.GlobalSystemColor as SolidBrush).Color;
|
||||
public Color Color => Theme.PrimaryColor;
|
||||
|
||||
public ITheme Theme { get; }
|
||||
|
||||
public Point WindowSize => new Point((int)window.ActualWidth, (int)window.ActualHeight);
|
||||
|
||||
@@ -24,6 +28,9 @@ namespace DesktopMagic
|
||||
|
||||
public string PluginPath => window.PluginFolderPath;
|
||||
|
||||
public void UpdateWindow() => window.UpdatePluginWindow();
|
||||
public void UpdateWindow()
|
||||
{
|
||||
window.UpdatePluginWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -1,4 +1,6 @@
|
||||
using DesktopMagicPluginAPI;
|
||||
using DesktopMagic.Plugins;
|
||||
|
||||
using DesktopMagicPluginAPI;
|
||||
using DesktopMagicPluginAPI.Drawing;
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
|
||||
@@ -20,20 +22,16 @@ using System.Windows.Media.Imaging;
|
||||
|
||||
namespace DesktopMagic
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für PluginWindow.xaml
|
||||
/// </summary>
|
||||
///
|
||||
public partial class PluginWindow : Window
|
||||
{
|
||||
private readonly RegistryKey key;
|
||||
private Thread pluginThread;
|
||||
private System.Timers.Timer valueTimer;
|
||||
private bool stop = false;
|
||||
|
||||
private Plugin pluginClassInstance;
|
||||
public string PluginName { get; private set; }
|
||||
public string PluginFolderPath { get; private set; }
|
||||
private bool stop = false;
|
||||
|
||||
public event Action PluginLoaded;
|
||||
|
||||
@@ -59,7 +57,7 @@ namespace DesktopMagic
|
||||
|
||||
System.Timers.Timer t = new System.Timers.Timer();
|
||||
t.Interval = 100;
|
||||
t.Elapsed += Elapsed;
|
||||
t.Elapsed += UpdateTimer_Elapsed;
|
||||
t.Start();
|
||||
|
||||
PluginName = pluginName;
|
||||
@@ -95,7 +93,7 @@ namespace DesktopMagic
|
||||
ValueTimer_Elapsed(valueTimer, null);
|
||||
}
|
||||
|
||||
private void Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
+1
-6
@@ -1,11 +1,6 @@
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DesktopMagic
|
||||
namespace DesktopMagic.Plugins
|
||||
{
|
||||
internal class SettingElement
|
||||
{
|
||||
@@ -0,0 +1,18 @@
|
||||
using DesktopMagicPluginAPI;
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace DesktopMagic.Plugins
|
||||
{
|
||||
internal class Theme : ITheme
|
||||
{
|
||||
public Color PrimaryColor { get; internal set; } = Color.White;
|
||||
|
||||
public Color SecondaryColor { get; internal set; } = Color.White;
|
||||
|
||||
public string Font { get; internal set; } = "Segoe UI";
|
||||
|
||||
public System.Windows.Media.Brush PrimaryBrush { get; set; } = System.Windows.Media.Brushes.White;
|
||||
public System.Windows.Media.Brush SecondaryBrush { get; set; } = System.Windows.Media.Brushes.White;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"installed": {
|
||||
"client_id": "347834359081-0cgj2l2f6a11m25dckg9beuvsclfsd8b.apps.googleusercontent.com",
|
||||
"project_id": "helfer-1600602266879",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://oauth2.googleapis.com/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_secret": "IlzL9Hh_AycZ5qOTFDIGmF6w",
|
||||
"redirect_uris": [
|
||||
"urn:ietf:wg:oauth:2.0:oob",
|
||||
"http://localhost"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
using DesktopMagicPluginAPI;
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
namespace DesktopMagicPlugin.Test
|
||||
{
|
||||
@@ -71,12 +72,16 @@ namespace DesktopMagicPlugin.Test
|
||||
public override Bitmap Main()
|
||||
{
|
||||
if (bitmaps.Count == 0)
|
||||
{
|
||||
return new Bitmap(1, 1);
|
||||
}
|
||||
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= bitmaps.Count)
|
||||
{
|
||||
frameCount = 0;
|
||||
}
|
||||
|
||||
return bitmaps[frameCount];
|
||||
}
|
||||
|
||||
@@ -28,9 +28,14 @@
|
||||
- [Font](#P-DesktopMagicPluginAPI-IPluginData-Font 'DesktopMagicPluginAPI.IPluginData.Font')
|
||||
- [PluginName](#P-DesktopMagicPluginAPI-IPluginData-PluginName 'DesktopMagicPluginAPI.IPluginData.PluginName')
|
||||
- [PluginPath](#P-DesktopMagicPluginAPI-IPluginData-PluginPath 'DesktopMagicPluginAPI.IPluginData.PluginPath')
|
||||
- [Theme](#P-DesktopMagicPluginAPI-IPluginData-Theme 'DesktopMagicPluginAPI.IPluginData.Theme')
|
||||
- [WindowPosition](#P-DesktopMagicPluginAPI-IPluginData-WindowPosition 'DesktopMagicPluginAPI.IPluginData.WindowPosition')
|
||||
- [WindowSize](#P-DesktopMagicPluginAPI-IPluginData-WindowSize 'DesktopMagicPluginAPI.IPluginData.WindowSize')
|
||||
- [UpdateWindow()](#M-DesktopMagicPluginAPI-IPluginData-UpdateWindow 'DesktopMagicPluginAPI.IPluginData.UpdateWindow')
|
||||
- [ITheme](#T-DesktopMagicPluginAPI-ITheme 'DesktopMagicPluginAPI.ITheme')
|
||||
- [Font](#P-DesktopMagicPluginAPI-ITheme-Font 'DesktopMagicPluginAPI.ITheme.Font')
|
||||
- [PrimaryColor](#P-DesktopMagicPluginAPI-ITheme-PrimaryColor 'DesktopMagicPluginAPI.ITheme.PrimaryColor')
|
||||
- [SecondaryColor](#P-DesktopMagicPluginAPI-ITheme-SecondaryColor 'DesktopMagicPluginAPI.ITheme.SecondaryColor')
|
||||
- [IntegerUpDown](#T-DesktopMagicPluginAPI-Inputs-IntegerUpDown 'DesktopMagicPluginAPI.Inputs.IntegerUpDown')
|
||||
- [#ctor(min,max,value)](#M-DesktopMagicPluginAPI-Inputs-IntegerUpDown-#ctor-System-Int32,System-Int32,System-Int32- 'DesktopMagicPluginAPI.Inputs.IntegerUpDown.#ctor(System.Int32,System.Int32,System.Int32)')
|
||||
- [Maximum](#P-DesktopMagicPluginAPI-Inputs-IntegerUpDown-Maximum 'DesktopMagicPluginAPI.Inputs.IntegerUpDown.Maximum')
|
||||
@@ -323,14 +328,14 @@ Defines properties and methods that provide information about the main applicati
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the color of the main application.
|
||||
Gets the current color of the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-IPluginData-Font'></a>
|
||||
### Font `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the font of the main application.
|
||||
Gets the current font of the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-IPluginData-PluginName'></a>
|
||||
### PluginName `property`
|
||||
@@ -346,6 +351,13 @@ Gets the name of the plugin.
|
||||
|
||||
Gets the path of the parent directory of the plugin.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-IPluginData-Theme'></a>
|
||||
### Theme `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the current theme setting of the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-IPluginData-WindowPosition'></a>
|
||||
### WindowPosition `property`
|
||||
|
||||
@@ -371,6 +383,38 @@ Updates the plugin window.
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
<a name='T-DesktopMagicPluginAPI-ITheme'></a>
|
||||
## ITheme `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
DesktopMagicPluginAPI
|
||||
|
||||
##### Summary
|
||||
|
||||
The theme settings of the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-ITheme-Font'></a>
|
||||
### Font `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the font of the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-ITheme-PrimaryColor'></a>
|
||||
### PrimaryColor `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the primary color of the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-ITheme-SecondaryColor'></a>
|
||||
### SecondaryColor `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the secondary color of the main application.
|
||||
|
||||
<a name='T-DesktopMagicPluginAPI-Inputs-IntegerUpDown'></a>
|
||||
## IntegerUpDown `type`
|
||||
|
||||
@@ -588,7 +632,7 @@ Occurs when the user rotates the mouse wheel while the mouse pointer is over thi
|
||||
|
||||
##### Summary
|
||||
|
||||
Occurs once when the pugin gets activated.
|
||||
Occurs once when the plugin gets activated.
|
||||
|
||||
##### Parameters
|
||||
|
||||
|
||||
@@ -283,12 +283,17 @@
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.IPluginData.Font">
|
||||
<summary>
|
||||
Gets the font of the main application.
|
||||
Gets the current font of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.IPluginData.Color">
|
||||
<summary>
|
||||
Gets the color of the main application.
|
||||
Gets the current color of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.IPluginData.Theme">
|
||||
<summary>
|
||||
Gets the current theme setting of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.IPluginData.WindowSize">
|
||||
@@ -316,6 +321,26 @@
|
||||
Updates the plugin window.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DesktopMagicPluginAPI.ITheme">
|
||||
<summary>
|
||||
The theme settings of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.ITheme.PrimaryColor">
|
||||
<summary>
|
||||
Gets the primary color of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.ITheme.SecondaryColor">
|
||||
<summary>
|
||||
Gets the secondary color of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.ITheme.Font">
|
||||
<summary>
|
||||
Gets the font of the main application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DesktopMagicPluginAPI.Plugin">
|
||||
<summary>
|
||||
The plugin class.
|
||||
@@ -338,7 +363,7 @@
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Plugin.Start">
|
||||
<summary>
|
||||
Occurs once when the pugin gets activated.
|
||||
Occurs once when the plugin gets activated.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Plugin.Main">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DesktopMagicPluginAPI
|
||||
{
|
||||
@@ -8,15 +9,22 @@ namespace DesktopMagicPluginAPI
|
||||
public interface IPluginData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the font of the main application.
|
||||
/// Gets the current font of the main application.
|
||||
/// </summary>
|
||||
[Obsolete("Use the \"Theme\" property instead")]
|
||||
string Font { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the main application.
|
||||
/// Gets the current color of the main application.
|
||||
/// </summary>
|
||||
[Obsolete("Use the \"Theme\" property instead")]
|
||||
Color Color { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current theme setting of the main application.
|
||||
/// </summary>
|
||||
ITheme Theme { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the window size of the plugin window.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace DesktopMagicPluginAPI
|
||||
{
|
||||
/// <summary>
|
||||
/// The theme settings of the main application.
|
||||
/// </summary>
|
||||
public interface ITheme
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the primary color of the main application.
|
||||
/// </summary>
|
||||
Color PrimaryColor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the secondary color of the main application.
|
||||
/// </summary>
|
||||
Color SecondaryColor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the font of the main application.
|
||||
/// </summary>
|
||||
string Font { get; }
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ namespace DesktopMagicPluginAPI
|
||||
public virtual RenderQuality RenderQuality { get; set; } = RenderQuality.High;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs once when the pugin gets activated.
|
||||
/// Occurs once when the plugin gets activated.
|
||||
/// </summary>
|
||||
public virtual void Start()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user