Browse Source

还原代码

Lishi
xxe 2 years ago
parent
commit
da8b7b80c6
6 changed files with 431 additions and 149 deletions
  1. +3
    -3
      HKCardOUT/Converter/TextForegroundConvert.cs
  2. +11
    -2
      HKCardOUT/Logic/Service/HKCore.cs
  3. +44
    -46
      HKCardOUT/ViewModels/AdWindowViewModel.cs
  4. +33
    -10
      HKCardOUT/ViewModels/RootViewModel.cs
  5. +4
    -2
      HKCardOUT/Views/AdWindow.xaml
  6. +336
    -86
      HKCardOUT/Views/AdWindow.xaml.cs

+ 3
- 3
HKCardOUT/Converter/TextForegroundConvert.cs View File

@@ -13,11 +13,11 @@ namespace Converter
{
if (value != null)
{
if (value.ToString().Contains("正常"))
if (value.ToString() == "正常")
return Brushes.White;
else if (value.ToString().Contains("异常"))
else if (value.ToString() == "异常")
return Brushes.Yellow;
else if (value.ToString().Contains("未连接"))
else if (value.ToString() == "未连接")
return Brushes.Yellow;
}
return default;


+ 11
- 2
HKCardOUT/Logic/Service/HKCore.cs View File

@@ -277,10 +277,19 @@ namespace HKCardOUT.Logic.Service
/// 获取当天消费前100条展示
/// </summary>
/// <returns></returns>
public Dictionary<string, int> PullDaySaleLog()
public Dictionary<string, int> PullDaySaleLog(int[] screen)
{
// var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
// var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today)
// .WhereIF(screen == 0, t => t.Location == "3" || t.Location == "4")
// .WhereIF(screen == 1, t => t.Location == "1" || t.Location == "2")
// .WhereIF(screen ==2, t => t.Location == "5" || t.Location == "6").Select(t => t.Location).ToList();
//return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
string a = screen[0].ToString();
string b = screen[1].ToString();
var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today).Select(t => t.Location).ToList();
var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today)
.WhereIF(screen.Length == 2, t => t.Location == a || t.Location == b).Select(t => t.Location).ToList();
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
}



+ 44
- 46
HKCardOUT/ViewModels/AdWindowViewModel.cs View File

@@ -11,8 +11,6 @@ using System.Threading;
using System.Windows.Media;
using HKControl;
using System.Collections.Concurrent;
using System.Text;
using ImTools;

namespace HKCardOUT.ViewModels
{
@@ -40,10 +38,10 @@ namespace HKCardOUT.ViewModels

#endregion

void FoodsInit()
void FoodsInit(int[] ScreenLoc)
{
string GateId = string.Empty;
GateId = DataBus.StoreInfo.Devices.Select(t => t.GateId).FirstOrDefault();
GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == $"0{ScreenLoc[0]}" || t.Address == $"0{ScreenLoc[1]}").Select(t => t.GateId).FirstOrDefault();
var res = DataBus.Menu.GateFood.Where(t => t.GateId == GateId)?.Select(t => t.Foods)?.FirstOrDefault();
if (res != null)
{
@@ -58,60 +56,60 @@ namespace HKCardOUT.ViewModels
}
}

