1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-25 22:56:09 +03:00

update subscrible and share link

This commit is contained in:
next-autumn 2021-03-17 11:58:56 +08:00
parent 737deb7ca5
commit d6242fb49b
16 changed files with 347 additions and 165 deletions

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
namespace ProxySU_Core.ViewModels.Developers namespace ProxySU_Core.Models.Developers
{ {
public class ConfigBuilder public class ConfigBuilder
{ {
@ -96,16 +96,10 @@ namespace ProxySU_Core.ViewModels.Developers
xver = 1, xver = 1,
})); }));
xrayConfig.inbounds.Add(baseBound); xrayConfig.inbounds.Add(baseBound);
if (parameters.Types.Contains(XrayType.VLESS_TCP_XTLS))
{
baseBound.settings.clients[0].id = parameters.UUID; baseBound.settings.clients[0].id = parameters.UUID;
}
if (parameters.Types.Contains(XrayType.VLESS_WS_TLS)) if (parameters.Types.Contains(XrayType.VLESS_WS_TLS))
{ {
baseBound.settings.clients[0].id = parameters.UUID;
var wsInbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_WS_TLS.json")); var wsInbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_WS_TLS.json"));
wsInbound.port = VLESS_WS_Port; wsInbound.port = VLESS_WS_Port;
wsInbound.settings.clients[0].id = parameters.UUID; wsInbound.settings.clients[0].id = parameters.UUID;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace ProxySU_Core.ViewModels.Developers namespace ProxySU_Core.Models.Developers
{ {
public interface IParameters public interface IParameters
{ {

View File

@ -1,4 +1,5 @@
using ProxySU_Core.Tools; using ProxySU_Core.Tools;
using ProxySU_Core.ViewModels;
using Renci.SshNet; using Renci.SshNet;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -9,7 +10,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
namespace ProxySU_Core.ViewModels.Developers namespace ProxySU_Core.Models.Developers
{ {
public enum CmdType public enum CmdType
{ {

View File

@ -8,7 +8,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using ProxySU_Core.Models; using ProxySU_Core.Models;
namespace ProxySU_Core.ViewModels.Developers namespace ProxySU_Core.Models.Developers
{ {
public class XrayProject : Project<XraySettings> public class XrayProject : Project<XraySettings>
{ {

View File

@ -0,0 +1,170 @@
using Newtonsoft.Json;
using ProxySU_Core.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace ProxySU_Core.Models
{
public class ShareLink
{
public static string Build(XrayType xrayType, XraySettings settings)
{
switch (xrayType)
{
case XrayType.VLESS_TCP_TLS:
case XrayType.VLESS_TCP_XTLS:
case XrayType.VLESS_WS_TLS:
case XrayType.Trojan_TCP_TLS:
return BuildVlessShareLink(xrayType, settings);
case XrayType.VMESS_TCP_TLS:
case XrayType.VMESS_WS_TLS:
return BuildVmessShareLink(xrayType, settings);
default:
return string.Empty;
}
}
private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
{
var vmess = new Vmess
{
v = "2",
add = settings.Domain,
port = settings.Port.ToString(),
id = settings.UUID,
aid = "0",
net = "",
type = "none",
host = settings.Domain,
path = "",
tls = "tls",
ps = "",
};
switch (xrayType)
{
case XrayType.VMESS_TCP_TLS:
vmess.ps = "vmess-tcp-tls";
vmess.net = "tcp";
vmess.type = "http";
vmess.path = settings.VMESS_TCP_Path;
break;
case XrayType.VMESS_WS_TLS:
vmess.ps = "vmess-ws-tls";
vmess.net = "ws";
vmess.type = "none";
vmess.path = settings.VMESS_WS_Path;
break;
default:
return string.Empty;
}
var base64Url = Base64.Encode(JsonConvert.SerializeObject(vmess));
return $"vmess://" + base64Url;
}
private static string BuildVlessShareLink(XrayType xrayType, XraySettings settings)
{
var _protocol = string.Empty;
var _uuid = settings.UUID;
var _domain = settings.Domain;
var _port = settings.Port;
var _type = string.Empty;
var _encryption = string.Empty;
var _security = "tls";
var _path = "/";
var _host = settings.Domain;
var _descriptiveText = string.Empty;
switch (xrayType)
{
case XrayType.VLESS_TCP_TLS:
_protocol = "vless";
_type = "tcp";
_path = settings.VLESS_TCP_Path;
_encryption = "none";
_descriptiveText = "vless-tcp-tls";
break;
case XrayType.VLESS_TCP_XTLS:
_protocol = "vless";
_type = "tcp";
_security = "xtls";
_encryption = "none";
_descriptiveText = "vless-tcp-xtls";
break;
case XrayType.VLESS_WS_TLS:
_protocol = "vless";
_type = "ws";
_path = settings.VLESS_WS_Path;
_encryption = "none";
_descriptiveText = "vless-ws-tls";
break;
case XrayType.VMESS_TCP_TLS:
_protocol = "vmess";
_type = "tcp";
_path = settings.VMESS_TCP_Path;
_encryption = "auto";
_descriptiveText = "vmess-tcp-tls";
break;
case XrayType.VMESS_WS_TLS:
_protocol = "vmess";
_type = "ws";
_path = settings.VMESS_WS_Path;
_encryption = "auto";
_descriptiveText = "vmess-ws-tls";
break;
case XrayType.Trojan_TCP_TLS:
_protocol = "trojan";
_descriptiveText = "trojan-tcp";
break;
default:
throw new Exception("暂未实现的协议");
}
string parametersURL = string.Empty;
if (xrayType != XrayType.Trojan_TCP_TLS)
{
// 4.3 传输层相关段
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&host={_host}&path={HttpUtility.UrlEncode(_path)}";
// if mKCP
// if QUIC
// 4.4 TLS 相关段
if (xrayType == XrayType.VLESS_TCP_XTLS)
{
parametersURL += "&flow=xtls-rprx-direct";
}
}
return $"{_protocol}://{HttpUtility.UrlEncode(_uuid)}@{_domain}:{_port}{parametersURL}#{HttpUtility.UrlEncode(_descriptiveText)}";
}
}
class Vmess
{
public string v { get; set; }
public string ps { get; set; }
public string add { get; set; }
public string port { get; set; }
public string id { get; set; }
public string aid { get; set; }
public string net { get; set; }
public string type { get; set; }
public string host { get; set; }
public string path { get; set; }
public string tls { get; set; }
}
}

View File

@ -1,9 +1,12 @@
using ProxySU_Core.ViewModels.Developers; using Newtonsoft.Json;
using ProxySU_Core.Common;
using ProxySU_Core.Models.Developers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
namespace ProxySU_Core.Models namespace ProxySU_Core.Models
{ {
@ -15,7 +18,7 @@ namespace ProxySU_Core.Models
var guid = Guid.NewGuid().ToString(); var guid = Guid.NewGuid().ToString();
Port = 443; Port = 443;
UUID = guid; UUID = guid;
Types = new List<XrayType> { XrayType.VLESS_TCP_XTLS }; Types = new List<XrayType>();
VLESS_WS_Path = "/vlessws"; VLESS_WS_Path = "/vlessws";
VLESS_TCP_Path = "/vlesstcp"; VLESS_TCP_Path = "/vlesstcp";
VMESS_WS_Path = "/vmessws"; VMESS_WS_Path = "/vmessws";
@ -94,8 +97,10 @@ namespace ProxySU_Core.Models
return string.Empty; return string.Empty;
} }
} }
} }
public enum XrayType public enum XrayType
{ {
VLESS_TCP_TLS, VLESS_TCP_TLS,

View File

@ -120,15 +120,16 @@
<Compile Include="Common\Base64.cs" /> <Compile Include="Common\Base64.cs" />
<Compile Include="Converters\LoginSecretTypeConverter.cs" /> <Compile Include="Converters\LoginSecretTypeConverter.cs" />
<Compile Include="Models\Host.cs" /> <Compile Include="Models\Host.cs" />
<Compile Include="Models\ShareLink.cs" />
<Compile Include="Models\XraySettings.cs" /> <Compile Include="Models\XraySettings.cs" />
<Compile Include="Tools\DateTimeUtils.cs" /> <Compile Include="Tools\DateTimeUtils.cs" />
<Compile Include="Tools\Extensions.cs" /> <Compile Include="Tools\Extensions.cs" />
<Compile Include="ViewModels\BaseCommand.cs" /> <Compile Include="ViewModels\BaseCommand.cs" />
<Compile Include="ViewModels\BaseViewModel.cs" /> <Compile Include="ViewModels\BaseViewModel.cs" />
<Compile Include="ViewModels\Developers\ConfigBuilder.cs" /> <Compile Include="Models\Developers\ConfigBuilder.cs" />
<Compile Include="ViewModels\Developers\IParameters.cs" /> <Compile Include="Models\Developers\IParameters.cs" />
<Compile Include="ViewModels\Developers\Project.cs" /> <Compile Include="Models\Developers\Project.cs" />
<Compile Include="ViewModels\Developers\XrayProject.cs" /> <Compile Include="Models\Developers\XrayProject.cs" />
<Compile Include="ViewModels\HostViewModel.cs" /> <Compile Include="ViewModels\HostViewModel.cs" />
<Compile Include="Models\LocalProxy.cs" /> <Compile Include="Models\LocalProxy.cs" />
<Compile Include="Models\LocalProxyType.cs" /> <Compile Include="Models\LocalProxyType.cs" />
@ -149,6 +150,9 @@
<Compile Include="Views\TerminalWindow.xaml.cs"> <Compile Include="Views\TerminalWindow.xaml.cs">
<DependentUpon>TerminalWindow.xaml</DependentUpon> <DependentUpon>TerminalWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\TextBoxWindow.xaml.cs">
<DependentUpon>TextBoxWindow.xaml</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Converters\ProxyTypeConverter.cs" /> <Compile Include="Converters\ProxyTypeConverter.cs" />
@ -237,6 +241,9 @@
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP_TLS.json"> <None Include="Templates\xray\server\05_inbounds\Trojan_TCP_TLS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\xray\server\05_inbounds\Trojan_WS_TLS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VLESS_TCP_XTLS.json"> <None Include="Templates\xray\server\05_inbounds\VLESS_TCP_XTLS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@ -294,6 +301,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Views\TextBoxWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Data\" /> <Folder Include="Data\" />

View File

@ -0,0 +1,28 @@
{
"port": 1320,
"listen": "127.0.0.1",
"protocol": "trojan",
"settings": {
"clients": [
{
"password": "",
"level": 0,
"email": "love@example.com"
}
],
"fallbacks": [
{
"dest": 80
}
]
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/trojanws"
}
}
}

View File

@ -15,6 +15,7 @@ namespace ProxySU_Core.ViewModels
private readonly ICommand _selectKeyCommand; private readonly ICommand _selectKeyCommand;
public HostViewModel(Host host) public HostViewModel(Host host)
{ {
_selectKeyCommand = new BaseCommand(obj => OpenFileDialog(obj)); _selectKeyCommand = new BaseCommand(obj => OpenFileDialog(obj));

View File

@ -11,10 +11,22 @@ namespace ProxySU_Core.ViewModels
public class RecordViewModel : BaseViewModel public class RecordViewModel : BaseViewModel
{ {
public Record record; public Record record;
private bool _isChecked;
public RecordViewModel(Record record) public RecordViewModel(Record record)
{ {
this.record = record; this.record = record;
this._isChecked = false;
}
public bool IsChecked
{
get => _isChecked;
set
{
_isChecked = value;
Notify("IsChecked");
}
} }
public Host Host public Host Host

View File

@ -1,7 +1,6 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using ProxySU_Core.Common; using ProxySU_Core.Common;
using ProxySU_Core.Models; using ProxySU_Core.Models;
using ProxySU_Core.ViewModels.Developers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -239,164 +238,29 @@ namespace ProxySU_Core.ViewModels
public string VLESS_TCP_XTLS_ShareLink public string VLESS_TCP_XTLS_ShareLink
{ {
get => BuildVlessShareLink(XrayType.VLESS_TCP_XTLS); get => ShareLink.Build(XrayType.VLESS_TCP_XTLS, settings);
} }
public string VLESS_TCP_TLS_ShareLink public string VLESS_TCP_TLS_ShareLink
{ {
get => BuildVlessShareLink(XrayType.VLESS_TCP_TLS); get => ShareLink.Build(XrayType.VLESS_TCP_TLS, settings);
} }
public string VLESS_WS_TLS_ShareLink public string VLESS_WS_TLS_ShareLink
{ {
get => BuildVlessShareLink(XrayType.VLESS_WS_TLS); get => ShareLink.Build(XrayType.VLESS_WS_TLS, settings);
} }
public string VMESS_TCP_TLS_ShareLink public string VMESS_TCP_TLS_ShareLink
{ {
get => BuildVmessShareLink(XrayType.VMESS_TCP_TLS); get => ShareLink.Build(XrayType.VMESS_TCP_TLS, settings);
} }
public string VMESS_WS_TLS_ShareLink public string VMESS_WS_TLS_ShareLink
{ {
get => BuildVmessShareLink(XrayType.VMESS_WS_TLS); get => ShareLink.Build(XrayType.VMESS_WS_TLS, settings);
} }
public string Trojan_TCP_TLS_ShareLink public string Trojan_TCP_TLS_ShareLink
{ {
get => BuildVlessShareLink(XrayType.Trojan_TCP_TLS); get => ShareLink.Build(XrayType.Trojan_TCP_TLS, settings);
} }
public string BuildVmessShareLink(XrayType xrayType)
{
var vmess = new Vmess
{
v = "2",
add = settings.Domain,
port = settings.Port.ToString(),
id = settings.UUID,
aid = "0",
net = "",
type = "none",
host = settings.Domain,
path = "",
tls = "tls",
ps = "",
};
switch (xrayType)
{
case XrayType.VMESS_TCP_TLS:
vmess.ps = "vmess-tcp-tls";
vmess.net = "tcp";
vmess.type = "http";
vmess.path = VMESS_TCP_Path;
break;
case XrayType.VMESS_WS_TLS:
vmess.ps = "vmess-ws-tls";
vmess.net = "ws";
vmess.type = "none";
vmess.path = VMESS_WS_Path;
break;
default:
return string.Empty;
}
var base64Url = Base64.Encode(JsonConvert.SerializeObject(vmess));
return $"vmess://" + base64Url;
}
public string BuildVlessShareLink(XrayType xrayType)
{
var _protocol = string.Empty;
var _uuid = settings.UUID;
var _domain = settings.Domain;
var _port = settings.Port;
var _type = string.Empty;
var _encryption = string.Empty;
var _security = "tls";
var _path = "/";
var _host = settings.Domain;
var _descriptiveText = string.Empty;
switch (xrayType)
{
case XrayType.VLESS_TCP_TLS:
_protocol = "vless";
_type = "tcp";
_path = VLESS_TCP_Path;
_encryption = "none";
_descriptiveText = "vless-tcp-tls";
break;
case XrayType.VLESS_TCP_XTLS:
_protocol = "vless";
_type = "tcp";
_security = "xtls";
_encryption = "none";
_descriptiveText = "vless-tcp-xtls";
break;
case XrayType.VLESS_WS_TLS:
_protocol = "vless";
_type = "ws";
_path = VLESS_WS_Path;
_encryption = "none";
_descriptiveText = "vless-ws-tls";
break;
case XrayType.VMESS_TCP_TLS:
_protocol = "vmess";
_type = "tcp";
_path = VMESS_TCP_Path;
_encryption = "auto";
_descriptiveText = "vmess-tcp-tls";
break;
case XrayType.VMESS_WS_TLS:
_protocol = "vmess";
_type = "ws";
_path = VMESS_WS_Path;
_encryption = "auto";
_descriptiveText = "vmess-ws-tls";
break;
case XrayType.Trojan_TCP_TLS:
_protocol = "trojan";
_descriptiveText = "trojan-tcp";
break;
default:
throw new Exception("暂未实现的协议");
}
string parametersURL = string.Empty;
if (xrayType != XrayType.Trojan_TCP_TLS)
{
// 4.3 传输层相关段
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&host={_host}&path={HttpUtility.UrlEncode(_path)}";
// if mKCP
// if QUIC
// 4.4 TLS 相关段
if (xrayType == XrayType.VLESS_TCP_XTLS)
{
parametersURL += "&flow=xtls-rprx-direct";
}
}
return $"{_protocol}://{HttpUtility.UrlEncode(_uuid)}@{_domain}:{_port}{parametersURL}#{HttpUtility.UrlEncode(_descriptiveText)}";
}
} }
public class Vmess
{
public string v { get; set; }
public string ps { get; set; }
public string add { get; set; }
public string port { get; set; }
public string id { get; set; }
public string aid { get; set; }
public string net { get; set; }
public string type { get; set; }
public string host { get; set; }
public string path { get; set; }
public string tls { get; set; }
}
} }

View File

@ -57,6 +57,18 @@
Content="{DynamicResource AddHost}" Content="{DynamicResource AddHost}"
Click="AddHost" Click="AddHost"
Width="100"/> Width="100"/>
<Button
Margin="10,0,0,0"
Content="导出配置"
Click="ExportXraySettings"
Width="100" />
<Button
Margin="10,0,0,0"
Content="导出订阅"
Click="ExportXraySub"
Width="100" />
</StackPanel> </StackPanel>
<DataGrid ItemsSource="{Binding Records}" <DataGrid ItemsSource="{Binding Records}"
@ -71,6 +83,10 @@
BorderThickness="1" BorderThickness="1"
AutoGenerateColumns="False"> AutoGenerateColumns="False">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridCheckBoxColumn Header="选择"
Binding="{Binding Path=IsChecked, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="False"
Width="80"/>
<DataGridTextColumn Header="{DynamicResource HostTag}" <DataGridTextColumn Header="{DynamicResource HostTag}"
Binding="{Binding Path=Host.Tag}" Binding="{Binding Path=Host.Tag}"
Width="150"/> Width="150"/>
@ -93,7 +109,7 @@
<Button Content="{DynamicResource Connect}" FontSize="12" Height="24" Click="Connect" /> <Button Content="{DynamicResource Connect}" FontSize="12" Height="24" Click="Connect" />
<Button Content="{DynamicResource Edit}" FontSize="12" Height="24" Margin="10,0,0,0" Click="EditHost" /> <Button Content="{DynamicResource Edit}" FontSize="12" Height="24" Margin="10,0,0,0" Click="EditHost" />
<Button Content="查看配置" FontSize="12" Height="24" Margin="10,0,0,0" Click="ShowClientInfo" /> <Button Content="查看配置" FontSize="12" Height="24" Margin="10,0,0,0" Click="ShowClientInfo" />
<Button Content="{DynamicResource Delete}" FontSize="12" Height="24" Margin="10,0,0,0" Click="DeleteHost" /> <Button Content="{DynamicResource Delete}" FontSize="12" Height="24" Margin="10,0,0,0" Click="DeleteHost" BorderBrush="IndianRed" Background="IndianRed" />
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>

View File

@ -1,9 +1,9 @@
using MahApps.Metro.Controls.Dialogs; using MahApps.Metro.Controls.Dialogs;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using ProxySU_Core.Common;
using ProxySU_Core.Models; using ProxySU_Core.Models;
using ProxySU_Core.ViewModels; using ProxySU_Core.ViewModels;
using ProxySU_Core.ViewModels.Developers;
using ProxySU_Core.Views; using ProxySU_Core.Views;
using Renci.SshNet; using Renci.SshNet;
using System; using System;
@ -117,6 +117,36 @@ namespace ProxySU_Core
Application.Current.Resources.MergedDictionaries[0] = resource; Application.Current.Resources.MergedDictionaries[0] = resource;
} }
private void ExportXraySettings(object sender, RoutedEventArgs e)
{
StringBuilder sb = new StringBuilder();
foreach (var record in Records.Where(x => x.IsChecked))
{
record.Settings.Types.ForEach(type =>
{
var link = ShareLink.Build(type, record.Settings);
sb.AppendLine(link);
});
}
var tbx = new TextBoxWindow("分享链接", sb.ToString());
tbx.ShowDialog();
}
private void ExportXraySub(object sender, RoutedEventArgs e)
{
StringBuilder sb = new StringBuilder();
foreach (var record in Records.Where(x => x.IsChecked))
{
record.Settings.Types.ForEach(type =>
{
var link = ShareLink.Build(type, record.Settings);
sb.AppendLine(link);
});
}
var result = Base64.Encode(sb.ToString());
var tbx = new TextBoxWindow("订阅内容", result);
tbx.ShowDialog();
}
private void AddHost(object sender, RoutedEventArgs e) private void AddHost(object sender, RoutedEventArgs e)
{ {

View File

@ -1,8 +1,8 @@
using MahApps.Metro.Controls.Dialogs; using MahApps.Metro.Controls.Dialogs;
using Microsoft.Win32; using Microsoft.Win32;
using ProxySU_Core.Models; using ProxySU_Core.Models;
using ProxySU_Core.Models.Developers;
using ProxySU_Core.ViewModels; using ProxySU_Core.ViewModels;
using ProxySU_Core.ViewModels.Developers;
using ProxySU_Core.Views; using ProxySU_Core.Views;
using Renci.SshNet; using Renci.SshNet;
using System; using System;

View File

@ -0,0 +1,17 @@
<metro:MetroWindow x:Class="ProxySU_Core.Views.TextBoxWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU_Core.Views"
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="TextBoxWindow" Height="450" Width="800">
<Grid>
<TextBox Margin="20"
Text="{Binding Path=Message}"
TextWrapping="Wrap"
FontSize="14"
Style="{StaticResource MahApps.Styles.TextBox}" />
</Grid>
</metro:MetroWindow>

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProxySU_Core.Views
{
/// <summary>
/// TextBoxWindow.xaml 的交互逻辑
/// </summary>
public partial class TextBoxWindow
{
public string Message { get; set; }
public TextBoxWindow(string title, string message)
{
InitializeComponent();
this.Title = title;
this.Message = message;
this.DataContext = this;
}
}
}