Skip to content

Commit

Permalink
Upgrade MessageBox.Avalonia
Browse files Browse the repository at this point in the history
  • Loading branch information
legend2k committed May 17, 2024
1 parent 3993ba0 commit 8cbc53e
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 43 deletions.
2 changes: 1 addition & 1 deletion MessageBox.Avalonia
12 changes: 6 additions & 6 deletions YoutubeApp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YoutubeApp", "YoutubeApp\Yo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YoutubeApp.Tests", "YoutubeApp.Tests\YoutubeApp.Tests.csproj", "{FBE41C3C-DA78-4D32-8185-82A1231C2000}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessageBox.Avalonia", "MessageBox.Avalonia\src\MessageBox.Avalonia\MessageBox.Avalonia.csproj", "{B8D18D54-ECC6-49BF-B897-BDDB1BFD8092}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{76C039DA-C7C7-414F-9B6D-983F5341C4AE}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
Expand All @@ -20,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{7580
Scripts\Build.ps1 = Scripts\Build.ps1
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsBox.Avalonia", "MessageBox.Avalonia\MsBox.Avalonia\MsBox.Avalonia.csproj", "{16493E81-1A85-4C63-B85C-A0244A18F57E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,10 +34,10 @@ Global
{FBE41C3C-DA78-4D32-8185-82A1231C2000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBE41C3C-DA78-4D32-8185-82A1231C2000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBE41C3C-DA78-4D32-8185-82A1231C2000}.Release|Any CPU.Build.0 = Release|Any CPU
{B8D18D54-ECC6-49BF-B897-BDDB1BFD8092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8D18D54-ECC6-49BF-B897-BDDB1BFD8092}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8D18D54-ECC6-49BF-B897-BDDB1BFD8092}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8D18D54-ECC6-49BF-B897-BDDB1BFD8092}.Release|Any CPU.Build.0 = Release|Any CPU
{16493E81-1A85-4C63-B85C-A0244A18F57E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16493E81-1A85-4C63-B85C-A0244A18F57E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16493E81-1A85-4C63-B85C-A0244A18F57E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16493E81-1A85-4C63-B85C-A0244A18F57E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 4 additions & 3 deletions YoutubeApp/Messages/ShowMessageBoxCheckboxMessage.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using CommunityToolkit.Mvvm.Messaging.Messages;
using MessageBox.Avalonia.DTO;
using MessageBox.Avalonia.Enums;
using MsBox.Avalonia.Dto;
using MsBox.Avalonia.Enums;

namespace YoutubeApp.Messages;

public class ShowMessageBoxCheckboxMessage : AsyncRequestMessage<CheckboxWindowResultDTO>
public class ShowMessageBoxCheckboxMessage : AsyncRequestMessage<MessageBoxCheckboxResult>
{
public required string Title { get; init; }
public required string Message { get; init; }
public required string CheckboxText { get; init; }
public bool CheckboxDefaultState { get; set; }
public required ButtonEnum ButtonDefinitions { get; init; }
public required Icon Icon { get; init; }
}
4 changes: 2 additions & 2 deletions YoutubeApp/Messages/ShowMessageBoxCustomMessage.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using CommunityToolkit.Mvvm.Messaging.Messages;
using MessageBox.Avalonia.Enums;
using MessageBox.Avalonia.Models;
using MsBox.Avalonia.Enums;
using MsBox.Avalonia.Models;

namespace YoutubeApp.Messages;

Expand Down
2 changes: 1 addition & 1 deletion YoutubeApp/Messages/ShowMessageBoxMessage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using CommunityToolkit.Mvvm.Messaging.Messages;
using MessageBox.Avalonia.Enums;
using MsBox.Avalonia.Enums;

namespace YoutubeApp.Messages;

Expand Down
2 changes: 1 addition & 1 deletion YoutubeApp/ViewModels/AddChannelWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using DynamicData;
using MessageBox.Avalonia.Enums;
using MsBox.Avalonia.Enums;
using YoutubeApp.Database;
using YoutubeApp.Enums;
using YoutubeApp.Media;
Expand Down
2 changes: 1 addition & 1 deletion YoutubeApp/ViewModels/AddLinkWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia.Enums;
using MsBox.Avalonia.Enums;
using YoutubeApp.Enums;
using YoutubeApp.Messages;

Expand Down
2 changes: 1 addition & 1 deletion YoutubeApp/ViewModels/ChannelsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia.Enums;
using Microsoft.Extensions.Logging;
using MsBox.Avalonia.Enums;
using YoutubeApp.Database;
using YoutubeApp.Extensions;
using YoutubeApp.Media;
Expand Down
6 changes: 3 additions & 3 deletions YoutubeApp/ViewModels/DownloadsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia.Enums;
using Microsoft.Extensions.Logging;
using MsBox.Avalonia.Enums;
using YoutubeApp.Database;
using YoutubeApp.Downloader;
using YoutubeApp.Extensions;
Expand Down Expand Up @@ -231,7 +231,7 @@ private async Task RemoveAsync()
}