public void InitData()
public void InitData(int[] BindScreen)
{
FoodsInit();
FoodsInit(BindScreen);

ThreadManage.GetInstance().StartLong(() =>
{
var model = (new HKCore()).PullDaySaleLog();
var model = (new HKCore()).PullDaySaleLog(BindScreen);

LAdInfo.Gate = $"4,5,6号档口";
RAdinfo.Gate = $"1,2,3号档口";
LAdInfo.Count = model.Where(t => t.Key == "4" || t.Key == "5" || t.Key == "6").Sum(t => t.Value);
RAdinfo.Count = model.Where(t => t.Key == "1" || t.Key == "2" || t.Key == "3").Sum(t => t.Value);
StringBuilder sb1 = new StringBuilder();
sb1.Append((!Main.GetInstance.GetIsConnect(4) ? "4号未连接" : (Main.GetInstance.GetIsSwipe(4) ? "4号正常" : "4号异常")+"\r"));
sb1.Append((!Main.GetInstance.GetIsConnect(5) ? "5号未连接" : (Main.GetInstance.GetIsSwipe(5) ? "5号正常" : "5号异常")+"\r"));
sb1.Append((!Main.GetInstance.GetIsConnect(6) ? "6号未连接" : (Main.GetInstance.GetIsSwipe(6) ? "6号正常" : "6号异常")+"\r"));
LAdInfo.Msg ="\r"+sb1.ToString();
StringBuilder sb2 = new StringBuilder();
sb2.Append((!Main.GetInstance.GetIsConnect(1) ? "1号未连接" : (Main.GetInstance.GetIsSwipe(1) ? "1号正常" : "1号异常")+"\r"));
sb2.Append((!Main.GetInstance.GetIsConnect(2) ? "2号未连接" : (Main.GetInstance.GetIsSwipe(2) ? "2号正常" : "2号异常")+"\r"));
sb2.Append((!Main.GetInstance.GetIsConnect(3) ? "3号未连接" : (Main.GetInstance.GetIsSwipe(3) ? "3号正常" : "3号异常")+"\r"));
RAdinfo.Msg = "\r" + sb2.ToString();
LAdInfo.Gate = $"{BindScreen[1]}号档口";
RAdinfo.Gate = $"{BindScreen[0]}号档口";
LAdInfo.Count = model.Where(t => t.Key == $"{BindScreen[1]}").FirstOrDefault().Value;
RAdinfo.Count = model.Where(t => t.Key == $"{BindScreen[0]}").FirstOrDefault().Value;
if (Main.GetInstance.GetIsConnect(BindScreen[1]))
LAdInfo.Msg = Main.GetInstance.GetIsSwipe(BindScreen[1]) ? "正常" : "异常";
else
LAdInfo.Msg = "未连接";

if (DataBus.saleLogDtos.Count > 0)
if (Main.GetInstance.GetIsConnect(BindScreen[0]))
RAdinfo.Msg = Main.GetInstance.GetIsSwipe(BindScreen[0]) ? "正常" : "异常";
else
RAdinfo.Msg = "未连接";
for (int i = 0; i < BindScreen.Length; i++)
{
DataBus.saleLogDtos.TryDequeue(out SaleLogDto info);
ScreenInfoDto data = new ScreenInfoDto
if (DataBus.SaleLogDtoList.ContainsKey(BindScreen[i].ToString()))
{
CardNo = info.CardNo,
UserName = "",
Location = info.Location,
};
data.UserName = DataBus.UserListDto
.Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo))
.Select(x => x.Name).FirstOrDefault();

App.Current.Dispatcher.Invoke(() =>
{
if (LAdInfo.Info != null && !string.IsNullOrEmpty(LAdInfo.Info.UserName))
{
LAdInfo.AInfo.Insert(0, LAdInfo.Info);
LAdInfo.Info.Time = DateTime.Now.ToString("HH:mm:ss");
}
if (RAdinfo.Info != null && !string.IsNullOrEmpty(RAdinfo.Info.UserName))
if (DataBus.SaleLogDtoList[BindScreen[i].ToString()].Count > 0)
{
RAdinfo.AInfo.Insert(0, RAdinfo.Info);
RAdinfo.Info.Time = DateTime.Now.ToString("HH:mm:ss");
if (DataBus.SaleLogDtoList[BindScreen[i].ToString()].TryDequeue(out SaleLogDto info))
{
ScreenInfoDto data = new ScreenInfoDto
{
CardNo = info.CardNo,
UserName = "",
Location = info.Location,
};
data.UserName = DataBus.UserListDto
.Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo))
.Select(x => x.Name).FirstOrDefault();

App.Current.Dispatcher.Invoke(() =>
{
if (LAdInfo.Info != null && !string.IsNullOrEmpty(LAdInfo.Info.UserName))
LAdInfo.AInfo.Insert(0, LAdInfo.Info); LAdInfo.Info.Time = DateTime.Now.ToString("HH:mm:ss");
if (RAdinfo.Info != null && !string.IsNullOrEmpty(RAdinfo.Info.UserName))
RAdinfo.AInfo.Insert(0, RAdinfo.Info); RAdinfo.Info.Time = DateTime.Now.ToString("HH:mm:ss");
});
LAdInfo.Info = data.Location == $"{BindScreen[1]}" ? data : new ScreenInfoDto();
RAdinfo.Info = data.Location == $"{BindScreen[0]}" ? data : new ScreenInfoDto();
}
}
});
LAdInfo.Info = data.Location == "4" || data.Location == "5" || data.Location == "6" ? data : new ScreenInfoDto();
RAdinfo.Info = data.Location == "1" || data.Location == "2" || data.Location == "3" ? data : new ScreenInfoDto();
}
}
Thread.Sleep(10);
}, $"屏幕刷卡信息", true);
}, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true);
}
}
}

