add -添加显示当前时间

main
frankiecao 1 year ago
commit beb9681aad

@ -21,7 +21,6 @@ namespace SlnMesnac.Business.business
private IBaseStaffService _baseStaffService; private IBaseStaffService _baseStaffService;
public string _uidCode = ""; public string _uidCode = "";
public RfidHandleBusniess(HidUtils utils,IBaseStaffService baseStaffService) public RfidHandleBusniess(HidUtils utils,IBaseStaffService baseStaffService)
{ {
this._utils = utils; this._utils = utils;
@ -30,21 +29,5 @@ namespace SlnMesnac.Business.business
string staffInfo = ""; string staffInfo = "";
string tagInfoStr = ""; string tagInfoStr = "";
/// <summary>
/// 上班打卡
/// </summary>
public void CheckIn()
{
_utils.StartScan();
}
/// <summary>
/// 下班打卡
/// </summary>
public void CheckOut()
{
_utils.StartScan();
}
} }
} }

@ -59,7 +59,7 @@ namespace SlnMesnac.Model.domain
public string CreateBy { get; set; } public string CreateBy { get; set; }
/// <summary> /// <summary>
/// 打卡时间 /// 创建时间
/// </summary> /// </summary>
[SugarColumn(ColumnName = "create_time")] [SugarColumn(ColumnName = "create_time")]
public string CreateTime { get; set; } public string CreateTime { get; set; }

@ -0,0 +1,98 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
namespace SlnMesnac.Model.domain
{
[SugarTable("record_staff_commute"), TenantAttribute("mes")]
[DataContract(Name = "RecordStaffCommute 员工上下班记录")]
public class RecordStaffCommute
{
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "obj_id", IsPrimaryKey = true, IsIdentity = true)]
public int ObjId { get; set; }
/// <summary>
/// 员工id
/// </summary>
[SugarColumn(ColumnName = "staff_id")]
public string StaffId { get; set; }
/// <summary>
/// 班组编号
/// </summary>
[SugarColumn(ColumnName = "team_code")]
public string TeamCode { get; set; }
/// <summary>
/// 班次
/// </summary>
[SugarColumn(ColumnName = "classes")]
public string Classes { get; set; }
/// <summary>
/// 上班打卡时间
/// </summary>
[SugarColumn(ColumnName = "start_work_time")]
public string StartWorkTime { get; set; }
/// <summary>
/// 下班打卡时间
/// </summary>
[SugarColumn(ColumnName = "end_work_time")]
public string EndWorkTime { get; set; }
/// <summary>
/// 在班时长率
/// </summary>
[SugarColumn(ColumnName = "clocking_ratio")]
public string ClockingRatio { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string Remark { get; set; }
/// <summary>
/// 是否标识
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public string IsFlag { get; set; }
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "create_by")]
public string CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time")]
public string CreateTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
[SugarColumn(ColumnName = "update_by")]
public string UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnName = "update_time")]
public string UpdateTime { get; set; }
/// <summary>
/// 机台编号
/// </summary>
[SugarColumn(ColumnName = "machine_code")]
public string MachineCode { get; set; }
}
}

@ -0,0 +1,17 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Repository.service
{
public interface IRecordStaffCommuteService : IBaseService<RecordStaffCommute>
{
/// <summary>
/// 获取记录员工上下班打卡信息
/// </summary>
/// <returns></returns>
List<RecordStaffCommute> GetRecordStaffCommutes();
}
}

@ -49,7 +49,7 @@ namespace SlnMesnac.Repository.service.Impl
public ProdPlanDetail GetPlanDetailsByPlanCode(string planCode) public ProdPlanDetail GetPlanDetailsByPlanCode(string planCode)
{ {
ProdPlanDetail prodPlanDetail = _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(planCode),x=>x.PlanCode == planCode).First(); ProdPlanDetail prodPlanDetail = _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(planCode),x=>x.PlanCode == planCode).OrderByDescending(x => x.ObjId).First();
return prodPlanDetail; return prodPlanDetail;
} }
} }

