diff --git a/SubRenamer/Program.cs b/SubRenamer/Program.cs index 653aee8..5bc1825 100644 --- a/SubRenamer/Program.cs +++ b/SubRenamer/Program.cs @@ -1,5 +1,5 @@ using Avalonia; -using Avalonia.ReactiveUI; +using ReactiveUI.Avalonia; using System; using System.IO; using System.Text; @@ -41,7 +41,7 @@ public static AppBuilder BuildAvaloniaApp() .UsePlatformDetect() .WithInterFont() .LogToTrace() - .UseReactiveUI() + .UseReactiveUI(_ => {}) .With(new MacOSPlatformOptions { DisableDefaultApplicationMenuItems = true diff --git a/SubRenamer/Services/ClipboardService.cs b/SubRenamer/Services/ClipboardService.cs index c13422c..edd01ef 100644 --- a/SubRenamer/Services/ClipboardService.cs +++ b/SubRenamer/Services/ClipboardService.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using Avalonia.Controls; -using Avalonia.Input; +using Avalonia.Input.Platform; using SubRenamer.Model; namespace SubRenamer.Services; @@ -16,10 +16,7 @@ public ClipboardService(Window target) public async Task CopyToClipboard(string content) { - var dataObject = new DataObject(); - dataObject.Set(DataFormats.Text, content); var clipboard = _target.Clipboard; - if (clipboard is not null) await clipboard.SetDataObjectAsync(dataObject); - + if (clipboard is not null) await clipboard.SetTextAsync(content); } } \ No newline at end of file diff --git a/SubRenamer/Services/DialogService.cs b/SubRenamer/Services/DialogService.cs index dd27800..1f0c970 100644 --- a/SubRenamer/Services/DialogService.cs +++ b/SubRenamer/Services/DialogService.cs @@ -52,7 +52,7 @@ public async Task OpenItemEdit(MatchItem item, ObservableCollection c public async Task OpenConflict(List options) { - var keepAllText = Application.Current.GetResource("App.Strings.ConflictKeepAll"); + var keepAllText = Application.Current.GetResource("App.Strings.ConflictKeepAll") ?? ""; var store = new ConflictViewModel([..options, keepAllText]); var dialog = new ConflictWindow diff --git a/SubRenamer/SubRenamer.csproj b/SubRenamer/SubRenamer.csproj index 6a68384..b7dcfd5 100644 --- a/SubRenamer/SubRenamer.csproj +++ b/SubRenamer/SubRenamer.csproj @@ -46,17 +46,17 @@ - - - + + + - - - - + + + + - - + + diff --git a/SubRenamer/Views/ConflictWindow.axaml b/SubRenamer/Views/ConflictWindow.axaml index fbe112a..763dd7f 100644 --- a/SubRenamer/Views/ConflictWindow.axaml +++ b/SubRenamer/Views/ConflictWindow.axaml @@ -2,9 +2,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:viewModels="clr-namespace:SubRenamer.ViewModels" + xmlns:viewModels="using:SubRenamer.ViewModels" mc:Ignorable="d" x:Class="SubRenamer.Views.ConflictWindow" + x:DataType="viewModels:ConflictViewModel" Title="{DynamicResource App.Strings.ConflictTitle}" WindowStartupLocation="CenterOwner" Width="400" diff --git a/SubRenamer/Views/ItemEditWindow.axaml b/SubRenamer/Views/ItemEditWindow.axaml index 38dce9e..0aa42af 100644 --- a/SubRenamer/Views/ItemEditWindow.axaml +++ b/SubRenamer/Views/ItemEditWindow.axaml @@ -2,9 +2,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:vm="clr-namespace:SubRenamer.ViewModels" + xmlns:vm="using:SubRenamer.ViewModels" mc:Ignorable="d" x:Class="SubRenamer.Views.ItemEditWindow" + x:DataType="vm:ItemEditViewModel" Title="{DynamicResource App.Strings.ItemEditTitle}" WindowStartupLocation="CenterOwner" Width="500" diff --git a/SubRenamer/Views/MainWindow.axaml.cs b/SubRenamer/Views/MainWindow.axaml.cs index dc9538c..56f7dba 100644 --- a/SubRenamer/Views/MainWindow.axaml.cs +++ b/SubRenamer/Views/MainWindow.axaml.cs @@ -5,7 +5,8 @@ using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Platform.Storage; -using Avalonia.ReactiveUI; +using ReactiveUI; +using ReactiveUI.Avalonia; using SubRenamer.Helper; using SubRenamer.Model; using SubRenamer.ViewModels; @@ -24,9 +25,9 @@ public MainWindow() private async void OnDrop(object? sender, DragEventArgs e) { - if (!e.Data.Contains(DataFormats.Files)) return; - - var items = e.Data.GetFiles() ?? Array.Empty(); + if (!e.DataTransfer.Contains(DataFormat.File)) return; + + var items = e.DataTransfer.TryGetFiles() ?? Array.Empty(); var files = new List(); foreach (var item in items) diff --git a/SubRenamer/Views/ManualRuleWindow.axaml b/SubRenamer/Views/ManualRuleWindow.axaml index 6d90dac..3228df1 100644 --- a/SubRenamer/Views/ManualRuleWindow.axaml +++ b/SubRenamer/Views/ManualRuleWindow.axaml @@ -5,12 +5,13 @@ mc:Ignorable="d" x:Name="Window" x:Class="SubRenamer.Views.ManualRuleWindow" - xmlns:vm="clr-namespace:SubRenamer.ViewModels" + xmlns:vm="using:SubRenamer.ViewModels" xmlns:common="clr-namespace:SubRenamer.Common" Title="{DynamicResource App.Strings.ManualRuleTitle}" WindowStartupLocation="CenterOwner" Width="710" - SizeToContent="Height"> + SizeToContent="Height" + x:DataType="vm:ManualRuleViewModel"> @@ -26,7 +27,7 @@ - + @@ -42,7 +43,7 @@ - + diff --git a/SubRenamer/Views/RegexRuleWindow.axaml b/SubRenamer/Views/RegexRuleWindow.axaml index 197102e..becff7c 100644 --- a/SubRenamer/Views/RegexRuleWindow.axaml +++ b/SubRenamer/Views/RegexRuleWindow.axaml @@ -5,12 +5,13 @@ mc:Ignorable="d" x:Name="Window" x:Class="SubRenamer.Views.RegexRuleWindow" - xmlns:vm="clr-namespace:SubRenamer.ViewModels" + xmlns:vm="using:SubRenamer.ViewModels" xmlns:common="clr-namespace:SubRenamer.Common" Title="{DynamicResource App.Strings.RegexRuleTitle}" WindowStartupLocation="CenterOwner" Width="500" - SizeToContent="Height"> + SizeToContent="Height" + x:DataType="vm:RegexRuleViewModel"> @@ -37,13 +38,13 @@ diff --git a/SubRenamer/Views/RulesWindow.axaml b/SubRenamer/Views/RulesWindow.axaml index ee813a9..ae0dae6 100644 --- a/SubRenamer/Views/RulesWindow.axaml +++ b/SubRenamer/Views/RulesWindow.axaml @@ -12,7 +12,8 @@ Title="{DynamicResource App.Strings.RulesTitle}" WindowStartupLocation="CenterOwner" Width="500" - SizeToContent="Height"> + SizeToContent="Height" + x:DataType="vm:RulesViewModel"> diff --git a/SubRenamer/Views/SettingsWindow.axaml b/SubRenamer/Views/SettingsWindow.axaml index 765a41a..04164a0 100644 --- a/SubRenamer/Views/SettingsWindow.axaml +++ b/SubRenamer/Views/SettingsWindow.axaml @@ -94,7 +94,7 @@ - + @@ -108,11 +108,11 @@ - + - + diff --git a/SubRenamer/Views/TerminalWindow.axaml b/SubRenamer/Views/TerminalWindow.axaml index eb4c449..035f2e7 100644 --- a/SubRenamer/Views/TerminalWindow.axaml +++ b/SubRenamer/Views/TerminalWindow.axaml @@ -26,15 +26,15 @@ - - +