mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-02 04:52:09 +00:00
Adjustment of server binding
This commit is contained in:
parent
43753b1b7a
commit
d3c0f50fec
4 changed files with 10 additions and 2 deletions
|
@ -9,6 +9,8 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ProfileItem SelectedSource { get; set; }
|
public ProfileItem SelectedSource { get; set; }
|
||||||
|
[Reactive]
|
||||||
|
public string? CoreType { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> BrowseServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> BrowseServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
||||||
|
@ -29,6 +31,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
SelectedSource = JsonUtils.DeepCopy(profileItem);
|
SelectedSource = JsonUtils.DeepCopy(profileItem);
|
||||||
}
|
}
|
||||||
|
CoreType = SelectedSource?.coreType?.ToString();
|
||||||
|
|
||||||
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
@ -60,6 +63,7 @@ namespace ServiceLib.ViewModels
|
||||||
_noticeHandler?.Enqueue(ResUI.FillServerAddressCustom);
|
_noticeHandler?.Enqueue(ResUI.FillServerAddressCustom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SelectedSource.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), CoreType);
|
||||||
|
|
||||||
if (ConfigHandler.EditCustomServer(_config, SelectedSource) == 0)
|
if (ConfigHandler.EditCustomServer(_config, SelectedSource) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ProfileItem SelectedSource { get; set; }
|
public ProfileItem SelectedSource { get; set; }
|
||||||
|
[Reactive]
|
||||||
|
public string? CoreType { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
SelectedSource = JsonUtils.DeepCopy(profileItem);
|
SelectedSource = JsonUtils.DeepCopy(profileItem);
|
||||||
}
|
}
|
||||||
|
CoreType = SelectedSource?.coreType?.ToString();
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
|
@ -79,6 +82,7 @@ namespace ServiceLib.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SelectedSource.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), CoreType);
|
||||||
|
|
||||||
if (ConfigHandler.AddServer(_config, SelectedSource) == 0)
|
if (ConfigHandler.AddServer(_config, SelectedSource) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.address, v => v.txtAddress.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.address, v => v.txtAddress.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.coreType, v => v.cmbCoreType.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType, v => v.cmbCoreType.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.displayLog, v => v.togDisplayLog.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.displayLog, v => v.togDisplayLog.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.preSocksPort, v => v.txtPreSocksPort.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.preSocksPort, v => v.txtPreSocksPort.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace v2rayN.Views
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.coreType, v => v.cmbCoreType.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType, v => v.cmbCoreType.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.address, v => v.txtAddress.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.address, v => v.txtAddress.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.port, v => v.txtPort.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.port, v => v.txtPort.Text).DisposeWith(disposables);
|
||||||
|
|
Loading…
Reference in a new issue