@ -3,6 +3,7 @@ using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base; using SlnMesnac.Repository.service.@base;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
namespace SlnMesnac.Repository.service.Impl namespace SlnMesnac.Repository.service.Impl
@ -22,7 +23,7 @@ namespace SlnMesnac.Repository.service.Impl
try try
{ {
records = base._rep.GetList(); records = base._rep.GetList();
records.Reverse(); records = records.OrderByDescending(x => x.CreateTime).Take(20).ToList();
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -0,0 +1,25 @@
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
public class RecordStaffCommuteServiceImpl : BaseServiceImpl<RecordStaffCommute>, IRecordStaffCommuteService
{
private readonly ILogger<RecordStaffCommute> _logger;
public RecordStaffCommuteServiceImpl(Repository<RecordStaffCommute> rep, ILogger<RecordStaffCommute> logger) : base(rep)
{
_logger = logger;
}
public List<RecordStaffCommute> GetRecordStaffCommutes()
{
return null;
}
}
}

@ -34,17 +34,7 @@
</StackPanel> </StackPanel>
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right"> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<Grid> <TextBlock Text="{Binding CurrentTimeText}" FontSize="20" FontWeight="Bold" Foreground="#FFFFFF" Margin="2,0,10,0"/>
<!--显示时间-->
<!--<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="班组" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="2" Text="甲班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>-->
</Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>
@ -83,28 +73,8 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0"/>
<Ellipse Width="30" Height="30"> <StackPanel Grid.Column="1" VerticalAlignment="Center"/>
<Ellipse.Style>
<Style TargetType="Ellipse">
<Style.Triggers>
<DataTrigger Binding="{Binding ShellScannerStatus}" Value="0">
<Setter Property="Shape.Fill" Value="Orange"/>
</DataTrigger>
<DataTrigger Binding="{Binding ShellScannerStatus}" Value="1">
<Setter Property="Shape.Fill" Value="Green"/>
</DataTrigger>
<DataTrigger Binding="{Binding ShellScannerStatus}" Value="2">
<Setter Property="Shape.Fill" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="打卡机" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
</StackPanel>
</Grid> </Grid>
</StackPanel> </StackPanel>
@ -119,13 +89,13 @@
<Ellipse.Style> <Ellipse.Style>
<Style TargetType="Ellipse"> <Style TargetType="Ellipse">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding BoldScannerStatus}" Value="0"> <DataTrigger Binding="{Binding CodeGunStatus}" Value="0">
<Setter Property="Shape.Fill" Value="Orange"/> <Setter Property="Shape.Fill" Value="Orange"/>
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding BoldScannerStatus}" Value="1"> <DataTrigger Binding="{Binding CodeGunStatus}" Value="1">
<Setter Property="Shape.Fill" Value="Green"/> <Setter Property="Shape.Fill" Value="Green"/>
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding BoldScannerStatus}" Value="2"> <DataTrigger Binding="{Binding CodeGunStatus}" Value="2">
<Setter Property="Shape.Fill" Value="Red"/> <Setter Property="Shape.Fill" Value="Red"/>
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>

