mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-29 00:26:09 +03:00
56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
using Microsoft.Win32;
|
|
using MvvmCross.Commands;
|
|
using Newtonsoft.Json;
|
|
using System.ComponentModel;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace ProxySuper.Core.Models.Hosts
|
|
{
|
|
public class Host
|
|
{
|
|
|
|
public Host()
|
|
{
|
|
Proxy = new LocalProxy();
|
|
}
|
|
|
|
|
|
public string Tag { get; set; }
|
|
|
|
public string Address { get; set; }
|
|
|
|
public string UserName { get; set; }
|
|
|
|
public string Password { get; set; }
|
|
|
|
public int Port { get; set; } = 22;
|
|
|
|
public string PrivateKeyPath { get; set; }
|
|
|
|
public LocalProxy Proxy { get; set; }
|
|
|
|
public LoginSecretType SecretType { get; set; }
|
|
|
|
public IMvxCommand UploadPrivateKeyCommand => new MvxCommand(UploadPrivateKey);
|
|
|
|
private void UploadPrivateKey()
|
|
{
|
|
var fileDialog = new OpenFileDialog();
|
|
fileDialog.FileOk += OnFileOk;
|
|
fileDialog.ShowDialog();
|
|
}
|
|
|
|
private void OnFileOk(object sender, CancelEventArgs e)
|
|
{
|
|
var file = sender as OpenFileDialog;
|
|
PrivateKeyPath = file.FileName;
|
|
|
|
Task.Delay(300).ContinueWith((t) =>
|
|
{
|
|
MessageBox.Show("上传成功", "提示");
|
|
});
|
|
}
|
|
}
|
|
}
|