1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-29 00:26:09 +03:00
ProxySU/ProxySuper.Core/ViewModels/TrojanGoEditorViewModel.cs
nuxt-autumn eeada87602 update
2021-05-16 16:29:37 +08:00

55 lines
1.3 KiB
C#

using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class TrojanGoEditorViewModel : MvxViewModel<Record, Record>
{
public TrojanGoEditorViewModel(IMvxNavigationService navigationService)
{
NavigationService = navigationService;
}
public IMvxNavigationService NavigationService { get; }
public IMvxCommand SaveCommand => new MvxCommand(Save);
public string Id { get; set; }
public Host Host { get; set; }
public TrojanGoSettings Settings { get; set; }
public override void Prepare(Record parameter)
{
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.TrojanGoSettings;
}
private void Save()
{
NavigationService.Close(this, new Record
{
Id = this.Id,
Host = this.Host,
TrojanGoSettings = Settings,
});
}
}
}