@@ -33,6 +33,8 @@ | |||
<Resource Include="HKResouces\背景.jpg" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Logic\" /> | |||
<None Update="options.json"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
</ItemGroup> | |||
</Project> |
@@ -1,13 +1,25 @@ | |||
using System; | |||
using Newtonsoft.Json.Linq; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using XExten.Advance.LinqFramework; | |||
using XExten.Advance.StaticFramework; | |||
namespace HKCardIN.Helper | |||
{ | |||
public class DataBus | |||
{ | |||
public static bool NetWordState { get; set; } = false; | |||
public static JObject Option => SyncStatic.ReadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "options.json")).ToModel<JObject>(); | |||
public static string SaasRoute => Option["SaasRoute"].ToString(); | |||
public static string LockCode => Option["LockCode"].ToString(); | |||
} | |||
public class ApiRoute | |||
{ | |||
public const string PullUserAndCardInfo = ""; | |||
public const string PushMoneyToServer = ""; | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using HKCardIN.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using XExten.Advance.HttpFramework.MultiFactory; | |||
namespace HKCardIN.Logic | |||
{ | |||
public class BaseLogic : Singleton<BaseLogic> | |||
{ | |||
public async Task<dynamic> PullUserAndCardInfo() | |||
{ | |||
return await IHttpMultiClient.HttpMulti.AddNode(t => | |||
{ | |||
t.NodePath = DataBus.SaasRoute + ApiRoute.PullUserAndCardInfo; | |||
}).Build().RunStringFirstAsync(); | |||
} | |||
public async Task<dynamic> PushMoneyToServer(dynamic input) | |||
{ | |||
return await IHttpMultiClient.HttpMulti.AddNode(t => | |||
{ | |||
t.NodePath = DataBus.SaasRoute + ApiRoute.PushMoneyToServer; | |||
}).Build().RunStringFirstAsync(); | |||
} | |||
} | |||
} |
@@ -69,7 +69,7 @@ namespace HKCardIN.ViewModels | |||
} | |||
public void UnLockAction() | |||
{ | |||
if (LockCode.Equals("123")) | |||
if (LockCode.Equals(DataBus.LockCode)) | |||
{ | |||
IsLocker = false; | |||
CodeVisible = Visibility.Collapsed; | |||
@@ -83,7 +83,11 @@ namespace HKCardIN.ViewModels | |||
} | |||
public void SaveAction() | |||
{ | |||
if (!DataBus.NetWordState) | |||
{ | |||
HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!"); | |||
return; | |||
} | |||
} | |||
#endregion | |||
@@ -8,8 +8,9 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:s="https://github.com/canton7/Stylet" | |||
xmlns:viewModels="clr-namespace:HKCardIN.ViewModels" | |||
x:Name="Root" | |||
Title="海科智慧一卡通平台" | |||
Width="700" | |||
Width="800" | |||
Height="420" | |||
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}" | |||
ShowMaxButton="False" | |||
@@ -96,6 +97,7 @@ | |||
<Grid Visibility="{Binding ContentVisible}"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="13" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Margin="0,12,0,0"> | |||
@@ -206,7 +208,11 @@ | |||
</WrapPanel> | |||
</StackPanel> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1"> | |||
<hc:Divider | |||
Grid.Column="1" | |||
Height="{Binding ActualHeight, ElementName=Root}" | |||
Orientation="Vertical" /> | |||
<StackPanel Grid.Column="2"> | |||
<hc:Divider | |||
Content="充值金额" | |||
FontSize="16" | |||
@@ -219,7 +225,7 @@ | |||
<Run Foreground="WhiteSmoke" Text="当前充值金额:" /> | |||
<Run Foreground="Red" Text="{Binding ShowMoney}" /> | |||
</TextBlock> | |||
<WrapPanel> | |||
<WrapPanel HorizontalAlignment="Center"> | |||
<Button | |||
Command="{s:Action InputAction}" | |||
CommandParameter="50" | |||
@@ -265,20 +271,22 @@ | |||
</Button.Content> | |||
</Button> | |||
</WrapPanel> | |||
<TextBox | |||
Width="330" | |||
Margin="5,10,0,10" | |||
HorizontalAlignment="Left" | |||
hc:InfoElement.Placeholder="请输入自定义金额" | |||
Style="{StaticResource TextBoxExtend}"> | |||
<TextBox.Text> | |||
<Binding Path="InputMoney" UpdateSourceTrigger="PropertyChanged"> | |||
<Binding.ValidationRules> | |||
<local:ValidataRule /> | |||
</Binding.ValidationRules> | |||
</Binding> | |||
</TextBox.Text> | |||
</TextBox> | |||
<WrapPanel HorizontalAlignment="Center"> | |||
<TextBox | |||
Width="330" | |||
Margin="5,10,0,10" | |||
HorizontalAlignment="Left" | |||
hc:InfoElement.Placeholder="请输入自定义金额" | |||
Style="{StaticResource TextBoxExtend}"> | |||
<TextBox.Text> | |||
<Binding Path="InputMoney" UpdateSourceTrigger="PropertyChanged"> | |||
<Binding.ValidationRules> | |||
<local:ValidataRule /> | |||
</Binding.ValidationRules> | |||
</Binding> | |||
</TextBox.Text> | |||
</TextBox> | |||
</WrapPanel> | |||
<hc:Divider | |||
Content="操作" | |||
FontSize="16" | |||
@@ -0,0 +1,4 @@ | |||
{ | |||
"SaasRoute": "", | |||
"LockCode": "HK123456" | |||
} |