public PosViewModel(string appInfo, string windowIcon, OperatingStatus status) { MachineSn = Global.MachineSettings.MachineInformations.MachineSn; StoreName = Global.MachineSettings.MachineInformations.StoreName; WinTitle = string.Format("{0}{1}", Global.MachineSettings.MachineInformations.Company, string.IsNullOrEmpty(Global.MachineSettings.MachineInformations.StoreName) ? "" : " | " + Global.MachineSettings.MachineInformations.StoreName); Current = this; AppName = appInfo; WinIcon = windowIcon; UserCode = Global.CurrentSaleMen.UserCode; OperatorName = Global.CurrentSaleMen.FullName; OrderList = new ObservableCollection <Product>(); Task.Factory.StartNew(() => { while (isRuning) { Date = DateTime.Now; Thread.Sleep(1000); } }); OperatingStatus = status; // ConnectStatus = PosModels.ConnectStatus.Server; ClearOrder.Execute(null); //绑定快捷键对应文本 BindHotKeys(); }
public PosWindow(string appInfo, string winIcon, OperatingStatus status) { InitializeComponent(); var monitor = Pharos.Wpf.Monitor.AllMonitors.Where(o => o.IsPrimary).FirstOrDefault(); if (monitor != null) { this.Top = monitor.Bounds.Top; this.Left = monitor.Bounds.Left; this.Width = monitor.Bounds.Width; this.Height = monitor.Bounds.Height; this.ResizeMode = System.Windows.ResizeMode.NoResize; } Application.Current.MainWindow = this; this.ApplyHotKeyBindings(); CurrentModel = new PosViewModel(appInfo, winIcon, status); this.ApplyBindings(this, CurrentModel); CurrentIInputElement = txtBarcode; CurrentGrid = dgOrderList; this.Loaded += PosPage_Loaded; this.PreviewKeyDown += PosWindow_PreviewKeyDown; this.Closing += PosWindow_Closing; this.StateChanged += PosWindow_StateChanged; }