_downloaderUtils.DeleteTempFiles(selectedItems!);
if (result.IsChecked) _downloaderUtils.DeleteCompletedFiles(selectedItems);
if (result.IsCheckboxChecked) _downloaderUtils.DeleteCompletedFiles(selectedItems);
_downloadData.RemoveDownloads(selectedItems!);

var deletedCount = 0;
Expand Down Expand Up @@ -280,7 +280,7 @@ private async Task RemoveCompletedAsync()

if (result.Button != ButtonResult.Yes) return;

if (result.IsChecked) _downloaderUtils.DeleteCompletedFiles(completedItems);
if (result.IsCheckboxChecked) _downloaderUtils.DeleteCompletedFiles(completedItems);
_downloadData.RemoveDownloads(completedItems);

var deletedCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion YoutubeApp/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia.Enums;
using Microsoft.Extensions.Logging;
using MsBox.Avalonia.Enums;
using YoutubeApp.Downloader;
using YoutubeApp.Messages;
using YoutubeApp.Models;
Expand Down
4 changes: 2 additions & 2 deletions YoutubeApp/ViewModels/MoveChannelWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia.Enums;
using MessageBox.Avalonia.Models;
using MsBox.Avalonia.Enums;
using MsBox.Avalonia.Models;
using YoutubeApp.Database;
using YoutubeApp.Downloader;
using YoutubeApp.Enums;
Expand Down
8 changes: 4 additions & 4 deletions YoutubeApp/Views/AddChannelWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Avalonia.Platform;
using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia;
using MessageBox.Avalonia.DTO;
using MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using YoutubeApp.Enums;
using YoutubeApp.Messages;
using YoutubeApp.ViewModels;
Expand Down Expand Up @@ -48,15 +48,15 @@ public async void Receive(OpenFolderPickerMessage message)
public void Receive(ShowMessageBoxMessage message)
{
var result = MessageBoxManager
.GetMessageBoxStandardWindow(new MessageBoxStandardParams
.GetMessageBoxStandard(new MessageBoxStandardParams
{
ContentTitle = message.Title,
ContentMessage = message.Message,
ButtonDefinitions = message.ButtonDefinitions,
Icon = message.Icon,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowIcon = new WindowIcon(AssetLoader.Open(new Uri("avares://YoutubeApp/Assets/app-logo.ico"))),
}).ShowDialog(this);
}).ShowWindowDialogAsync(this);
message.Reply(result);
}

Expand Down
8 changes: 4 additions & 4 deletions YoutubeApp/Views/AddLinkWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Avalonia.Platform;
using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia;
using MessageBox.Avalonia.DTO;
using MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using YoutubeApp.Enums;
using YoutubeApp.Messages;
using YoutubeApp.ViewModels;
Expand Down Expand Up @@ -59,15 +59,15 @@ public void Receive(CloseWindowMessage<AddLinkWindowResult> message)
public void Receive(ShowMessageBoxMessage message)
{
var result = MessageBoxManager
.GetMessageBoxStandardWindow(new MessageBoxStandardParams
.GetMessageBoxStandard(new MessageBoxStandardParams
{
ContentTitle = message.Title,
ContentMessage = message.Message,
ButtonDefinitions = message.ButtonDefinitions,
Icon = message.Icon,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowIcon = new WindowIcon(AssetLoader.Open(new Uri("avares://YoutubeApp/Assets/app-logo.ico"))),
}).ShowDialog(this);
}).ShowWindowDialogAsync(this);
message.Reply(result);
}
}
13 changes: 7 additions & 6 deletions YoutubeApp/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using Avalonia.Platform;
using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia;
using MessageBox.Avalonia.DTO;
using Microsoft.Extensions.DependencyInjection;
using MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using YoutubeApp.Database;
using YoutubeApp.Downloader;
using YoutubeApp.Media;
Expand Down Expand Up @@ -71,15 +71,15 @@ public void Receive(GrabberListIsOpenMessage message)
public void Receive(ShowMessageBoxMessage message)
{
var result = MessageBoxManager
.GetMessageBoxStandardWindow(new MessageBoxStandardParams
.GetMessageBoxStandard(new MessageBoxStandardParams
{
ContentTitle = message.Title,
ContentMessage = message.Message,
ButtonDefinitions = message.ButtonDefinitions,
Icon = message.Icon,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowIcon = new WindowIcon(AssetLoader.Open(new Uri("avares://YoutubeApp/Assets/app-logo.ico"))),
}).ShowDialog(this);
}).ShowWindowDialogAsync(this);
message.Reply(result);
}

