private void Delete() { Command command = new CommandDelete(SelectedFlowerPlot); command.Execute(); if (commands.Count > currentCommand) { commands.RemoveRange(currentCommand, commands.Count - currentCommand); } commands.Add(command); currentCommand++; //if (ConnectionService.Instance.proxy.DeleteFlowerPlot(SelectedFlowerPlot)) //{ // var result = ConnectionService.Instance.proxy.DeleteFlowerPlot(SelectedFlowerPlot); // MainWindow.logMessage = "Deleted selected flower plot."; // LogService.Instance.LogInformation("Deleted selected flower plot."); // LogService.Instance.SendServerInformation("Deleted selected flower plot."); //} //else //{ // MessageBox.Show("Selected item is allready deleted.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); // MainWindow.logMessage = "Error while deleting selected flower plot."; // LogService.Instance.LogError("Selected flower plot is already deleted."); // LogService.Instance.SendServerError("Selected flower plot is already deleted."); //} }
private void RefreshCommandsCanExecute(object sender, LogFileLoader.ResultEvent resultEvent) { _fileLoader.LoadResultEvent -= RefreshCommandsCanExecute; _fileLoader = null; ManageRepositoriesViewModel.IsLoading = false; CommandRefresh.CanExecute(null); CommandDelete.CanExecute(null); LogEntryRows.FilterYalvView.CanExecute(null); RaisePropertyChanged("HasData"); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { int x = drawArea.TheLayers.ActiveLayerIndex; CommandDelete command = new CommandDelete(drawArea.TheLayers); if (drawArea.TheLayers[x].Graphics.DeleteSelection()) { drawArea.Refresh(); drawArea.AddCommandToHistory(command); } }
/// <summary> /// 删除任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_CommandDelete_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show($"是否确认删除任务?", "注意", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Button button = (Button)sender; if (Self != null) { //var carStatus = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == "carStatus"); //if (carStatus.Value != CarStatus.idle.GetIndexString()) //{ // MessageBox.Show("小车状态不是空闲,不能设置!"); // return; //} var props = Self.EquipmentProps; var wcsDeleteCommand = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsDeleteCommand.ToString()); wcsDeleteCommand.Value = "1"; var wcsConfirmTaskFinish = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsConfirmTaskFinish.ToString()); wcsConfirmTaskFinish.Value = "0"; var wcsActionType = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsActionType.ToString()); wcsActionType.Value = CarActionType.Init.GetIndexString(); var wcsRow = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.row.ToString()); wcsRow.Value = "0"; var wcsTaskHeaderId = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsTaskHeaderId.ToString()); wcsTaskHeaderId.Value = "0"; var wcsTaskCarId = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsTaskCarId.ToString()); wcsTaskCarId.Value = "0"; var wcsSwitch = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsSwitch.ToString()); wcsSwitch.Value = "0"; var hasPallet = props.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.hasPallet.ToString()); hasPallet.Value = "2"; var temp = CommandDelete?.Invoke(Self); if (temp == null) { MessageBox.Show($"未处理{button.Content}事件"); } else { if (temp.Success) { //MessageBox.Show("取货错误处理成功"); } else { MessageBox.Show($"{button.Content}操作失败:{temp.Msg}"); } } } else { MessageBox.Show("操作失败,通信中断,请重试!"); } } }
public override void PerformAction() { base.PerformAction(); // undo redo ICommand deleteAction = new CommandDelete(m_data.CurrentSelectionObj, m_data); UndoRedoManager.AddNewAction(deleteAction); m_data.CurrentSelectionObj.SetActive(false); m_data.CurrentSelectionObj.GetComponent <Modelable>().Deselect(); // deselect obj FoamUtils.RemoveObjData(m_data, m_data.CurrentSelectionObj); //GameObject.Destroy(m_data.CurrentSelectionObj); m_data.CurrentSelectionObj = null; //FoamUtils.CurrentSelectionObjID = 0; }
/// <summary> /// Delete selected graphic objects /// </summary> public static void DeleteSelection(DrawingCanvas drawingCanvas) { CommandDelete command = new CommandDelete(drawingCanvas); bool wasChange = false; for (int i = drawingCanvas.Count - 1; i >= 0; i--) { if (drawingCanvas[i].IsSelected) { drawingCanvas.GraphicsList.RemoveAt(i); wasChange = true; } } if (wasChange) { drawingCanvas.AddCommandToHistory(command); } }
//------------operation public void DeleteDrawObjects(bool deleteAll) { if (deleteAll) { CommandDeleteAll command = new CommandDeleteAll(this.GraphicsList); if (this.GraphicsList.Clear()) { SetDirty(); Refresh(); AddCommandToHistory(command); } } else { CommandDelete command = new CommandDelete(this.GraphicsList); if (this.GraphicsList.DeleteSelection()) { SetDirty(); Refresh(); AddCommandToHistory(command); } } }
private async void ActionLongTap(object param) { if (param is Actor actor) { const string v1 = "Give Oskar"; const string v2 = "Give gold Raspberry"; const string v3 = "Delete"; const string v4 = "Cancel"; string res = await View.DisplayActionSheet("Select action", null, null, new string[] { v1, v2, v3, v4, }); switch (res) { case v1: CommandGiveOskar.Execute(actor); break; case v2: CommandGiveRaspberry.Execute(actor); break; case v3: CommandDelete.Execute(actor); break; } //if (res == v1) // SetUserRank(actor); //else if (res == v2) // DeleteActor(actor); } }
private void MainForm_KeyDown(object sender, KeyEventArgs e) { int activeLayerIndex = drawArea.TheLayers.ActiveLayerIndex; if (e.Control && e.KeyCode == Keys.C) { //List<DrawObject> o = new List<DrawObject>(); //for (int i = drawArea.TheLayers[activeLayerIndex].Graphics.Count - 1; i >= 0; i--) //{ // if (drawArea.TheLayers[activeLayerIndex].Graphics[i].Selected) // { // o.Add(drawArea.TheLayers[activeLayerIndex].Graphics[i].Clone()); // } //} //drawArea.PrepareCopyObjectList = o; //if (drawArea.PrepareHitProject == null && drawArea.PrepareCopyObjectList.Count == 0) //{ // drawArea.TheLayers[activeLayerIndex].Graphics.UnselectAll(); //} drawArea.PrepareCopyObjectList = drawArea.TheLayers.ActiveLayer.Graphics.Selection; drawArea.CopyObject(); Refresh(); } else if (e.Control && e.KeyCode == Keys.A) { drawArea.TheLayers[activeLayerIndex].Graphics.SelectAll(); drawArea.Refresh(); } else if (e.Control && e.KeyCode == Keys.V) { drawArea.PasteObject(); CommandPaste command = new CommandPaste(drawArea.TheLayers); drawArea.AddCommandToHistory(command); //drawArea.TheLayers[activeLayerIndex].Graphics.UnselectAll(); } else { switch (e.KeyCode) { case Keys.Delete: CommandDelete command = new CommandDelete(drawArea.TheLayers); if (drawArea.TheLayers[activeLayerIndex].Graphics.DeleteSelection()) { drawArea.SetDirty(); drawArea.Refresh(); drawArea.AddCommandToHistory(command); } break; case Keys.Right: drawArea.PanX -= 10; drawArea.Invalidate(); break; case Keys.Left: drawArea.PanX += 10; drawArea.Invalidate(); break; case Keys.Up: if (e.KeyCode == Keys.Up && e.Shift) AdjustZoom(.1f); else drawArea.PanY += 10; drawArea.Invalidate(); break; case Keys.Down: if (e.KeyCode == Keys.Down && e.Shift) AdjustZoom(-.1f); else drawArea.PanY -= 10; drawArea.Invalidate(); break; case Keys.ControlKey: _controlKey = true; break; default: break; } } drawArea.Invalidate(); SetStateOfControls(); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { int x = drawArea.TheLayers.ActiveLayerIndex; CommandDelete command = new CommandDelete(drawArea.TheLayers); if (drawArea.TheLayers[x].Graphics.DeleteSelection()) { drawArea.SetDirty(); drawArea.Refresh(); drawArea.AddCommandToHistory(command); } }
private void ExecuteCommand(string command) { ResizeDrawArea(); this.drawArea.Visible = true; if (command != "text") { this.drawArea.ToolTextBox.Visible = false; } this.myColorPicker.SwitchMode(command == "text"); switch (command) { case "pointer": drawArea.ActiveTool = DrawArea.DrawToolType.Pointer; break; case "rectangle": drawArea.ActiveTool = DrawArea.DrawToolType.Rectangle; break; case "ellipse": drawArea.ActiveTool = DrawArea.DrawToolType.Ellipse; break; case "line": drawArea.ActiveTool = DrawArea.DrawToolType.Line; break; case "arrow": drawArea.ActiveTool = DrawArea.DrawToolType.Arrow; break; case "pencil": drawArea.ActiveTool = DrawArea.DrawToolType.Polygon; break; case "text": drawArea.ActiveTool = DrawArea.DrawToolType.Text; break; case "undo": drawArea.Undo(); break; case "redo": drawArea.Redo(); break; case "save": CommandSave(); break; case "complete": CommandComplete(); break; case "properties": if (drawArea.GraphicsList.ShowPropertiesDialog(drawArea)) { drawArea.SetDirty(); drawArea.Refresh(); } break; case "selectall": drawArea.GraphicsList.SelectAll(); drawArea.Refresh(); break; case "unselectall": drawArea.GraphicsList.UnselectAll(); drawArea.Refresh(); break; case "delete": CommandDelete c = new CommandDelete(drawArea.GraphicsList); if (drawArea.GraphicsList.DeleteSelection()) { drawArea.SetDirty(); drawArea.Refresh(); drawArea.AddCommandToHistory(c); } break; case "deleteall": CommandDeleteAll cc = new CommandDeleteAll(drawArea.GraphicsList); if (drawArea.GraphicsList.Clear()) { drawArea.SetDirty(); drawArea.Refresh(); drawArea.AddCommandToHistory(cc); } break; case "movetofront": if (drawArea.GraphicsList.MoveSelectionToFront()) { drawArea.SetDirty(); drawArea.Refresh(); } break; case "movetoback": if (drawArea.GraphicsList.MoveSelectionToBack()) { drawArea.SetDirty(); drawArea.Refresh(); } break; case "about": FrmAbout frm = new FrmAbout(); frm.ShowDialog(this); break; case "new": docManager.NewDocument(); break; case "open": docManager.OpenDocument(""); break; case "saveas": docManager.SaveDocument(DocManager.SaveType.SaveAs); break; case "exit": this.Exit(); break; case "preferences": Form sf = new SettingForm(); sf.Show(); break; } }
/// <summary> /// 赋值属性 /// </summary> /// <param name="deviceEntity"></param> /// <param name="props"></param> /// <param name="address"></param> public void SetProps(IEnumerable <Equipment> equipments) { Self = equipments.FirstOrDefault(t => t.Code == ControlName); if (Self == null) { //feeder = null; return; } //if (Self.Code == "car1") //{ // feeder = equipments.FirstOrDefault(x => x.Code == "Feeder2"); //} //else //{ // feeder = equipments.FirstOrDefault(x => x.Code == "Feeder1"); //} try { #region 监控文本赋值 var hasPallet = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.hasPallet.ToString()).Value; if (hasPallet != null) { lab_hasPallet.Foreground = Brushes.Blue; switch (hasPallet) { case "0": lab_hasPallet.Content = "初始"; break; case "1": lab_hasPallet.Content = "无货"; break; case "2": lab_hasPallet.Content = "有货"; break; default: lab_hasPallet.Content = "未获取或不识别"; lab_hasPallet.Foreground = Brushes.Red; break; } } var carNo = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.carNo.ToString()).Value; if (!string.IsNullOrEmpty(carNo)) { lab_carNo.Foreground = Brushes.Blue; lab_carNo.Content = carNo; } var row = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.row.ToString()).Value; if (row != null) { lab_Row.Foreground = Brushes.Blue; lab_Row.Content = row; } var TaskHeaderID = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.TaskHeaderID.ToString()).Value; if (TaskHeaderID != null) { lab_taskHeaderId.Foreground = Brushes.Blue; lab_taskHeaderId.Content = TaskHeaderID; } var TaskCarId = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.TaskCarId.ToString()).Value; if (TaskCarId != null) { lab_taskCarId.Foreground = Brushes.Blue; lab_taskCarId.Content = TaskCarId; } //显示任务类型 var actionType = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.actionType.ToString()).Value; if (this.carActionTypeList.ContainsKey(actionType)) { lab_actionType.Content = this.carActionTypeList[actionType]; } //显示设备状态 var carStatus = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.carStatus.ToString()).Value; if (this.carStatusList.ContainsKey(carStatus)) { lab_carStatus.Content = this.carStatusList[carStatus]; } //显示控制模式 var controlMode = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.controlMode.ToString()).Value; if (this.controlModeList.ContainsKey(controlMode)) { lab_controlMode.Content = this.controlModeList[controlMode]; } //错误信息显示 var tempProps = Self.EquipmentProps.FindAll(t => t.EquipmentTypeTemplate.IsMonitor == true); foreach (var item in tempProps) { if (item.Value != item.EquipmentTypeTemplate.MonitorCompareValue) { AddAlarm("报警:" + item.EquipmentTypeTemplate.Name + " 信息:" + item.EquipmentTypeTemplate.MonitorFailure, 2); } else { RemoveAlarm("报警:" + item.EquipmentTypeTemplate.Name + " 信息:" + item.EquipmentTypeTemplate.MonitorFailure); } } #endregion #region 清除WCS写入的DB块 //清除【行列层】设置 var wcsActionType = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsActionType.ToString()); if (wcsActionType.Value == CarActionType.ResetLocation.GetIndexString()) { var wcsRow = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.row.ToString()); if (wcsRow.Value != "0") { var wcsSwitch = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsSwitch.ToString()); wcsSwitch.Value = "0"; wcsActionType.Value = CarActionType.Init.GetIndexString(); wcsRow.Value = "0"; CommandUpdateLocation?.Invoke(Self); } } //清除【位置】设置 if (wcsActionType.Value == CarActionType.ResetPosition.GetIndexString()) { var wcsPosition = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == "wcsPosition"); if (wcsPosition.Value != "0") { var wcsSwitch = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsSwitch.ToString()); wcsSwitch.Value = "0"; wcsActionType.Value = CarActionType.Init.GetIndexString(); wcsPosition.Value = "0"; CommandSetPosition?.Invoke(Self); } } //清除【复位】设置 var wcsResetCommand = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsResetCommand.ToString()); if (wcsResetCommand.Value != "0") { wcsResetCommand.Value = "0"; CommandReset?.Invoke(Self); } //清除【删除任务】设置 var wcsDeleteCommand = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsDeleteCommand.ToString()); if (wcsDeleteCommand.Value != "0") { wcsDeleteCommand.Value = "0"; CommandDelete?.Invoke(Self); } //清除【切换模式】设置 var wcsControlMode = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsControlMode.ToString()); if (wcsControlMode.Value != "0") { wcsControlMode.Value = "0"; CommandControlMode?.Invoke(Self); } #endregion } catch (Exception ex) { Logger.Log($"小车监控界面异常:{ex.Message}", LogLevel.Exception); } }