Browse Source

修改屏幕数据

Lishi
xxe 2 years ago
parent
commit
e892d0dc17
4 changed files with 154 additions and 423 deletions
  1. +2
    -11
      HKCardOUT/Logic/Service/HKCore.cs
  2. +46
    -46
      HKCardOUT/ViewModels/AdWindowViewModel.cs
  3. +10
    -33
      HKCardOUT/ViewModels/RootViewModel.cs
  4. +96
    -333
      HKCardOUT/Views/AdWindow.xaml.cs

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

@@ -277,19 +277,10 @@ namespace HKCardOUT.Logic.Service
/// 获取当天消费前100条展示 /// 获取当天消费前100条展示
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public Dictionary<string, int> PullDaySaleLog(int[] screen)
public Dictionary<string, int> PullDaySaleLog()
{ {
// 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 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.Length == 2, t => t.Location == a || t.Location == b).Select(t => t.Location).ToList();
var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today).Select(t => t.Location).ToList();
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
} }




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

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


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


#endregion #endregion


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


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


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


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 = "未连接";
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 = 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 = sb2.ToString();


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()))
{
if (DataBus.SaleLogDtoList[BindScreen[i].ToString()].Count > 0)
{
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();
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();
}
}
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 == "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); Thread.Sleep(10);
}, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true);
}, $"屏幕刷卡信息", true);
} }
} }
} }

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

@@ -5,6 +5,7 @@ using HKCardOUT.Logic.Model;
using HKCardOUT.Logic.Service; using HKCardOUT.Logic.Service;
using HKCardOUT.Views; using HKCardOUT.Views;
using HKLog; using HKLog;
using ImTools;
using Stylet; using Stylet;
using StyletIoC; using StyletIoC;
using System; using System;
@@ -171,39 +172,15 @@ namespace HKCardOUT.ViewModels
{ {
App.Current.Dispatcher.Invoke(new Action(() => App.Current.Dispatcher.Invoke(new Action(() =>
{ {
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();
}
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();
})); }));
} }




+ 96
- 333
HKCardOUT/Views/AdWindow.xaml.cs View File

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


this.Loaded += (sender, ev) => this.Loaded += (sender, ev) =>
{ {
this.WindowState = WindowState.Maximized; this.WindowState = WindowState.Maximized;
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);
(this.DataContext as AdWindowViewModel).InitData();


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


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

BindScreen = bindScreen;
} }


public async void InitView2(string input) public async void InitView2(string input)
@@ -92,341 +81,115 @@ namespace HKCardOUT.Views
{ {
ThreadManage.GetInstance().StartLong(() => ThreadManage.GetInstance().StartLong(() =>
{ {
if (BindScreen == 0)
{
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;
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)
foreach (var item in area)
{
if (item.Key.ToLower().Equals("top"))
{ {
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"))
{
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)
{ {
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})");
});
}
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.Key.ToLower().Equals("right"))
else
{ {
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})");
});
}
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 (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.Key.ToLower().Equals("bottom"))
{ {
if (item.Key.ToLower().Equals("top"))
if (item.IsShow)
{ {
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})");
});
}
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.Key.ToLower().Equals("bottom"))
else
{ {
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})");
});
}
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 (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.Key.ToLower().Equals("left"))
{ {
if (item.Key.ToLower().Equals("top"))
if (item.IsShow)
{ {
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})");
});
}
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.Key.ToLower().Equals("bottom"))
else
{ {
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})");
});
}
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("left"))
}
if (item.Key.ToLower().Equals("right"))
{
if (item.IsShow)
{ {
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})");
});
}
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.Key.ToLower().Equals("right"))
else
{ {
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})");
});
}
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); Thread.Sleep(5000);
}, $"区域控制{BindScreen}", true);
}, $"区域控制", true);
} }
} }
} }

Loading…
Cancel
Save