Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ConfuserEx/BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ internal class BoolToVisibilityConverter : IValueConverter {

public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
Debug.Assert(value is bool);
Debug.Assert(targetType == typeof(Visibility));
Debug.Assert(targetType == typeof(Visibility) || targetType == typeof(Visibility?), $"Expected Visibility or Nullable<Visibility>, but {targetType} given.");
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotSupportedException();
}
}
}
}
5 changes: 3 additions & 2 deletions ConfuserEx/ConfuserEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
</PropertyGroup>

<ItemGroup Label="Nuget Dependencies">
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="4.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" Condition="$(TargetFramework) != 'net472'" />
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" Condition="$(TargetFramework) == 'net472'" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
</ItemGroup>

<ItemGroup Label="Project Dependencies">
Expand Down
20 changes: 13 additions & 7 deletions ConfuserEx/FileDragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Input;
#if NET
using CommunityToolkit.Mvvm.Input;
using DragDropCommand = CommunityToolkit.Mvvm.Input.RelayCommand<System.Tuple<System.Windows.UIElement, System.Windows.IDataObject>>;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using ConfuserEx.ViewModel;
using GalaSoft.MvvmLight.CommandWpf;

namespace ConfuserEx {
public class FileDragDrop {
Expand Down Expand Up @@ -108,12 +113,13 @@ static void OnDrop(object sender, DragEventArgs e) {
cmd.Execute(e.Data);
}
e.Handled = true;
}


}
#if NETFRAMEWORK
class DragDropCommand : RelayCommand<Tuple<UIElement, IDataObject>> {
public DragDropCommand(Action<Tuple<UIElement, IDataObject>> execute, Func<Tuple<UIElement, IDataObject>, bool> canExecute)
: base(execute, canExecute) { }
}
}
#endif
}
}
}
12 changes: 8 additions & 4 deletions ConfuserEx/ViewModel/UI/AboutTabVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
using System.Diagnostics;
using System.Linq;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using GalaSoft.MvvmLight.CommandWpf;

using System.Windows.Media.Imaging;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif

namespace ConfuserEx.ViewModel {
internal class AboutTabVM : TabViewModel {
public AboutTabVM(AppVM app)
Expand All @@ -20,4 +24,4 @@ public ICommand LaunchBrowser {

public BitmapSource Icon { get; private set; }
}
}
}
8 changes: 6 additions & 2 deletions ConfuserEx/ViewModel/UI/AppVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
using System.Windows.Input;
using System.Xml;
using Confuser.Core;
using Confuser.Core.Project;
using GalaSoft.MvvmLight.CommandWpf;
using Confuser.Core.Project;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using Ookii.Dialogs.Wpf;

namespace ConfuserEx.ViewModel {
Expand Down
8 changes: 6 additions & 2 deletions ConfuserEx/ViewModel/UI/ProjectTabVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
using System.Windows;
using System.Windows.Input;
using Confuser.Core.Project;
using ConfuserEx.Views;
using GalaSoft.MvvmLight.CommandWpf;
using ConfuserEx.Views;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using Ookii.Dialogs.Wpf;

namespace ConfuserEx.ViewModel {
Expand Down
10 changes: 7 additions & 3 deletions ConfuserEx/ViewModel/UI/ProtectTabVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
using System.Windows.Input;
using System.Windows.Media;
using Confuser.Core;
using Confuser.Core.Project;
using GalaSoft.MvvmLight.CommandWpf;

using Confuser.Core.Project;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif

namespace ConfuserEx.ViewModel {
internal class ProtectTabVM : TabViewModel, ILogger {
readonly Paragraph documentContent;
Expand Down
10 changes: 7 additions & 3 deletions ConfuserEx/ViewModel/UI/SettingsTabVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
using System.Windows.Input;
using Confuser.Core;
using Confuser.Core.Project;
using ConfuserEx.Views;
using GalaSoft.MvvmLight.CommandWpf;

using ConfuserEx.Views;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif

namespace ConfuserEx.ViewModel {
internal class SettingsTabVM : TabViewModel {
bool hasPacker;
Expand Down
17 changes: 13 additions & 4 deletions ConfuserEx/Views/ProjectRuleView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
using System.Windows.Media;
using Confuser.Core;
using Confuser.Core.Project;
using ConfuserEx.ViewModel;
using GalaSoft.MvvmLight.CommandWpf;

using ConfuserEx.ViewModel;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif

namespace ConfuserEx.Views {
public partial class ProjectRuleView : Window {
readonly ProjectVM proj;
Expand Down Expand Up @@ -43,7 +47,12 @@ public override void OnApplyTemplate() {
prots.SelectedIndex = selIndex >= rule.Protections.Count ? rule.Protections.Count - 1 : selIndex;
}, () => prots.SelectedIndex != -1);

prots.SelectionChanged += (sender, args) => (RemoveBtn.Command as RelayCommand)?.RaiseCanExecuteChanged();
prots.SelectionChanged += (sender, args) => (RemoveBtn.Command as RelayCommand)?
#if NETFRAMEWORK
.RaiseCanExecuteChanged();
#else
.NotifyCanExecuteChanged();
#endif
}

public void Cleanup() {
Expand Down
10 changes: 7 additions & 3 deletions ConfuserEx/Views/ProjectTabAdvancedView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
using System;
using System.Diagnostics;
using System.Windows;
using ConfuserEx.ViewModel;
using GalaSoft.MvvmLight.CommandWpf;
using ConfuserEx.ViewModel;
#if NET
using CommunityToolkit.Mvvm.Input;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using Ookii.Dialogs.Wpf;

namespace ConfuserEx.Views {
Expand Down Expand Up @@ -61,4 +65,4 @@ public override void OnApplyTemplate() {
}, () => ProbePaths.SelectedIndex != -1);
}
}
}
}
Loading