@ -130,11 +130,12 @@
<Border.Effect> <Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/> <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect> </Border.Effect>
<ScrollViewer VerticalScrollBarVisibility="Visible">
<DataGrid Name="dataGrid" ItemsSource="{Binding RecordStaffAttendanceDataGrid}" Background="Transparent" <DataGrid Name="dataGrid" ItemsSource="{Binding RecordStaffAttendanceDataGrid}" Background="Transparent"
FontSize="15" ColumnHeaderHeight="30" LoadingRow="dgvMH_LoadingRow" FontSize="15" ColumnHeaderHeight="30" LoadingRow="dgvMH_LoadingRow"
RowHeight="30" AutoGenerateColumns="False" RowHeaderWidth="0" RowHeight="30" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}"> Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}">
<!--resourceStyle 399行修改选中字体颜色--> <!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns> <DataGrid.Columns>
@ -153,21 +154,9 @@
<!--<DataGridTextColumn Binding="{Binding hualway}" Header="性别" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>--> <!--<DataGridTextColumn Binding="{Binding hualway}" Header="性别" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<!--<DataGridTextColumn Binding="{Binding baggageTagCode}" Header="卡号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>--> <!--<DataGridTextColumn Binding="{Binding baggageTagCode}" Header="卡号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTextColumn Binding="{Binding TeamCode}" Header="班组编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding TeamCode}" Header="班组编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding baggageTagCode}" Header="手机号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<!--<DataGridTemplateColumn Header="操作" Width="2*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<WrapPanel>
--><!--<Button Content="查看" FontSize="12" CommandParameter="{Binding ID}" Margin="0 2 0 2" Command="{Binding DataContext.MoveUpCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" />-->
<!--<Button Content="执行" FontSize="12" CommandParameter="{Binding ID}" Margin="2 2 0 2" Command="{Binding DataContext.MoveDownCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" />--><!--
<Button Content="取消" FontSize="12" CommandParameter="{Binding ID}" Margin="2 2 0 2" Background="#df4642" BorderBrush="#df4642" Command="{Binding DataContext.DeletePlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" />
--><!--<Button Content="下传" FontSize="12" CommandParameter="{Binding ID}" Margin="2 2 0 2" Command="{Binding DataContext.MoveDownCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" />--><!--
</WrapPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</ScrollViewer>
</Border> </Border>
</Grid> </Grid>
</UserControl> </UserControl>

