diff --git a/HKCardOUT/DTO/AdDTO.cs b/HKCardOUT/DTO/AdDTO.cs
new file mode 100644
index 0000000..1c06889
--- /dev/null
+++ b/HKCardOUT/DTO/AdDTO.cs
@@ -0,0 +1,20 @@
+using Stylet;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Controls.Primitives;
+
+namespace DTO
+{
+ public class AdDTO : PropertyChangedBase
+ {
+ public string Device { get; set; }
+ bool _IsActive;
+ public bool IsActive
+ {
+ get => _IsActive;
+ set => SetAndNotify(ref _IsActive, value);
+ }
+ public string Ad { get; set; }
+ }
+}
diff --git a/HKCardOUT/HKCardOUT.csproj b/HKCardOUT/HKCardOUT.csproj
index 2ac5b58..e196092 100644
--- a/HKCardOUT/HKCardOUT.csproj
+++ b/HKCardOUT/HKCardOUT.csproj
@@ -23,6 +23,7 @@
+
diff --git a/HKCardOUT/Helper/DataBus.cs b/HKCardOUT/Helper/DataBus.cs
index 74319e2..676513b 100644
--- a/HKCardOUT/Helper/DataBus.cs
+++ b/HKCardOUT/Helper/DataBus.cs
@@ -1,9 +1,12 @@
-using System;
+using HKCardOUT.Views;
+using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Data;
using XExten.Advance.StaticFramework;
namespace HKCardOUT.Helper
@@ -23,10 +26,37 @@ namespace HKCardOUT.Helper
public static bool NetWordState { get; set; } = false;
public static string Cron { get; set; }
public static string SaasRoute { get; set; }
+ public static Dictionary AdStatus { get; set; } = new Dictionary();
}
public class ApiRoute
{
+ ///
+ /// 检查卡的状态
+ ///
public static string CheckCardStatus = DataBus.SaasRoute + "";
+ ///
+ /// 同步消费记录
+ ///
public static string SyncSaleLog = DataBus.SaasRoute + "";
+ ///
+ /// 获取档口信息
+ ///
+ public static string PullWindow = DataBus.SaasRoute + "";
+ ///
+ /// 获取店铺信息
+ ///
+ public static string PullShopInfo = DataBus.SaasRoute + "";
+ }
+ public class HKConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return (bool)value ? "启用" : "禁用";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value;
+ }
}
}
diff --git a/HKCardOUT/Helper/HKHelper.cs b/HKCardOUT/Helper/HKHelper.cs
index 0119f9b..82046f6 100644
--- a/HKCardOUT/Helper/HKHelper.cs
+++ b/HKCardOUT/Helper/HKHelper.cs
@@ -6,7 +6,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
-namespace HKCardOut.Helper
+namespace HKCardOUT.Helper
{
public class HKHelper: Singleton
{
diff --git a/HKCardOUT/Helper/ThreadManage.cs b/HKCardOUT/Helper/ThreadManage.cs
index 4c89684..fba56d7 100644
--- a/HKCardOUT/Helper/ThreadManage.cs
+++ b/HKCardOUT/Helper/ThreadManage.cs
@@ -6,7 +6,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
-namespace HKCardOut.Helper
+namespace HKCardOUT.Helper
{
public class Singleton where T : new()
{
diff --git a/HKCardOUT/Logic/Model/SaleLog.cs b/HKCardOUT/Logic/Model/SaleLog.cs
index 65893c4..9449dfb 100644
--- a/HKCardOUT/Logic/Model/SaleLog.cs
+++ b/HKCardOUT/Logic/Model/SaleLog.cs
@@ -25,5 +25,10 @@ namespace HKCardOUT.Logic.Model
///
[SugarColumn(IsNullable = false)]
public string Location { get; set; }
+ ///
+ /// 是否同步过了
+ ///
+ [SugarColumn(IsNullable = false)]
+ public bool IsSync { get; set; }
}
}
diff --git a/HKCardOUT/Logic/RemoteService.cs b/HKCardOUT/Logic/RemoteService.cs
index b002e3e..ff3f1a4 100644
--- a/HKCardOUT/Logic/RemoteService.cs
+++ b/HKCardOUT/Logic/RemoteService.cs
@@ -32,5 +32,25 @@ namespace HKCardOUT.Logic
t.NodePath = ApiRoute.SyncSaleLog;
}).Build().RunStringFirst();
}
+ ///
+ /// 获取档口信息
+ ///
+ public static void PullWindow()
+ {
+ IHttpMultiClient.HttpMulti.AddNode(t =>
+ {
+ t.NodePath = ApiRoute.PullWindow;
+ }).Build().RunStringFirst();
+ }
+ ///
+ /// 获取店铺信息
+ ///
+ public static void PullShopInfo()
+ {
+ IHttpMultiClient.HttpMulti.AddNode(t =>
+ {
+ t.NodePath = ApiRoute.PullShopInfo;
+ }).Build().RunStringFirst();
+ }
}
}
diff --git a/HKCardOUT/ViewModels/RootViewModel.cs b/HKCardOUT/ViewModels/RootViewModel.cs
index 76ba912..19ccb9f 100644
--- a/HKCardOUT/ViewModels/RootViewModel.cs
+++ b/HKCardOUT/ViewModels/RootViewModel.cs
@@ -1,12 +1,15 @@
-using HKCardOut.Helper;
+using DTO;
using HKCardOUT.Helper;
using HKCardOUT.Logic.Model;
using HKCardOUT.Logic.Service;
using Stylet;
using StyletIoC;
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
using System.Threading;
+using System.Windows.Documents;
namespace HKCardOUT.ViewModels
{
@@ -35,6 +38,12 @@ namespace HKCardOUT.ViewModels
get => _Result;
set => SetAndNotify(ref _Result, value);
}
+ ObservableCollection _Ad;
+ public ObservableCollection Ad
+ {
+ get => _Ad;
+ set => SetAndNotify(ref _Ad, value);
+ }
#endregion
#region 方法
@@ -61,5 +70,37 @@ namespace HKCardOUT.ViewModels
}), "循环状态监测线程", false);
}
#endregion
+
+ #region 命令
+ ///
+ /// 广告位置
+ ///
+ ///
+ public void UpdateAction(AdDTO input)
+ {
+ input.IsActive = !input.IsActive;
+ var SC = System.Windows.Forms.Screen.AllScreens.Count();
+ if (SC >= 1)
+ {
+ if (input.IsActive)
+ {
+ if (!DataBus.AdStatus.ContainsKey(input.Device))
+ {
+ var win = new Views.AdWindow(input.Ad);
+ DataBus.AdStatus.Add(input.Device, win);
+ win.Show();
+ }
+ }
+ else
+ {
+ if (DataBus.AdStatus.ContainsKey(input.Device))
+ {
+ DataBus.AdStatus[input.Device].Close();
+ DataBus.AdStatus.Remove(input.Device);
+ }
+ }
+ }
+ }
+ #endregion
}
}
diff --git a/HKCardOUT/Views/AdWindow.xaml.cs b/HKCardOUT/Views/AdWindow.xaml.cs
index 81abd04..5fa7a5c 100644
--- a/HKCardOUT/Views/AdWindow.xaml.cs
+++ b/HKCardOUT/Views/AdWindow.xaml.cs
@@ -19,12 +19,14 @@ namespace HKCardOUT.Views
///
public partial class AdWindow : HandyControl.Controls.Window
{
- public AdWindow()
+
+ public AdWindow(string input)
{
InitializeComponent();
- InitView2();
+ InitView2(input);
}
- public async void InitView2()
+
+ public async void InitView2(string input)
{
await view2.EnsureCoreWebView2Async(null);
view2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
diff --git a/HKCardOUT/Views/RootView.xaml b/HKCardOUT/Views/RootView.xaml
index cf1b3c0..d3c281d 100644
--- a/HKCardOUT/Views/RootView.xaml
+++ b/HKCardOUT/Views/RootView.xaml
@@ -2,10 +2,14 @@
x:Class="HKCardOUT.Views.RootView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
+ xmlns:helper="clr-namespace:HKCardOUT.Helper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:s="https://github.com/canton7/Stylet"
xmlns:viewModels="clr-namespace:HKCardOUT.ViewModels"
+ x:Name="Main"
Title="海科智慧一卡通平台"
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}"
ShowMaxButton="False"
@@ -15,6 +19,7 @@
WindowState="Maximized"
mc:Ignorable="d">
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HKCardOUT/Views/RootView.xaml.cs b/HKCardOUT/Views/RootView.xaml.cs
index eaf6e6d..7cd1582 100644
--- a/HKCardOUT/Views/RootView.xaml.cs
+++ b/HKCardOUT/Views/RootView.xaml.cs
@@ -11,13 +11,6 @@ namespace HKCardOUT.Views
public RootView()
{
InitializeComponent();
- if (Screen.AllScreens.Count() >= 2)
- {
- Dispatcher.Invoke(() =>
- {
- //显示广告屏幕
- });
- }
}
}
}