mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
- Minor code impovemnets
This commit is contained in:
@@ -4,7 +4,6 @@ using NAudio.Wave;
|
|||||||
|
|
||||||
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.Globalization;
|
using System.Globalization;
|
||||||
@@ -227,8 +226,6 @@ namespace DesktopMagic
|
|||||||
lastFft = fft;
|
lastFft = fft;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Stopwatch sw = new Stopwatch();
|
|
||||||
sw.Start();
|
|
||||||
Bitmap bm = new Bitmap(880, 300);
|
Bitmap bm = new Bitmap(880, 300);
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -78,31 +78,27 @@
|
|||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Grid.Column="0" Margin="{StaticResource DefaultMargin}" HorizontalAlignment="Stretch">
|
<Grid Grid.Column="0" Margin="{StaticResource DefaultMargin}" HorizontalAlignment="Stretch">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Text="Display Font: " Grid.Column="0" Grid.Row="0" VerticalAlignment="Center"></TextBlock>
|
||||||
|
<ComboBox x:Name="fontComboBox" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" SelectionChanged="FontComboBox_SelectionChanged" Margin="0,0,0,5" />
|
||||||
|
|
||||||
<Grid>
|
<TextBlock Text="Corner Radius: " Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"></TextBlock>
|
||||||
<Grid.ColumnDefinitions>
|
<TextBox x:Name="cornerRadiusTextBox" Grid.Column="1" Grid.Row="1" Text="10" TextChanged="CornerRadiusTextBox_TextChanged" materialDesign:HintAssist.HelperText="In px" materialDesign:HintAssist.Hint="Enter a number">
|
||||||
<ColumnDefinition Width="1*"/>
|
<materialDesign:TextFieldAssist.CharacterCounterStyle>
|
||||||
<ColumnDefinition Width="2*"/>
|
<Style TargetType="TextBlock" />
|
||||||
</Grid.ColumnDefinitions>
|
</materialDesign:TextFieldAssist.CharacterCounterStyle>
|
||||||
<TextBlock Text="Display Font: " Grid.Column="0" VerticalAlignment="Center"></TextBlock>
|
</TextBox>
|
||||||
<ComboBox x:Name="fontComboBox" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" SelectionChanged="FontComboBox_SelectionChanged" Margin="0,0,0,5" />
|
</Grid>
|
||||||
</Grid>
|
<StackPanel Grid.Column="1" Margin="{StaticResource DefaultMargin}" HorizontalAlignment="Stretch">
|
||||||
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="1*"/>
|
|
||||||
<ColumnDefinition Width="2*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Text="Corner Radius: " Grid.Column="0" VerticalAlignment="Center"></TextBlock>
|
|
||||||
<TextBox x:Name="cornerRadiusTextBox" Grid.Column="1" Text="10" TextChanged="CornerRadiusTextBox_TextChanged" materialDesign:HintAssist.HelperText="In px" materialDesign:HintAssist.Hint="Enter a number">
|
|
||||||
<materialDesign:TextFieldAssist.CharacterCounterStyle>
|
|
||||||
<Style TargetType="TextBlock" />
|
|
||||||
</materialDesign:TextFieldAssist.CharacterCounterStyle>
|
|
||||||
</TextBox>
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Grid.Column="1" Margin="{StaticResource DefaultMargin}" HorizontalAlignment="Left">
|
|
||||||
<DockPanel Margin="0,0,0,5">
|
<DockPanel Margin="0,0,0,5">
|
||||||
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
||||||
<Rectangle x:Name="primaryColorRechtangle" Fill="White" />
|
<Rectangle x:Name="primaryColorRechtangle" Fill="White" />
|
||||||
|
|||||||
@@ -11,14 +11,13 @@ namespace DesktopMagic.Plugins
|
|||||||
public PluginData(PluginWindow window)
|
public PluginData(PluginWindow window)
|
||||||
{
|
{
|
||||||
this.window = window;
|
this.window = window;
|
||||||
Theme = MainWindow.Theme;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Font => Theme.Font;
|
public string Font => Theme.Font;
|
||||||
|
|
||||||
public Color Color => Theme.PrimaryColor;
|
public Color Color => Theme.PrimaryColor;
|
||||||
|
|
||||||
public ITheme Theme { get; }
|
public ITheme Theme { get; } = MainWindow.Theme;
|
||||||
|
|
||||||
public Size WindowSize => new Size((int)window.ActualWidth, (int)window.ActualHeight);
|
public Size WindowSize => new Size((int)window.ActualWidth, (int)window.ActualHeight);
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
//Set the window style to noactivate.
|
//Set the window style to noactivate.
|
||||||
WindowInteropHelper helper = new(this);
|
WindowInteropHelper helper = new(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,10 +202,10 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
if (prop.GetValue(instance) is Element element)
|
if (prop.GetValue(instance) is Element element)
|
||||||
{
|
{
|
||||||
object[] attrs = prop.GetCustomAttributes(true);
|
object[] attributes = prop.GetCustomAttributes(true);
|
||||||
foreach (object attr in attrs)
|
foreach (object attribute in attributes)
|
||||||
{
|
{
|
||||||
if (attr is ElementAttribute elementAttribute)
|
if (attribute is ElementAttribute elementAttribute)
|
||||||
{
|
{
|
||||||
settingElements.Add(new SettingElement(element, elementAttribute.Name, elementAttribute.OrderIndex));
|
settingElements.Add(new SettingElement(element, elementAttribute.Name, elementAttribute.OrderIndex));
|
||||||
break;
|
break;
|
||||||
@@ -294,7 +294,7 @@ namespace DesktopMagic
|
|||||||
BitmapSource bitmapSource = BitmapSource.Create(
|
BitmapSource bitmapSource = BitmapSource.Create(
|
||||||
bitmapData.Width, bitmapData.Height,
|
bitmapData.Width, bitmapData.Height,
|
||||||
bitmap.HorizontalResolution, bitmap.VerticalResolution,
|
bitmap.HorizontalResolution, bitmap.VerticalResolution,
|
||||||
System.Windows.Media.PixelFormats.Bgra32, null,
|
PixelFormats.Bgra32, null,
|
||||||
bitmapData.Scan0, bitmapData.Stride * bitmapData.Height, bitmapData.Stride);
|
bitmapData.Scan0, bitmapData.Stride * bitmapData.Height, bitmapData.Stride);
|
||||||
|
|
||||||
bitmap.UnlockBits(bitmapData);
|
bitmap.UnlockBits(bitmapData);
|
||||||
|
|||||||
Reference in New Issue
Block a user