@ -37,6 +37,7 @@ namespace SlnMesnac.WPF.ViewModel
private string _checkInButtonColor; private string _checkInButtonColor;
private string _checkOutButtonColor = "#009999"; private string _checkOutButtonColor = "#009999";
private int isCheckOn = 0; private int isCheckOn = 0;
private bool isUse = false;
public static HidUtils hidUtils; public static HidUtils hidUtils;
@ -80,10 +81,10 @@ namespace SlnMesnac.WPF.ViewModel
{ {
hidUtils.Initial(); hidUtils.Initial();
hidUtils.pushReceiveDataEvent += (bytes, str) => hidUtils.pushReceiveDataEvent += (bytes, str) =>
{
if (isCheckOn == 0)
{ {
str = str.ToString().Replace(" ", ""); str = str.ToString().Replace(" ", "");
if (isUse)
{
BaseStaffInfo user = baseStaffService.GetStaffInfoByCardId(str); BaseStaffInfo user = baseStaffService.GetStaffInfoByCardId(str);
if (user != null) if (user != null)
{ {
@ -96,7 +97,7 @@ namespace SlnMesnac.WPF.ViewModel
TeamCode = user.TeamCode, TeamCode = user.TeamCode,
Remark = user.Remark, Remark = user.Remark,
CreateBy = user.StaffName, CreateBy = user.StaffName,
CreateTime = DateTime.Now.ToString("HH:mm:ss"), CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
}; };
_recordStaffAttendanceService.Insert(recordStaffAttendance); _recordStaffAttendanceService.Insert(recordStaffAttendance);
@ -244,6 +245,8 @@ namespace SlnMesnac.WPF.ViewModel
if (CheckInButtonText == "上班打卡") if (CheckInButtonText == "上班打卡")
{ {
// 执行上班打卡逻辑 // 执行上班打卡逻辑
isCheckOn = 0;
isUse = true;
CheckInButtonText = "结束打卡"; CheckInButtonText = "结束打卡";
IsCheckOutButtonEnabled = "False"; // Disable CheckOutButton IsCheckOutButtonEnabled = "False"; // Disable CheckOutButton
CheckOutButtonColor = "Gray"; CheckOutButtonColor = "Gray";
@ -257,6 +260,7 @@ namespace SlnMesnac.WPF.ViewModel
CheckOutButtonColor = "#009999"; CheckOutButtonColor = "#009999";
hidUtils.StopScan(); hidUtils.StopScan();
isCheckOn = 1; isCheckOn = 1;
isUse = false;
} }
} }
@ -268,6 +272,8 @@ namespace SlnMesnac.WPF.ViewModel
if (CheckOutButtonText == "下班打卡") if (CheckOutButtonText == "下班打卡")
{ {
// 执行下班打卡逻辑 // 执行下班打卡逻辑
isCheckOn = 1;
isUse = true;
CheckOutButtonText = "结束打卡"; CheckOutButtonText = "结束打卡";
IsCheckInButtonEnabled = "False"; // Disable CheckInButton IsCheckInButtonEnabled = "False"; // Disable CheckInButton
CheckInButtonColor = "Gray"; CheckInButtonColor = "Gray";
@ -281,6 +287,7 @@ namespace SlnMesnac.WPF.ViewModel
CheckInButtonColor = "#009999"; CheckInButtonColor = "#009999";
hidUtils.StopScan(); hidUtils.StopScan();
isCheckOn = 0; isCheckOn = 0;
isUse = false;
} }
} }

@ -3,6 +3,7 @@ using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Model.domain; using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service; using SlnMesnac.Repository.service;
using SlnMesnac.WPF.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -10,6 +11,7 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input; using System.Windows.Input;
namespace SlnMesnac.WPF.ViewModel namespace SlnMesnac.WPF.ViewModel
@ -80,6 +82,7 @@ namespace SlnMesnac.WPF.ViewModel
else if (times == 1) else if (times == 1)
{ {
StaffIdText = user.StaffId; StaffIdText = user.StaffId;
//判断是否为下一班组长
planDetail.CurrentStaffId = user.StaffId; planDetail.CurrentStaffId = user.StaffId;
StaffNameText = user.StaffName; StaffNameText = user.StaffName;
StaffTypeText = user.StaffType; StaffTypeText = user.StaffType;
@ -106,7 +109,7 @@ namespace SlnMesnac.WPF.ViewModel
}; };
} }
#region #region 参数
/// <summary> /// <summary>
/// 计划数量Text /// 计划数量Text
@ -199,6 +202,8 @@ namespace SlnMesnac.WPF.ViewModel
if(times == 2) if(times == 2)
{ {
//在工单明细插入一条,记录两个班长 //在工单明细插入一条,记录两个班长
//关闭窗口
Application.Current.Windows.OfType<HandOverWin>().First().Close();
} }
else else
{ {

@ -9,12 +9,17 @@ using SlnMesnac.Repository.service;
using SlnMesnac.WPF.Page; using SlnMesnac.WPF.Page;
using SlnMesnac.WPF.Page.Generate; using SlnMesnac.WPF.Page.Generate;
using System; using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Timers;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Threading;
namespace SlnMesnac.WPF.ViewModel namespace SlnMesnac.WPF.ViewModel
{ {
public class MainWindowViewModel: ViewModelBase public class MainWindowViewModel: ViewModelBase, INotifyPropertyChanged
{ {
private readonly ILogger<MainWindowViewModel> _logger; private readonly ILogger<MainWindowViewModel> _logger;
@ -23,7 +28,7 @@ namespace SlnMesnac.WPF.ViewModel
private readonly EmployeeLoginPage _employeeLoginPage = new EmployeeLoginPage(); private readonly EmployeeLoginPage _employeeLoginPage = new EmployeeLoginPage();
private readonly ExecutePage _executePage = new ExecutePage(); private readonly ExecutePage _executePage = new ExecutePage();
private IBaseStaffService _baseStaffService; private IBaseStaffService _baseStaffService;
private System.Timers.Timer timer;
public delegate void UIDCodeDelegate(string code); public delegate void UIDCodeDelegate(string code);
public event UIDCodeDelegate UIDCodeDelegateEvent; public event UIDCodeDelegate UIDCodeDelegateEvent;
@ -41,21 +46,21 @@ namespace SlnMesnac.WPF.ViewModel
/// <summary> /// <summary>
/// 打卡机状态 /// 打卡机状态
/// </summary> /// </summary>
private int _ShellScannerStatus = 0; private int _clockStatus = 0;
public int ShellScannerStatus public int ClockStatus
{ {
get { return _ShellScannerStatus; } get { return _clockStatus; }
set { _ShellScannerStatus = value; RaisePropertyChanged(nameof(ShellScannerStatus)); } set { _clockStatus = value; RaisePropertyChanged(nameof(ClockStatus)); }
} }
/// <summary> /// <summary>
/// 扫码枪状态 /// 扫码枪状态
/// </summary> /// </summary>
private int _BoldScannerStatus = 0; private int _codeGunStatus = 0;
public int BoldScannerStatus public int CodeGunStatus
{ {
get { return _BoldScannerStatus; } get { return _codeGunStatus; }
set { _BoldScannerStatus = value; RaisePropertyChanged(nameof(BoldScannerStatus)); } set { _codeGunStatus = value; RaisePropertyChanged(nameof(CodeGunStatus)); }
} }
public System.Windows.Controls.UserControl _content; public System.Windows.Controls.UserControl _content;
@ -81,7 +86,7 @@ namespace SlnMesnac.WPF.ViewModel
/// <summary> /// <summary>
/// 打开系统键盘 /// 打开系统键盘
/// </summary> /// </summary>
public RelayCommand OpenSystemKeyboardCommand { get; set; } public RelayCommand<object> OpenSystemKeyboardCommand { get; set; }
/// <summary> /// <summary>
/// 窗体控制 /// 窗体控制
@ -94,17 +99,32 @@ namespace SlnMesnac.WPF.ViewModel
//UserContent = _employeeLoginPage; //UserContent = _employeeLoginPage;
UserContent = _executePage; UserContent = _executePage;
_logger = App.ServiceProvider.GetService<ILogger<MainWindowViewModel>>(); _logger = App.ServiceProvider.GetService<ILogger<MainWindowViewModel>>();
var info = App.ServiceProvider.GetService<StringChange>(); var info = App.ServiceProvider.GetService<StringChange>();
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj)); ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
OpenSystemKeyboardCommand = new RelayCommand<object>(obj => OpenSystemKeyboard(obj));
FormControlCommand = new RelayCommand<object>(x => FormControl(x)); FormControlCommand = new RelayCommand<object>(x => FormControl(x));
timer = new System.Timers.Timer(1000); // 1 second interval
timer.Elapsed += Timer_Tick;
timer.Enabled = true;
//RfidHandleBusniess rfidHandleBusniess = new RfidHandleBusniess(hidUtils,_baseStaffService);
} }
/// <summary>
/// 按钮文字转换事件
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
#region 参数
/// <summary>
/// 当前时间
/// </summary>
private string _currentTimeText = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public string CurrentTimeText
{
get { return _currentTimeText; }
set { _currentTimeText = value; OnPropertyChanged("CurrentTimeText"); }
}
#endregion
/// <summary> /// <summary>
/// 窗体控制 /// 窗体控制
/// </summary> /// </summary>
@ -152,6 +172,15 @@ namespace SlnMesnac.WPF.ViewModel
} }
} }
/// <summary>
/// 打开系统键盘
/// </summary>
/// <param name="obj"></param>
private void OpenSystemKeyboard(object obj)
{
System.Diagnostics.Process.Start("osk.exe");
}
/// <summary> /// <summary>
/// 界面跳转 /// 界面跳转
/// </summary> /// </summary>
@ -179,5 +208,15 @@ namespace SlnMesnac.WPF.ViewModel
_logger.LogError("界面跳转逻辑异常", ex); _logger.LogError("界面跳转逻辑异常", ex);
} }
} }
private void Timer_Tick(object sender, ElapsedEventArgs e)
{
CurrentTimeText = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
public void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

Loading…
Cancel
Save