diff --git a/src/DownloadManager.WPF/DownloadManager.WPF.csproj b/src/DownloadManager.WPF/DownloadManager.WPF.csproj index 9bdcdd7..d5790b7 100644 --- a/src/DownloadManager.WPF/DownloadManager.WPF.csproj +++ b/src/DownloadManager.WPF/DownloadManager.WPF.csproj @@ -2,15 +2,26 @@ WinExe - net8.0-windows + net8.0-windows10.0.19041.0 + 7.0 enable enable true - true + hDM + DownloadManager.WPF + Resources\hDM.ico + AnyCPU + app.manifest + + + + + + diff --git a/src/DownloadManager.WPF/Resources/AppIcon.ico b/src/DownloadManager.WPF/Resources/AppIcon.ico new file mode 100644 index 0000000..b8bd194 Binary files /dev/null and b/src/DownloadManager.WPF/Resources/AppIcon.ico differ diff --git a/src/DownloadManager.WPF/Resources/AppIcon.png b/src/DownloadManager.WPF/Resources/AppIcon.png new file mode 100644 index 0000000..d7668e0 Binary files /dev/null and b/src/DownloadManager.WPF/Resources/AppIcon.png differ diff --git a/src/DownloadManager.WPF/Resources/Down_nb-02.png b/src/DownloadManager.WPF/Resources/Down_nb-02.png new file mode 100644 index 0000000..c5c9a92 Binary files /dev/null and b/src/DownloadManager.WPF/Resources/Down_nb-02.png differ diff --git a/src/DownloadManager.WPF/Resources/hDM.ico b/src/DownloadManager.WPF/Resources/hDM.ico new file mode 100644 index 0000000..491ade1 Binary files /dev/null and b/src/DownloadManager.WPF/Resources/hDM.ico differ diff --git a/src/DownloadManager.WPF/Views/MainWindow.xaml b/src/DownloadManager.WPF/Views/MainWindow.xaml index 7a1f758..cfa4c3c 100644 --- a/src/DownloadManager.WPF/Views/MainWindow.xaml +++ b/src/DownloadManager.WPF/Views/MainWindow.xaml @@ -12,7 +12,7 @@ x:Name="RootWindow" ui:WindowHelper.UseModernWindowStyle="True" ui:ThemeManager.IsThemeAware="True" - Icon="{DynamicResource AppIcon}" + Icon="pack://application:,,,/Resources/Down_nb-02.png" Title="hOLOlu Download Manager" Height="650" Width="1150"> @@ -56,14 +56,14 @@ - - + + - - + + - - + + @@ -105,10 +105,15 @@ + - + + Foreground="White" FontSize="20" FontWeight="Bold" Opacity="0.9" Margin="65,0,0,0" Height="30" Width="266"> + + + + + + + + + + + + + @@ -128,7 +147,7 @@ - + @@ -229,7 +248,7 @@ - diff --git a/src/DownloadManager.WPF/Views/MainWindow.xaml.cs b/src/DownloadManager.WPF/Views/MainWindow.xaml.cs index 4ad466a..f391860 100644 --- a/src/DownloadManager.WPF/Views/MainWindow.xaml.cs +++ b/src/DownloadManager.WPF/Views/MainWindow.xaml.cs @@ -33,38 +33,19 @@ public partial class MainWindow : System.Windows.Window private void InitializeTrayIcon() { - var iconRes = TryFindResource("AppIcon"); - if (iconRes is DrawingImage drawingImage) + try { - try + var uri = new Uri("pack://application:,,,/Resources/hDM.ico"); + var streamInfo = System.Windows.Application.GetResourceStream(uri); + if (streamInfo != null) { - var drawingVisual = new DrawingVisual(); - using (var context = drawingVisual.RenderOpen()) - { - context.DrawImage(drawingImage, new Rect(0, 0, 48, 48)); - } - - var rtb = new System.Windows.Media.Imaging.RenderTargetBitmap(48, 48, 96, 96, PixelFormats.Pbgra32); - rtb.Render(drawingVisual); - - var encoder = new System.Windows.Media.Imaging.PngBitmapEncoder(); - encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(rtb)); - - using (var ms = new MemoryStream()) - { - encoder.Save(ms); - ms.Seek(0, SeekOrigin.Begin); - using (var bitmap = new System.Drawing.Bitmap(ms)) - { - MainTaskbarIcon.Icon = System.Drawing.Icon.FromHandle(bitmap.GetHicon()); - } - } - } - catch (System.Exception ex) - { - Serilog.Log.Warning(ex, "Tepsi simgesi oluşturulurken hata."); + MainTaskbarIcon.Icon = new System.Drawing.Icon(streamInfo.Stream); } } + catch (Exception ex) + { + Serilog.Log.Error(ex, "Tray icon yüklenemedi."); + } } private void MainTaskbarIcon_TrayMouseDoubleClick(object sender, RoutedEventArgs e)