+ 33
- 10
HKCardOUT/ViewModels/RootViewModel.cs View File

@@ -5,7 +5,6 @@ using HKCardOUT.Logic.Model;
using HKCardOUT.Logic.Service;
using HKCardOUT.Views;
using HKLog;
using ImTools;
using Stylet;
using StyletIoC;
using System;
@@ -172,15 +171,39 @@ namespace HKCardOUT.ViewModels
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
var win = new AdWindow(Ad[0].Ad);
win.DataContext = new AdWindowViewModel();
var rectangle = System.Windows.Forms.Screen.AllScreens[0].WorkingArea;
win.Height = rectangle.Height;
win.Width = rectangle.Width;
win.Top = 0;
win.Left = rectangle.Left;
win.Owner = this.Main;
win.Show();
try
{
//var SC = System.Windows.Forms.Screen.AllScreens.Count();
//while (SC<3)
//{
// SC = System.Windows.Forms.Screen.AllScreens.Count();
// Thread.Sleep(1000);
//}
for (int i = 0; i < 3; i++)
{
var win = new AdWindow(Ad[i].Ad, i);
win.DataContext = new AdWindowViewModel();
//var rectangle = System.Windows.Forms.Screen.AllScreens[i].WorkingArea;
win.Height = 1080;//rectangle.Height;
win.Width = 1920;//rectangle.Width;
win.Top = 0;
win.Left = i * 1920 * -1;// rectangle.Left;
win.Owner = this.Main;
win.Show();
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
var win = new AdWindow("暂无广告", 0);
var rectangle = System.Windows.Forms.Screen.AllScreens[0].WorkingArea;
win.Height = rectangle.Height;
win.Width = rectangle.Width;
win.Top = 0;
win.Left = rectangle.Left;
win.Owner = this.Main;
win.Show();
}
}));
}



+ 4
- 2
HKCardOUT/Views/AdWindow.xaml View File

@@ -51,7 +51,7 @@
<Grid x:Name="area1">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="0.55*" />
<RowDefinition Height="0.2*" />
<RowDefinition Height="0.2*" />
<RowDefinition />
</Grid.RowDefinitions>
@@ -135,6 +135,8 @@
<Border Style="{StaticResource borderStyle}">
<Border.Background>
<LinearGradientBrush StartPoint="1,0" EndPoint="0.5,1">
<!--<GradientStop Offset="1" Color="#C93ADA" />
<GradientStop Offset="0" Color="#5844DD" />-->
<GradientStop Offset="0" Color="#1FE6EC" />
<GradientStop Offset="1" Color="#7850F1" />
</LinearGradientBrush>
@@ -259,7 +261,7 @@
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="0.55*" />
<RowDefinition Height="0.2*" />
<RowDefinition Height="0.2*" />
<RowDefinition />
</Grid.RowDefinitions>


+ 336
- 86
HKCardOUT/Views/AdWindow.xaml.cs View File

