@@ -33,6 +33,8 @@ | |||||
<Resource Include="HKResouces\背景.jpg" /> | <Resource Include="HKResouces\背景.jpg" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<Folder Include="Logic\" /> | |||||
<None Update="options.json"> | |||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||||
</None> | |||||
</ItemGroup> | </ItemGroup> | ||||
</Project> | </Project> |
@@ -1,13 +1,25 @@ | |||||
using System; | |||||
using Newtonsoft.Json.Linq; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.IO; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using XExten.Advance.LinqFramework; | |||||
using XExten.Advance.StaticFramework; | |||||
namespace HKCardIN.Helper | namespace HKCardIN.Helper | ||||
{ | { | ||||
public class DataBus | public class DataBus | ||||
{ | { | ||||
public static bool NetWordState { get; set; } = false; | 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() | public void UnLockAction() | ||||
{ | { | ||||
if (LockCode.Equals("123")) | |||||
if (LockCode.Equals(DataBus.LockCode)) | |||||
{ | { | ||||
IsLocker = false; | IsLocker = false; | ||||
CodeVisible = Visibility.Collapsed; | CodeVisible = Visibility.Collapsed; | ||||
@@ -83,7 +83,11 @@ namespace HKCardIN.ViewModels | |||||
} | } | ||||
public void SaveAction() | public void SaveAction() | ||||
{ | { | ||||
if (!DataBus.NetWordState) | |||||
{ | |||||
HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!"); | |||||
return; | |||||
} | |||||
} | } | ||||
#endregion | #endregion | ||||
@@ -8,8 +8,9 @@ | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:s="https://github.com/canton7/Stylet" | xmlns:s="https://github.com/canton7/Stylet" | ||||
xmlns:viewModels="clr-namespace:HKCardIN.ViewModels" | xmlns:viewModels="clr-namespace:HKCardIN.ViewModels" | ||||
x:Name="Root" | |||||
Title="海科智慧一卡通平台" | Title="海科智慧一卡通平台" | ||||
Width="700" | |||||
Width="800" | |||||
Height="420" | Height="420" | ||||
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}" | d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}" | ||||
ShowMaxButton="False" | ShowMaxButton="False" | ||||
@@ -96,6 +97,7 @@ | |||||
<Grid Visibility="{Binding ContentVisible}"> | <Grid Visibility="{Binding ContentVisible}"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
<ColumnDefinition Width="13" /> | |||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<StackPanel Margin="0,12,0,0"> | <StackPanel Margin="0,12,0,0"> | ||||
@@ -206,7 +208,11 @@ | |||||
</WrapPanel> | </WrapPanel> | ||||
</StackPanel> | </StackPanel> | ||||
</StackPanel> | </StackPanel> | ||||
<StackPanel Grid.Column="1"> | |||||
<hc:Divider | |||||
Grid.Column="1" | |||||
Height="{Binding ActualHeight, ElementName=Root}" | |||||
Orientation="Vertical" /> | |||||
<StackPanel Grid.Column="2"> | |||||
<hc:Divider | <hc:Divider | ||||
Content="充值金额" | Content="充值金额" | ||||
FontSize="16" | FontSize="16" | ||||
@@ -219,7 +225,7 @@ | |||||
<Run Foreground="WhiteSmoke" Text="当前充值金额:" /> | <Run Foreground="WhiteSmoke" Text="当前充值金额:" /> | ||||
<Run Foreground="Red" Text="{Binding ShowMoney}" /> | <Run Foreground="Red" Text="{Binding ShowMoney}" /> | ||||
</TextBlock> | </TextBlock> | ||||
<WrapPanel> | |||||
<WrapPanel HorizontalAlignment="Center"> | |||||
<Button | <Button | ||||
Command="{s:Action InputAction}" | Command="{s:Action InputAction}" | ||||
CommandParameter="50" | CommandParameter="50" | ||||
@@ -265,20 +271,22 @@ | |||||
</Button.Content> | </Button.Content> | ||||
</Button> | </Button> | ||||
</WrapPanel> | </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 | <hc:Divider | ||||
Content="操作" | Content="操作" | ||||
FontSize="16" | FontSize="16" | ||||
@@ -0,0 +1,4 @@ | |||||
{ | |||||
"SaasRoute": "", | |||||
"LockCode": "HK123456" | |||||
} |