public static PopupViewModel CreateSafeDoorPopup(string message, AlcServerViewModel alcServer) { // TODO: define continue and quit message pack PlcMessagePack continueMessagePack = null; PlcMessagePack quitMessagePack = null; var content = "请关门后点击继续,或者点取消退出自动模式"; return(new PopupViewModel() { OkButtonText = "继续", CancelButtonText = "取消", OkCommand = new CloseDialogAttachedCommand(o => true, () => { alcServer.SentToPlc(continueMessagePack, PlcMessageType.Request); }), CancelCommand = new CloseDialogAttachedCommand(o => true, () => { alcServer.SentToPlc(quitMessagePack, PlcMessageType.Request); alcServer.IsAutoRunning = false; }), MessageItem = LoggingMessageItem.CreateMessage(message), Content = content, IsSpecialPopup = true }); }
public static PopupViewModel CreateClearProductPopup(string message, long errorCode, AlcServerViewModel alcServer) { // TODO: define continue and quit message pack PlcMessagePack continueMessagePack = null; PlcMessagePack quitMessagePack = null; var content = errorCode == 2088? "请清除所有产品后点继续,或者点退出取消自动模式" : "请清料后点击继续,或者点退出再清料"; return(new PopupViewModel() { OkButtonText = "继续", CancelButtonText = "退出", OkCommand = new CloseDialogAttachedCommand(o => true, () => { alcServer.SentToPlc(continueMessagePack, PlcMessageType.Request); }), CancelCommand = new CloseDialogAttachedCommand(o => true, () => { alcServer.SentToPlc(quitMessagePack, PlcMessageType.Request); alcServer.IsAutoRunning = false; }), MessageItem = LoggingMessageItem.CreateMessage(message), Content = content, IsSpecialPopup = true }); }
private void ScrollToBottom(LoggingMessageItem loggingMessageItem) { if (MessageList.Count == 0) { return; } // Scroll to the last item PART_MessageListBox.SelectedIndex = MessageList.Count - 1; PART_MessageListBox.ScrollIntoView(PART_MessageListBox.SelectedItem); }
public static PopupViewModel CreateNormalPopup(string message) { return(new PopupViewModel() { OkButtonText = "确定", CancelButtonText = "取消", OkCommand = new CloseDialogAttachedCommand(o => true, () => {}), CancelCommand = new CloseDialogAttachedCommand(o => true, () => {}), MessageItem = LoggingMessageItem.CreateMessage(message), IsSpecialPopup = false }); }
private void CloseMainWindow(object sender, RoutedEventArgs e) { var popup = new PopupViewModel { OkCommand = new CloseDialogAttachedCommand(o => true, Close), CancelCommand = new CloseDialogAttachedCommand(o => true, () => {}), OkButtonText = "确定", CancelButtonText = "取消", IsSpecialPopup = true, MessageItem = LoggingMessageItem.CreateMessage("是否退出ALC?") }; Logger.EnqueuePopup(popup); }
private void AddMessageItemView(LoggingMessageItem messageItem) { PART_MessageListBox.Items.Add(messageItem); }