@@ -30,22 +30,46 @@ namespace HKCardOUT.Views
/// </summary>
public partial class AdWindow : Window
{
public AdWindow(string input)
private int BindScreen = -1;
public AdWindow(string input, int bindScreen)
{
InitializeComponent();

this.Loaded += (sender, ev) =>
{
this.WindowState = WindowState.Maximized;
(this.DataContext as AdWindowViewModel).InitData();
if (BindScreen != -1)
{
int[] NotchNum = new int[2];
if (bindScreen == 0) { NotchNum[0] = 1; NotchNum[1] = 2; }
if (bindScreen == 1) { NotchNum[0] = 5; NotchNum[1] = 6; }
if (bindScreen == 2) { NotchNum[0] = 3; NotchNum[1] = 4; }
(this.DataContext as AdWindowViewModel).InitData(NotchNum);

ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (DataBus.saleLogDtos.Count > 0)
{
if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info))
{
if (!DataBus.SaleLogDtoList.ContainsKey(info.Location))
DataBus.SaleLogDtoList.TryAdd(info.Location, new ConcurrentQueue<SaleLogDto>());
DataBus.SaleLogDtoList[info.Location].Enqueue(info);
}
}
Thread.Sleep(100);
}), "刷卡队列分配");
}
InitView2(input);

//InitControl();
};
this.Closed += (sender, ev) =>
{
App.Current.Shutdown(0);
};

BindScreen = bindScreen;
}

public async void InitView2(string input)
@@ -68,115 +92,341 @@ namespace HKCardOUT.Views
{
ThreadManage.GetInstance().StartLong(() =>
{
var GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "05" || t.Address == "06").Select(t => t.GateId).FirstOrDefault();
var area = DataBus.RangeCtrl.FirstOrDefault(t => t.GateId == GateId).Locs;

foreach (var item in area)
if (BindScreen == 0)
{
if (item.Key.ToLower().Equals("top"))
var GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "05" || t.Address == "06").Select(t => t.GateId).FirstOrDefault();
var area = DataBus.RangeCtrl.FirstOrDefault(t => t.GateId == GateId).Locs;

foreach (var item in area)
{
if (item.IsShow)
if (item.Key.ToLower().Equals("top"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0.239, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0.239, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
else
if (item.Key.ToLower().Equals("bottom"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0.5, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
}
if (item.Key.ToLower().Equals("bottom"))
{
if (item.IsShow)
if (item.Key.ToLower().Equals("left"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0.5, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[0].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
else
if (item.Key.ToLower().Equals("right"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[2].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
}
if (item.Key.ToLower().Equals("left"))
}

if (BindScreen == 1)
{
var GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "01" || t.Address == "02").Select(t => t.GateId).FirstOrDefault();
var area = DataBus.RangeCtrl.FirstOrDefault(t => t.GateId == GateId).Locs;

foreach (var item in area)
{
if (item.IsShow)
if (item.Key.ToLower().Equals("top"))
{
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0.239, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
if (item.Key.ToLower().Equals("bottom"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0.5, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
else
if (item.Key.ToLower().Equals("left"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[0].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[0].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
if (item.Key.ToLower().Equals("right"))
{
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[2].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
}
if (item.Key.ToLower().Equals("right"))
}

if (BindScreen == 2)
{
var GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "05" || t.Address == "06").Select(t => t.GateId).FirstOrDefault();
var area = DataBus.RangeCtrl.FirstOrDefault(t => t.GateId == GateId).Locs;

foreach (var item in area)
{
if (item.IsShow)
if (item.Key.ToLower().Equals("top"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0.239, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
else
if (item.Key.ToLower().Equals("bottom"))
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[2].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0.5, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 10;
this.content.Dispatcher.Invoke(async () =>
{
content.RowDefinitions[1].Height = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
if (item.Key.ToLower().Equals("left"))
{
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[0].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[0].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
if (item.Key.ToLower().Equals("right"))
{
if (item.IsShow)
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = this.content.ActualWidth - 9.5;
this.alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0.2, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
else
{
var height = this.content.RowDefinitions[1].ActualHeight - 10;
var width = alls.ColumnDefinitions[2].ActualWidth + this.content.ActualWidth - 10;
this.alls.Dispatcher.Invoke(async () =>
{
alls.ColumnDefinitions[2].Width = new GridLength(0, GridUnitType.Star);
if (view2.CoreWebView2 != null)
await view2.CoreWebView2.ExecuteScriptAsync($"Set({width},{height})");
});
}
}
}
}

Thread.Sleep(5000);
}, $"区域控制", true);
}, $"区域控制{BindScreen}", true);
}
}
}

Loading…
Cancel
Save