/// <summary> /// 打开签收命令列表窗口 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ReceiveCommand(object sender, RoutedEventArgs e) { if (Application.Current.Windows.OfType <ReceiveCommandWindow>().Count() == 0) { var appVM = (AppVM)DataContext; var receivedLst = appVM.ReceivedCmds; ReceiveCommandWindow window = new ReceiveCommandWindow(receivedLst); window.Show(); } }
/// <summary> /// 接收代签命令,并显示签收窗口 /// </summary> /// <param name="data"></param> private void AgentSignCmd(MsgCommandSign data) { if (data.AgentTarget == ConfigurationManager.ConnectionStrings["ClientName"].ConnectionString) { var appVM = (AppVM)DataContext; var cmd = appVM.ReceivedCmds.Where(i => i.CmdSN == data.CmdSN).First(); cmd.OneTargetSigned(data); if (Application.Current.Windows.OfType <ReceiveCommandWindow>().Count() == 0) { ReceiveCommandWindow window = new ReceiveCommandWindow(appVM.ReceivedCmds); window.Show(); window.ChangeCmd(cmd); } else { var window = Application.Current.Windows.OfType <ReceiveCommandWindow>().First(); window.WindowState = WindowState.Normal; Application.Current.Windows.OfType <ReceiveCommandWindow>().First().ChangeCmd(cmd); } } }
/// <summary> /// 接收调度命令,并显示签收窗口 /// </summary> /// <param name="cmd"></param> private void ReceiveCmd(MsgDispatchCommand cmd) { var targets = cmd.Targets.Where(i => i.IsSelected == true && i.Name == ConfigurationManager.ConnectionStrings["ClientName"].ConnectionString); if (targets.Count() != 0) { var appVM = (AppVM)DataContext; var receivedLst = appVM.ReceivedCmds; receivedLst.Insert(0, cmd); if (Application.Current.Windows.OfType <ReceiveCommandWindow>().Count() == 0) { ReceiveCommandWindow window = new ReceiveCommandWindow(receivedLst); window.Show(); } else { var window = Application.Current.Windows.OfType <ReceiveCommandWindow>().First(); window.WindowState = WindowState.Normal; Application.Current.Windows.OfType <ReceiveCommandWindow>().First().ChangeCmd(cmd); } } }