liuwf 9 months ago
parent 2dba45e22d
commit 2825cf4b7b

@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Admin.Core.Common;
using System.Threading;
namespace Aucma.Core.PrintTo
{
@ -25,6 +26,7 @@ namespace Aucma.Core.PrintTo
var host = CreateHostBuilder(e.Args).Build();//生成宿主。
ServiceProvider = host.Services;
host.Services.GetRequiredService<MainWindow>()?.Show();
await host.StartAsync();
}

@ -28,11 +28,11 @@ namespace Aucma.Core.PrintTo.ViewModels
UserContent = firstPage;
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
Task.Run(async () =>
{
await RefreshTeamTime();//班组时间
});
//Task.Run(async () =>
//{
// await RefreshTeamTime();//班组时间
//});
InitUserInfo();
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 1); //间隔1秒
timer.Tick += new EventHandler(timer_Tick);
@ -204,21 +204,26 @@ namespace Aucma.Core.PrintTo.ViewModels
}
#endregion
#region 切换班组
public async Task RefreshTeamTime()
{
while (true)
{
var list = await _sysUserInfoServices.GetTeamData();
if (list != null && list.Count > 0)
private void InitUserInfo()
{
var sysUserInfo = list.First();
TeamName = $"{appConfig.TeamName}({list.Min(d => d.StartTime).ToString("HH:mm")}~{list.Max(d => d.EndTime).ToString("HH:mm")})";
//TeamName = $"{sysUserInfo.TeamName}";
}
Thread.Sleep(5000);
}
TeamName = $"班组:{appConfig.TeamName} 用户:{appConfig.Account}";
}
#region 切换班组
//public async Task RefreshTeamTime()
//{
// while (true)
// {
// var list = await _sysUserInfoServices.GetTeamData();
// if (list != null && list.Count > 0)
// {
// var sysUserInfo = list.First();
// TeamName = $"{appConfig.TeamName}({list.Min(d => d.StartTime).ToString("HH:mm")}~{list.Max(d => d.EndTime).ToString("HH:mm")})";
// //TeamName = $"{sysUserInfo.TeamName}";
// }
// Thread.Sleep(5000);
// }
//}
#endregion
#region 定时刷新时间

@ -35,7 +35,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="7*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
@ -49,8 +49,8 @@
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" >
<TextBlock Grid.Column="0" Text="{Binding TeamName}" FontSize="25" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock Grid.Column="1" Text="{Binding CurrentDateTime}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="0" Text="{Binding TeamName}" FontSize="20" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<TextBlock Grid.Column="1" Text="{Binding CurrentDateTime}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<!--<TextBlock Text=" 登陆人账号:" Height="30" Width="auto" Margin="5 0" Foreground="White" Block.TextAlignment="Center" />
<TextBlock x:Name="Account" Text="{Binding Account}" Height="30" Width="100" Margin="5 0" Foreground="White" Block.TextAlignment="Center" />-->

@ -32,7 +32,7 @@ namespace Aucma.Core.PrintTo.Views
}
else
{
this.Account.Text = appConfig.Account;
// this.Account.Text = appConfig.Account;
//this.Team.Text = appConfig.TeamName;
return true;
}

Loading…
Cancel
Save