Expand Down Expand Up @@ -148,16 +148,17 @@ public void Receive(ShowColumnsWindowMessage message)

public void Receive(ShowMessageBoxCheckboxMessage message)
{
var result = MessageBoxManager.GetMessageBoxCheckboxWindow(new MessageBoxCheckboxParams
var result = MessageBoxManager.GetMessageBoxCheckbox(new MessageBoxCheckboxParams
{
ContentTitle = message.Title,
ContentMessage = message.Message,
CheckboxText = message.CheckboxText,
CheckboxDefaultState = message.CheckboxDefaultState,
Icon = message.Icon,
ButtonDefinitions = message.ButtonDefinitions,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowIcon = new WindowIcon(AssetLoader.Open(new Uri("avares://YoutubeApp/Assets/app-logo.ico"))),
}).ShowDialog(this);
}).ShowWindowDialogAsync(this);
message.Reply(result);
}

Expand Down
12 changes: 6 additions & 6 deletions YoutubeApp/Views/MoveChannelWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using Avalonia.Interactivity;
using Avalonia.Platform;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia;
using MessageBox.Avalonia.DTO;
using MsBox.Avalonia;
using MsBox.Avalonia.Dto;
using YoutubeApp.Enums;
using YoutubeApp.Messages;
using YoutubeApp.ViewModels;
Expand All @@ -27,15 +27,15 @@ public MoveChannelWindow()
public void Receive(ShowMessageBoxCustomMessage message)
{
var result = MessageBoxManager
.GetMessageBoxCustomWindow(new MessageBoxCustomParams
.GetMessageBoxCustom(new MessageBoxCustomParams
{
ContentTitle = message.Title,
ContentMessage = message.Message,
ButtonDefinitions = message.ButtonDefinitions,
Icon = message.Icon,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowIcon = new WindowIcon(AssetLoader.Open(new Uri("avares://YoutubeApp/Assets/app-logo.ico"))),
}).ShowDialog(this);
}).ShowWindowDialogAsync(this);
message.Reply(result);
}

Expand Down Expand Up @@ -64,15 +64,15 @@ protected override void OnUnloaded(RoutedEventArgs e)
public void Receive(ShowMessageBoxMessage message)
{
var result = MessageBoxManager
.GetMessageBoxStandardWindow(new MessageBoxStandardParams
.GetMessageBoxStandard(new MessageBoxStandardParams
{
ContentTitle = message.Title,
ContentMessage = message.Message,
ButtonDefinitions = message.ButtonDefinitions,
Icon = message.Icon,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowIcon = new WindowIcon(AssetLoader.Open(new Uri("avares://YoutubeApp/Assets/app-logo.ico"))),
}).ShowDialog(this);
}).ShowWindowDialogAsync(this);
message.Reply(result);
}
}
2 changes: 1 addition & 1 deletion YoutubeApp/YoutubeApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MessageBox.Avalonia\src\MessageBox.Avalonia\MessageBox.Avalonia.csproj"/>
<ProjectReference Include="..\MessageBox.Avalonia\MsBox.Avalonia\MsBox.Avalonia.csproj"/>
</ItemGroup>

</Project>

0 comments on commit 8cbc53e

Please sign in to comment.