mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-18 18:35:00 +03:00
ReactiveUI 24 (#9678)
* ReactiveUI.SourceGenerators * Primitives * Try fix
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ReactiveUI />
|
||||
</Weavers>
|
||||
@@ -3,9 +3,6 @@ global using System.Collections.Generic;
|
||||
global using System.Globalization;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Reactive;
|
||||
global using System.Reactive.Disposables.Fluent;
|
||||
global using System.Reactive.Linq;
|
||||
global using System.Runtime.Versioning;
|
||||
global using System.Text;
|
||||
global using System.Threading;
|
||||
@@ -21,10 +18,11 @@ global using Avalonia.Media.Imaging;
|
||||
global using Avalonia.Platform;
|
||||
global using Avalonia.Styling;
|
||||
global using Avalonia.Threading;
|
||||
global using DynamicData;
|
||||
global using ReactiveUI;
|
||||
global using ReactiveUI.Avalonia;
|
||||
global using ReactiveUI.Fody.Helpers;
|
||||
global using ReactiveUI.Primitives;
|
||||
global using ReactiveUI.Primitives.Disposables;
|
||||
global using ReactiveUI.SourceGenerators;
|
||||
global using ServiceLib;
|
||||
global using ServiceLib.Base;
|
||||
global using ServiceLib.Common;
|
||||
|
||||
@@ -5,13 +5,13 @@ using Semi.Avalonia;
|
||||
|
||||
namespace v2rayN.Desktop.ViewModels;
|
||||
|
||||
public class ThemeSettingViewModel : MyReactiveObject
|
||||
public partial class ThemeSettingViewModel : MyReactiveObject
|
||||
{
|
||||
[Reactive] public string CurrentTheme { get; set; }
|
||||
[Reactive] public partial string CurrentTheme { get; set; }
|
||||
|
||||
[Reactive] public int CurrentFontSize { get; set; }
|
||||
[Reactive] public partial int CurrentFontSize { get; set; }
|
||||
|
||||
[Reactive] public string CurrentLanguage { get; set; }
|
||||
[Reactive] public partial string CurrentLanguage { get; set; }
|
||||
|
||||
public ThemeSettingViewModel()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public partial class AddGroupServerWindow : WindowBase<AddGroupServerViewModel>
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.WhenAnyValue(v => v.ViewModel.SelectedSource)
|
||||
.WhereNotNull()
|
||||
.KeepNotNull()
|
||||
.Subscribe(InitializeData)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
@@ -39,11 +38,12 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.WhenAnyValue(v => v.ViewModel.SelectedSource)
|
||||
.WhereNotNull()
|
||||
.KeepNotNull()
|
||||
.Subscribe(InitializeData)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
var configTypeBindings = new SerialDisposable().DisposeWith(disposables);
|
||||
var configTypeBindings = new SingleReplaceableDisposable();
|
||||
configTypeBindings.DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.CoreType, v => v.cmbCoreType.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
|
||||
@@ -53,8 +53,8 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||
this.WhenAnyValue(v => v.ViewModel.SelectedSource.ConfigType)
|
||||
.Subscribe(configType =>
|
||||
{
|
||||
var currentTypeDisposables = new CompositeDisposable();
|
||||
configTypeBindings.Disposable = currentTypeDisposables;
|
||||
var currentTypeDisposables = new MultipleDisposable();
|
||||
configTypeBindings.Create(currentTypeDisposables);
|
||||
|
||||
switch (configType)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using DialogHostAvalonia;
|
||||
using v2rayN.Desktop.Base;
|
||||
@@ -10,7 +9,7 @@ namespace v2rayN.Desktop.Views;
|
||||
public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
{
|
||||
private static Config _config;
|
||||
private readonly SerialDisposable _layoutBindingsDisposable = new();
|
||||
private readonly SingleReplaceableDisposable _layoutBindingsDisposable = new();
|
||||
private readonly WindowNotificationManager? _manager;
|
||||
private CheckUpdateView? _checkUpdateView;
|
||||
private BackupAndRestoreView? _backupAndRestoreView;
|
||||
@@ -111,7 +110,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
ViewModel.ShowHideWindowInteraction.RegisterHandler(interaction =>
|
||||
{
|
||||
ShowHideWindow(interaction.Input);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
AppEvents.SendSnackMsgRequested
|
||||
@@ -402,8 +401,8 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
|
||||
private void UpdateLayout(EGirdOrientation orientation)
|
||||
{
|
||||
var currentLayoutDisposables = new CompositeDisposable();
|
||||
_layoutBindingsDisposable.Disposable = currentLayoutDisposables;
|
||||
var currentLayoutDisposables = new MultipleDisposable();
|
||||
_layoutBindingsDisposable.Create(currentLayoutDisposables);
|
||||
|
||||
gridMain.IsVisible = orientation == EGirdOrientation.Horizontal;
|
||||
gridMain1.IsVisible = orientation == EGirdOrientation.Vertical;
|
||||
|
||||
@@ -21,8 +21,10 @@ public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
||||
var msg = interaction.Input;
|
||||
Dispatcher.UIThread.Post(() => ShowMsg(msg),
|
||||
DispatcherPriority.ApplicationIdle);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel?.FlushQueueMsg();
|
||||
});
|
||||
|
||||
TextEditorKeywordHighlighter.Attach(txtMsg, Global.LogLevelColors.ToDictionary(
|
||||
|
||||
@@ -109,8 +109,7 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||
this.Bind(ViewModel, vm => vm.UdpTestTarget, v => v.cmbUdpTestTarget.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.MixedConcurrencyCount, v => v.cmbMixedConcurrencyCount.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
|
||||
this.Bind<OptionSettingViewModel, OptionSettingWindow, int, int>(ViewModel,
|
||||
vm => vm.MainGirdOrientation, view => view.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.MainGirdOrientation, view => view.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.GeoFileSourceUrl, v => v.cmbGetFilesSourceUrl.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SrsFileSourceUrl, v => v.cmbSrsFilesSourceUrl.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.RoutingRulesSourceUrl, v => v.cmbRoutingRulesSourceUrl.Text).DisposeWith(disposables);
|
||||
|
||||
@@ -35,7 +35,7 @@ public partial class ProfilesSelectWindow : WindowBase<ProfilesSelectViewModel>
|
||||
ViewModel.ProfilesFocusInteraction.RegisterHandler(interaction =>
|
||||
{
|
||||
lstProfiles.Focus();
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Avalonia.VisualTree;
|
||||
using DialogHostAvalonia;
|
||||
using DynamicData.Binding;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
@@ -113,13 +112,13 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||
{
|
||||
var strData = interaction.Input;
|
||||
await AvaUtils.SetClipboardData(this, strData);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel.ProfilesFocusInteraction.RegisterHandler(interaction =>
|
||||
{
|
||||
lstProfiles.Focus();
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel.ShareServerInteraction.RegisterHandler(async interaction =>
|
||||
@@ -127,23 +126,23 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||
var url = interaction.Input;
|
||||
if (url.IsNullOrEmpty())
|
||||
{
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
return;
|
||||
}
|
||||
await ShareServer(url);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel.DispatcherRefreshServersBizInteraction.RegisterHandler(interaction =>
|
||||
{
|
||||
Dispatcher.UIThread.Post(RefreshServersBiz, DispatcherPriority.Default);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel.AdjustMainLvColWidthInteraction.RegisterHandler(interaction =>
|
||||
{
|
||||
//AutofitColumnWidth();
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
AppEvents.AppExitRequested
|
||||
|
||||
@@ -22,7 +22,7 @@ public partial class RoutingRuleDetailsWindow : WindowBase<RoutingRuleDetailsVie
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.WhenAnyValue(v => v.ViewModel.SelectedSource)
|
||||
.WhereNotNull()
|
||||
.KeepNotNull()
|
||||
.Subscribe(InitializeData)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public partial class RoutingRuleSettingWindow : WindowBase<RoutingRuleSettingVie
|
||||
{
|
||||
var strData = interaction.Input;
|
||||
await AvaUtils.SetClipboardData(this, strData);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel.ReadTextFromClipboardInteraction.RegisterHandler(async interaction =>
|
||||
|
||||
@@ -34,7 +34,7 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
||||
{
|
||||
var strData = interaction.Input;
|
||||
await AvaUtils.SetClipboardData(this, strData);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
ViewModel.PasswordInputInteraction.RegisterHandler(async interaction =>
|
||||
@@ -46,7 +46,7 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
||||
ViewModel.DispatcherRefreshIconInteraction.RegisterHandler(interaction =>
|
||||
{
|
||||
Dispatcher.UIThread.Post(RefreshIcon, DispatcherPriority.Default);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
});
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ public partial class SubSettingWindow : WindowBase<SubSettingViewModel>
|
||||
var url = interaction.Input;
|
||||
if (url.IsNullOrEmpty())
|
||||
{
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
return;
|
||||
}
|
||||
await ShareSub(url);
|
||||
interaction.SetOutput(Unit.Default);
|
||||
interaction.SetOutput(RxVoid.Default);
|
||||
}).DisposeWith(disposables);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="AvaloniaUI.DiagnosticsSupport" />
|
||||
<PackageReference Include="DialogHost.Avalonia" />
|
||||
<PackageReference Include="ReactiveUI.Avalonia" />
|
||||
<PackageReference Include="ReactiveUI.SourceGenerators">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Semi.Avalonia" />
|
||||
<PackageReference Include="Semi.Avalonia.AvaloniaEdit" />
|
||||
<PackageReference Include="Semi.Avalonia.DataGrid">
|
||||
@@ -27,9 +31,6 @@
|
||||
<PackageReference Include="ReactiveUI">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ReactiveUI.Fody">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user