diff --git a/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml b/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml index d326c01..6a5cc4a 100644 --- a/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml +++ b/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml @@ -15,7 +15,10 @@ - + + + + diff --git a/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml.cs b/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml.cs index aafc13b..7416764 100644 --- a/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml.cs +++ b/src/DesktopMagic/BuiltInWindowElements/CpuUsageWindow.xaml.cs @@ -1,4 +1,6 @@ -using Microsoft.Win32; +using DesktopMagic.Helpers; + +using Microsoft.Win32; using System; using System.Diagnostics; @@ -38,7 +40,7 @@ namespace DesktopMagic cpuCounter.InstanceName = "_Total"; Timer t = new Timer(); - t.Interval = 100; + t.Interval = 500; t.Elapsed += UpdateTimer_Elapsed; t.Start(); @@ -81,8 +83,14 @@ namespace DesktopMagic WindowPos.SetIsLocked(this, true); } + textBlock.Background = MainWindow.Theme.BackgroundBrush; textBlock.FontFamily = new FontFamily(MainWindow.Theme.Font); textBlock.Foreground = MainWindow.Theme.PrimaryBrush; + valuetextBlock.Background = MainWindow.Theme.BackgroundBrush; + valuetextBlock.FontFamily = new FontFamily(MainWindow.Theme.Font); + valuetextBlock.Foreground = MainWindow.Theme.PrimaryBrush; + + ClculateWidth(); }); } @@ -91,13 +99,24 @@ namespace DesktopMagic string cpuUsage = GetCpuUsage(); Dispatcher.Invoke(() => { - textBlock.Text = cpuUsage; + valuetextBlock.Text = cpuUsage; }); } + private void ClculateWidth() + { + string template = "CPU: ###%"; + double lenght = 0; + for (int i = 0; i < 9; i++) + { + lenght = Math.Max(StringUtilities.MeasureString(template.Replace('#', i.ToString()[0]), textBlock).Width, lenght); + } + dockPanel.Width = lenght; + } + private string GetCpuUsage() { - return "CPU: " + ((int)cpuCounter.NextValue()).ToString().PadLeft(3, '0') + "%"; + return $"{(int)cpuCounter.NextValue()}%"; } private void Window_LocationChanged(object sender, EventArgs e) diff --git a/src/DesktopMagic/BuiltInWindowElements/DateWindow.xaml.cs b/src/DesktopMagic/BuiltInWindowElements/DateWindow.xaml.cs index c60264e..917d850 100644 --- a/src/DesktopMagic/BuiltInWindowElements/DateWindow.xaml.cs +++ b/src/DesktopMagic/BuiltInWindowElements/DateWindow.xaml.cs @@ -67,7 +67,8 @@ namespace DesktopMagic } textBlock.FontFamily = new FontFamily(MainWindow.Theme.Font); textBlock.Foreground = MainWindow.Theme.PrimaryBrush; - textBlock.Text = DateTime.Now.ToString("D"); + textBlock.Text = DateTime.Now.ToLongDateString(); + textBlock.Background = MainWindow.Theme.BackgroundBrush; }); } diff --git a/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml b/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml index fd7b6b5..99b632e 100644 --- a/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml +++ b/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml @@ -18,7 +18,9 @@ - + + + \ No newline at end of file diff --git a/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml.cs b/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml.cs index b7e7cfb..38a735b 100644 --- a/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml.cs +++ b/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerWindow.xaml.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; -using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; @@ -105,6 +104,7 @@ namespace DesktopMagic { calculate = true; } + backgroundGrid.Background = MainWindow.Theme.BackgroundBrush; }); } @@ -244,7 +244,6 @@ namespace DesktopMagic using (Graphics gr = Graphics.FromImage(bm)) { - gr.SmoothingMode = SmoothingMode.None; PointF[] points = new PointF[scaledFft.Count + 2]; int fftIndex = 0; diff --git a/src/DesktopMagic/BuiltInWindowElements/TimeWindow.xaml.cs b/src/DesktopMagic/BuiltInWindowElements/TimeWindow.xaml.cs index 2558e10..07063c4 100644 --- a/src/DesktopMagic/BuiltInWindowElements/TimeWindow.xaml.cs +++ b/src/DesktopMagic/BuiltInWindowElements/TimeWindow.xaml.cs @@ -1,4 +1,6 @@ -using Microsoft.Win32; +using DesktopMagic.Helpers; + +using Microsoft.Win32; using System; using System.Timers; @@ -29,7 +31,7 @@ namespace DesktopMagic w.Hide(); Timer t = new Timer(); - t.Interval = 100; + t.Interval = 500; t.Elapsed += UpdateTimer_Elapsed; t.Start(); @@ -66,13 +68,27 @@ namespace DesktopMagic WindowPos.SetIsLocked(this, true); } + textBlock.Background = MainWindow.Theme.BackgroundBrush; 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"); + + ClculateWidth(); }); } + private void ClculateWidth() + { + string template = "##:##:##"; + double lenght = 0; + for (int i = 0; i < 9; i++) + { + lenght = Math.Max(StringUtilities.MeasureString(template.Replace('#', i.ToString()[0]), textBlock).Width, lenght); + } + textBlock.Width = lenght; + } + private void Window_LocationChanged(object sender, EventArgs e) { key.SetValue("TimeWindowTop", Top); diff --git a/src/DesktopMagic/DesktopMagic.csproj b/src/DesktopMagic/DesktopMagic.csproj index 2e01db7..8f180ab 100644 --- a/src/DesktopMagic/DesktopMagic.csproj +++ b/src/DesktopMagic/DesktopMagic.csproj @@ -8,11 +8,11 @@ icon.ico OnBuildSuccess Stone_Red - 0.0.3.0 + 0.0.3.1 https://github.com/Stone-Red-Code/DesktopMagic https://github.com/Stone-Red-Code/DesktopMagic - 0.0.3.0 - 0.0.3.0 + 0.0.3.1 + 0.0.3.1 diff --git a/src/DesktopMagic/Dialogs/ColorDialog.xaml b/src/DesktopMagic/Dialogs/ColorDialog.xaml new file mode 100644 index 0000000..abd2ee2 --- /dev/null +++ b/src/DesktopMagic/Dialogs/ColorDialog.xaml @@ -0,0 +1,49 @@ + + + +