public void CommandSelectSymbolTool(string drawobjectid) { CommandEscape(); m_model.ClearSelectedObjects(); m_commandType = eCommandType.symbol; m_drawObjectId = drawobjectid; }
public override void execCommand(eCommandType cmdType, Function function) { if (checkCommandType(cmdType)) { LogHelper.Log(LogLevel.Info, String.Format(">>> Execute SendNuvoCommand command on event {0}", cmdType)); LogHelper.Log(LogLevel.Trace, String.Format(" SendNuvoCommand={0} / Function={1}", _sendNuvoCommand.ToString(), function.ToString())); // Send Nuvo command ... if (_zoneServer != null) { ZoneState newState = new ZoneState(); newState.Source = _sendNuvoCommand.SourceId; newState.PowerStatus = _sendNuvoCommand.PowerStatus; if (_sendNuvoCommand.Volume >= 0) { newState.Volume = _sendNuvoCommand.Volume; } _zoneServer.SetZoneState(_sendNuvoCommand.ZoneId, newState); } else { LogHelper.Log(LogLevel.Error, String.Format(" Execute SendNuvoCommand FAILED!")); } } }
public int DBExeNonQuery(string StrSQL, eCommandType eCommandType = eCommandType.Text, int eCommandTimeout = 0) { try { DBconnect(); var command = PLServerCommand; command.CommandText = StrSQL; if (eCommandTimeout == 0) { command.CommandTimeout = fldConnectionTimeout; } else { command.CommandTimeout = eCommandTimeout; } if (eCommandType == eCommandType.StoredProcedure) { command.CommandType = CommandType.StoredProcedure; } else { command.CommandType = CommandType.Text; } DBdisconnect(); return(command.ExecuteNonQuery()); } catch (Exception ex) { throw ex; } }
public ButtonController(IButtonView i_View, eCommandType i_Command) { r_View = i_View; r_View.SetEventListener(this); r_Command = CommandCommander.GetInstance().GetCommand(i_Command); r_Command.StatusChanged += handleStatusChange; }
/// <summary> /// Method called for execCommand /// </summary> /// <param name="cmdType">Command type.</param> /// <param name="function">Related fucntion.</param> public override void execCommand(eCommandType cmdType, Function function) { // onFunctionStart & onValidityStart configured to run ... if (checkCommandType(cmdType) && (cmdType == eCommandType.onFunctionStart | cmdType == eCommandType.onValidityStart)) { LogHelper.Log(LogLevel.Info, String.Format(">>> Execute PlaySound@START command on event {0}", cmdType)); LogHelper.Log(LogLevel.Trace, String.Format(" PlaySoundCommand={0} / Function={1}", _playSoundCommand.ToString(), function.ToString())); _audioDriver.CommandPlaySound(_playSoundCommand.Url); } // onFunctionEnd & onValidityEnd configured to run ... if (checkCommandType(cmdType) && (cmdType == eCommandType.onFunctionEnd | cmdType == eCommandType.onValidityEnd)) { LogHelper.Log(LogLevel.Info, String.Format(">>> Execute PlaySound@END command on event {0}", cmdType)); LogHelper.Log(LogLevel.Trace, String.Format(" PlaySoundCommand={0} / Function={1}", _playSoundCommand.ToString(), function.ToString())); _audioDriver.Close(); } // onFunctionError configured to run ... // ... stop any running process in case of an error if (checkCommandType(cmdType) && cmdType == eCommandType.onFunctionError) { LogHelper.Log(LogLevel.Info, String.Format(">>> Execute PlaySound@ERROR command on event {0}", cmdType)); LogHelper.Log(LogLevel.Trace, String.Format(" PlaySoundCommand={0} / Function={1}", _playSoundCommand.ToString(), function.ToString())); _audioDriver.Close(); } }
/// <summary> /// 选择绘图工具 /// </summary> /// <param name="drawobjectid"></param> public void CommandSelectDrawTool(string drawobjectid) { CommandEscape(); m_model.ClearSelectedObjects(); m_commandType = eCommandType.draw; m_drawObjectId = drawobjectid; UpdateCursor(); }
/// <summary> /// 移动画布 /// </summary> public void CommandPan() { if (m_commandType == eCommandType.select || m_commandType == eCommandType.move) { m_commandType = eCommandType.pan; } UpdateCursor(); }
/// <summary> /// 选择左侧工具?? /// </summary> /// <param name="editid"></param> public void CommandEdit(string editid) { CommandEscape(); m_model.ClearSelectedObjects(); m_commandType = eCommandType.edit; m_editToolId = editid; m_editTool = m_model.GetEditTool(m_editToolId); UpdateCursor(); }
private int miTimeToNextCommand = 0; // #endregion Fields #region Constructors // Constructors: public cCommandItem() { mstrCommand = ""; mstrReply = ""; mbCommandRead = false; mbReplySet = false; miWaitTime = 0; mbExpectReply = false; miNumCharsToRead = 0; menCommandType = eCommandType.GeneralCommunication; miPriority = SetPriority(); }
// Constructors: public cCommandItem() { mstrCommand = ""; mstrReply = ""; mbCommandRead = false; mbReplySet = false; miWaitTime = 0; mbExpectReply = false; miNumCharsToRead = 0; menCommandType = eCommandType.GeneralCommunication; miPriority = SetPriority(); }
/// <summary> /// 移动选中线条或图像 /// </summary> /// <param name="handleImmediately"></param> public void CommandMove(bool handleImmediately) { if (m_model.SelectedCount > 0) { if (handleImmediately && m_commandType == eCommandType.move) { m_moveHelper.HandleMouseDownForMove(GetMousePoint(), m_snappoint); } m_commandType = eCommandType.move; UpdateCursor(); } }
/// <summary> /// Method to replace defined placeholders. /// {OnFunction}: will be replaced with command type (e.g. OnFunctionStart) /// {Function}: will be replaced with a string representative of the function, which caused this command to execute. /// {Command.Id}: Id of the command. /// </summary> /// <param name="strMessage">Message string with the placeholders to be replaced.</param> /// <param name="cmdType">Type of the command (e.g. OnFunctionStart)</param> /// <param name="function">Function which caused to execute this command.</param> /// <returns>Message string with replaced placeholders.</returns> private string replacePlaceHolders(string strMessage, eCommandType cmdType, Function function) { String strNewMessage = strMessage; // replace system wide placeholders strNewMessage = MailHelper.replacePlaceHolders(strNewMessage); // replace function- and command specific placeholders strNewMessage = strNewMessage.Replace("{OnFunction}", cmdType.ToString()); strNewMessage = strNewMessage.Replace("{Function}", function.ToString()); strNewMessage = strNewMessage.Replace("{Command.Id}", this.Command.Id.ToString()); return(strNewMessage); }
public DataTable DBExeQuery(string StrSQL, eCommandType eCommandType = eCommandType.Text, eData eData = eData.DataReader, int eCommandTimeout = 0) { DataTable dt = new DataTable(); try { var command = PLServerCommand; command.CommandText = StrSQL; command.Connection = Connection; if (eCommandTimeout == 0) { command.CommandTimeout = fldConnectionTimeout; } else { command.CommandTimeout = eCommandTimeout; } if (eCommandType == eCommandType.StoredProcedure) { command.CommandType = CommandType.StoredProcedure; } else { command.CommandType = CommandType.Text; } switch (eData) { case eData.DataAdapter: dmssql_DataAdapter.SelectCommand = command; dmssql_DataAdapter.Fill(dt); break; default: DBconnect(); dmssql_DataReader = command.ExecuteReader(); dt.Load(dmssql_DataReader); dmssql_DataReader.Close(); DBdisconnect(); break; } return(dt); } catch (Exception ex) { throw ex; } }
/// <summary> /// Private method which calls the event method of super class. /// </summary> /// <param name="commandType">Type of command (e.g. onFunctionError)</param> private void onFunctionEvent(eCommandType commandType) { foreach (IConcreteCommand cmd in _commands) { if (cmd != null) { cmd.execCommand(commandType, _function); } else { LogHelper.Log(LogLevel.Error, String.Format("Ignore <null> concrete command, in list [{0}]", _commands.ToString())); } } }
public void CommandEscape() { bool dirty = (m_newObject != null) || (m_snappoint != null); m_newObject = null; m_snappoint = null; //if (m_editTool != null) // m_editTool.Finished(); //m_editTool = null; m_commandType = eCommandType.select; //m_moveHelper.HandleCancelMove(); m_nodeMoveHelper.HandleCancelMove(); DoInvalidate(dirty); //UpdateCursor(); }
public override void execCommand(eCommandType cmdType, Function function) { if (checkCommandType(cmdType)) { LogHelper.Log(LogLevel.Info, String.Format(">>> Execute SendMail command on event {0} ", cmdType)); LogHelper.Log(LogLevel.Trace, String.Format(" SendMailCommand={0} / Function={1}", _sendMailCommand.ToString(), function.ToString())); // Send mail ... bool bOk = MailHelper.SendMail(_sendMailCommand.ToAddress, replacePlaceHolders(_sendMailCommand.Subject, cmdType, function), replacePlaceHolders(_sendMailCommand.Body, cmdType, function)); if (!bOk) { LogHelper.Log(LogLevel.Error, String.Format(" Execute SendMail FAILED!")); } } }
private static BaseCommand GetCommandFromType(eCommandType type) { return(type switch { eCommandType.add_collection => new AddCollectionCommand(), eCommandType.add_incareer => new AddInCareerCommand(), eCommandType.add_or_replace_texture => new AddOrReplaceTextureCommand(), eCommandType.add_or_update_string => new AddOrUpdateStringCommand(), eCommandType.add_string => new AddStringCommand(), eCommandType.add_texture => new AddTextureCommand(), eCommandType.bind_textures => new BindTexturesCommand(), eCommandType.checkbox => new CheckboxCommand(), eCommandType.combobox => new ComboboxCommand(), eCommandType.copy_collection => new CopyCollectionCommand(), eCommandType.copy_incareer => new CopyInCareerCommand(), eCommandType.copy_texture => new CopyTextureCommand(), eCommandType.create_file => new CreateFileCommand(), eCommandType.create_folder => new CreateFolderCommand(), eCommandType.delete => new DeleteCommand(), eCommandType.end => new EndCommand(), eCommandType.erase_file => new EraseFileCommand(), eCommandType.erase_folder => new EraseFolderCommand(), eCommandType.@if => new IfStatementCommand(), eCommandType.import => new ImportCommand(), eCommandType.import_all => new ImportAllCommand(), eCommandType.move_file => new MoveFileCommand(), eCommandType.@new => new NewCommand(), eCommandType.pack_stream => new PackStreamCommand(), eCommandType.remove_collection => new RemoveCollectionCommand(), eCommandType.remove_incareer => new RemoveInCareerCommand(), eCommandType.remove_string => new RemoveStringCommand(), eCommandType.remove_texture => new RemoveTextureCommand(), eCommandType.replace_texture => new ReplaceTextureCommand(), eCommandType.speedreflect => new SpeedReflectCommand(), eCommandType.@static => new StaticCommand(), eCommandType.stop_errors => new StopErrorsCommand(), eCommandType.unlock_memory => new UnlockMemoryCommand(), eCommandType.unpack_stream => new UnpackStreamCommand(), eCommandType.update_collection => new UpdateCollectionCommand(), eCommandType.update_incareer => new UpdateInCareerCommand(), eCommandType.update_string => new UpdateStringCommand(), eCommandType.update_texture => new UpdateTextureCommand(), eCommandType.version => new VersionCommand(), eCommandType.watermark => new WatermarkCommand(), _ => new OptionalCommand() });
public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { m_canvaswrapper = new CanvasWrapper(this); m_owner = owner; m_model = datamodel; InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); m_commandType = eCommandType.select; m_cursors.AddCursor(eCommandType.select, Cursors.Arrow); m_cursors.AddCursor(eCommandType.draw, Cursors.Cross); m_cursors.AddCursor(eCommandType.pan, "hmove.cur"); m_cursors.AddCursor(eCommandType.move, Cursors.SizeAll); m_cursors.AddCursor(eCommandType.edit, Cursors.Cross); UpdateCursor(); m_moveHelper = new MoveHelper(this); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); }
public cCommandItem(string strCommand, int iWaitTime, bool bExpectReply, int iNumCharsToRead, eCommandType eCommandType) { mstrCommand = strCommand; mstrReply = ""; mbCommandRead = false; mbReplySet = false; mbExpectReply = bExpectReply; if (iWaitTime > miWaitTime) { miWaitTime = iWaitTime; } if (iNumCharsToRead > 0) { miNumCharsToRead = iNumCharsToRead; } menCommandType = eCommandType; miPriority = SetPriority(); }
public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { m_canvaswrapper = new CanvasWrapper(this); m_owner = owner; m_model = datamodel; InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); //忽略窗口信息减少闪烁,由控件来绘制自身 this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //控件将首先绘制到缓冲区而不是绘制到屏幕。 m_commandType = eCommandType.select; m_cursors.AddCursor(eCommandType.select, Cursors.Arrow); //设置选中光标类型 m_cursors.AddCursor(eCommandType.draw, Cursors.Cross); //设置画图光标类型 m_cursors.AddCursor(eCommandType.pan, "hmove.cur"); //设置移动画面光标类型 m_cursors.AddCursor(eCommandType.move, Cursors.SizeAll); //设置移动光标类型 m_cursors.AddCursor(eCommandType.edit, Cursors.Cross); //设置编辑光标类型 UpdateCursor(); //更新光标 m_moveHelper = new MoveHelper(this); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); }
public void CommandSelectEraserTool(string drawobjectid) { bool dirty = (m_newObject != null) || (m_snappoint != null); m_newObject = null; m_snappoint = null; //if (m_editTool != null) // m_editTool.Finished(); //m_editTool = null; m_commandType = eCommandType.select; //m_moveHelper.HandleCancelMove(); m_drawObjectId = drawobjectid; m_nodeMoveHelper.HandleCancelMove(); DoInvalidate(dirty); ispaste = false; moving = false; if (drawobjectid.Equals("Paste")) { ispaste = true; } //UpdateCursor(); }
public string DBExeQuery_Scalar(string StrSQL, eCommandType eCommandType = eCommandType.Text, int eCommandTimeout = 0) { try { DBconnect(); var command = PLServerCommand; command.CommandText = StrSQL; if (eCommandTimeout == 0) { command.CommandTimeout = fldConnectionTimeout; } else { command.CommandTimeout = eCommandTimeout; } if (eCommandType == eCommandType.StoredProcedure) { command.CommandType = CommandType.StoredProcedure; } else { command.CommandType = CommandType.Text; } command.Connection = Connection; dmssql_ScalarResult = (string)command.ExecuteScalar(); DBdisconnect(); } catch (Exception ex) { throw ex; } return(dmssql_ScalarResult); }
public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { M_canvas = this; m_canvaswrapper = new CanvasWrapper(this); m_model = datamodel; ((DataModel)m_model).AddDrawTool("Pen", new DrawTools.LineEdit(false)); ////////////////////////////////////////// //?????????????????????????????????? /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// InitializeComponent(); m_commandType = eCommandType.select; BorderStyle = BorderStyle.None; this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); lines = new List <Line>(); orlines = new List <Line>(); }
/// <summary> /// Returns true, if this command type is set. /// </summary> /// <param name="cmdType">Command type to check (e.g. onFunctionStart)</param> /// <returns></returns> public bool checkCommandType(eCommandType cmdType) { if (cmdType == eCommandType.onFunctionError) { return(onFunctionError); } else if (cmdType == eCommandType.onFunctionStart) { return(onFunctionStart); } else if (cmdType == eCommandType.onFunctionEnd) { return(onFunctionEnd); } else if (cmdType == eCommandType.onValidityStart) { return(onValidityStart); } else if (cmdType == eCommandType.onValidityEnd) { return(onValidityEnd); } return(false); }
// Append strCommand to the queue, wait for iTimeToWait milliseconds (minimum 55 ms), and either expect or disregard a reply. public void SendCommand(string strCommand, int iTimeToWaitMS, bool bExpectReply, int iNumCharsToRead, eCommandType eCommType) { cCommandItem pCommand = new cCommandItem(strCommand, iTimeToWaitMS, bExpectReply, iNumCharsToRead, eCommType); mCommandQueue.Add(pCommand); }
public void CommandSelectSymbolTool(string drawobjectid) { CommandEscape(); m_model.ClearSelectedObjects(); m_commandType = eCommandType.symbol; m_drawObjectId = drawobjectid; }
/// <summary> /// 鼠标按下事件 /// </summary> /// <param name="e"></param> protected override void OnMouseDown(MouseEventArgs e) { m_mousedownPoint = new PointF(e.X, e.Y); // used when panning m_dragOffset = new PointF(0, 0); UnitPoint mousepoint = ToUnit(m_mousedownPoint); //获取当前光标世界坐标 if (m_snappoint != null) { mousepoint = m_snappoint.SnapPoint; } if (m_commandType == eCommandType.editNode) //如果为编辑节点 { bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled)) { FinishNodeEdit(); base.OnMouseDown(e); return; } } if (m_commandType == eCommandType.select) //如果为选中 { bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled)) { m_commandType = eCommandType.editNode; m_snappoint = null; base.OnMouseDown(e); return; } m_selection = new SelectionRectangle(m_mousedownPoint); } if (m_commandType == eCommandType.move) //如果为移动 { m_moveHelper.HandleMouseDownForMove(mousepoint, m_snappoint); } if (m_commandType == eCommandType.draw) //如果为绘制 { HandleMouseDownWhenDrawing(mousepoint, null); DoInvalidate(true); } if (m_commandType == eCommandType.edit) //如果为编辑 { if (m_editTool == null) //如果编辑工具为空 { m_editTool = m_model.GetEditTool(m_editToolId); } if (m_editTool != null) //如果编辑工具不为空 { if (m_editTool.SupportSelection) { m_selection = new SelectionRectangle(m_mousedownPoint); } eDrawObjectMouseDown mouseresult = m_editTool.OnMouseDown(m_canvaswrapper, mousepoint, m_snappoint); /* * if (mouseresult == eDrawObjectMouseDown.Continue) * { * if (m_editTool.SupportSelection) * m_selection = new SelectionRectangle(m_mousedownPoint); * } * */ if (mouseresult == eDrawObjectMouseDown.Done) //如果绘制已经完成 { m_editTool.Finished(); m_editTool = m_model.GetEditTool(m_editToolId); // continue with new tool //m_editTool = null; if (m_editTool.SupportSelection) { m_selection = new SelectionRectangle(m_mousedownPoint); } } } DoInvalidate(true); UpdateCursor(); //更新光标 } base.OnMouseDown(e); }
public void ProcessReply(string strReply, eCommandType eType) { // Handle special (non-supported command) cases first if (eType == eCommandType.ScanStart) { // Reset the Progress Bar, clear the data list. ResetProgressBar(); mDataList.Clear(); // Set the Role of this object according to mObjectRole string strRole = "Calibrator"; if (mObjectRole == ObjectRoles.Target) { strRole = "Target"; } else if (mObjectRole == ObjectRoles.Dark) { strRole = "Dark"; } else if (mObjectRole == ObjectRoles.Sky) { strRole = "Sky"; } // Create the start-of-scan header. mstrScanStart = "StartScan, " + GetTimeString() + ", " + mstrTargetName + ", " + strRole + ", " + miGain + ", " + mdIntegrationTime.ToString("0.00") + ", " + mstrFilter; } else if (eType == eCommandType.ScanStop || eType == eCommandType.ScanEnd) { // Signal that the SSP-4 is done scanning. mbScanning = false; UpdateStatus(); // Copy the data over to the output string. int iNumPoints = mDataList.Count; int iValue = 0; string strToWrite = iNumPoints.ToString(); double dAverage = 0; double sumOfDerivation = 0; for (int i = 0; i < iNumPoints; i++) { iValue = mDataList[i]; dAverage += iValue; sumOfDerivation += (iValue * iValue); strToWrite += ", " + iValue; } // Compute the average and standard deviation. dAverage /= iNumPoints; double sumOfDerivationAverage = sumOfDerivation / iNumPoints; double Stdev = Math.Sqrt(sumOfDerivationAverage - (dAverage * dAverage)); // Now, write the data out to the file, including the scan header. mSaveFile.WriteLine(mstrScanStart); mSaveFile.WriteLine(strToWrite); mSaveFile.WriteLine("EndScan, " + GetTimeString()); mSaveFile.Flush(); // Reset the Progress Bar ResetProgressBar(); // Output Some Statistics of the data. Format the double to have two decimal points, automatically rounded. SetCommandWindowText("Object: " + mstrTargetName + "\t Gain: " + miGain + "\t Int: " + mdIntegrationTime.ToString("0.00") + "\t Filt: " + mstrFilter + "\t NPoints: " + iNumPoints + "\t Average: " + dAverage.ToString("0.00") + "\t StDev: " + Stdev.ToString("0.00")); } else if (eType == eCommandType.Rescan) { //Scan(); } else if (eType == eCommandType.Error) { // Clearly something is wrong, stop the threads and break communication with the box. mSaveFile.WriteLine("Error, " + GetTimeString() + ", " + strReply); SendCommand("_DISCONNECT", 0, false, 0, eCommandType.Termination); mbOnline = false; UpdateStatus(); System.Windows.Forms.MessageBox.Show("An Error Has Occurred: " + strReply + "\n" + "Closing Connection.", "Connection Error", System.Windows.Forms.MessageBoxButtons.OK); } else if (eType == eCommandType.DataDiscard) { // TODO: Clear the buffer or something } else if (eType == eCommandType.Termination) { mSaveFile.WriteLine("SessionEnd"); mSaveFile.Flush(); } else { // TODO: Add Processing Capabilities: // Init vars char cFirstCharacter = strReply[0]; // If we reach this point, we either have a data point, or a setting change. // Ready for a long set of if-statements? Go! if (cFirstCharacter == '!') // The box is up and running { SetTemperature(miTemperatureSetting); SetIntegrationTime(mdIntegrationTime); SetGain(miGain); // Start polling for the temperature StartTemperaturePolling(); mbOnline = true; UpdateStatus(); } else if (cFirstCharacter == 'G') // Gain Setting Change Reply { int iIndex = 0; strReply = strReply.Remove(0, 4); try { iIndex = Convert.ToInt32(strReply) - 1; } catch { // If some odd errors start showing up, do something with the error here. } miGain = miarrGainValues[iIndex]; } else if (cFirstCharacter == 'I') // Integration Setting Change Reply { int iIntegrationTime = 0; strReply = strReply.Remove(0, 1); try { iIntegrationTime = Convert.ToInt32(strReply); } catch { // If some odd errors start showing up, do something with the error here. } mdIntegrationTime = iIntegrationTime * mdIntegrationStepSize; } else if (mbScanning && cFirstCharacter == 'C') // Data Point, only valid if a scan is active. { strReply = strReply.Remove(0, 2); int iCounts = 0; bool bInsertPoint = true; try { iCounts = Convert.ToInt32(strReply); } catch { bInsertPoint = false; } // Append The Data. if (bInsertPoint) { mDataList.Add(iCounts); IncrementProgressBar(); } } else if (cFirstCharacter == 'T') // Temperature Setting Change Reply { // TODO: Rewrite since documentation is incorrect. strReply = strReply.Remove(0, 3); try { miTemperatureSetting = -1 * Convert.ToInt32(strReply); } catch { // If some odd errors start showing up, do something with the error here. } mSaveFile.WriteLine("SetTemp, " + GetTimeString() + ", " + miTemperatureSetting.ToString("0.0")); mSaveFile.Flush(); } else if (cFirstCharacter == 'F') // Current System Temperature { double dTemp = 0; bool bUpdateTemperature = true; strReply = strReply.Remove(0, 2); try { dTemp = -1 * Convert.ToDouble(strReply); } catch { bUpdateTemperature = false; } // Update the GUI if (bUpdateTemperature) { UpdateTemperature(dTemp); } // If the temperature has changed, write an entry to data file if (bUpdateTemperature && (Math.Abs(dTemp - mdTemperature) > 0.3)) { mdTemperature = dTemp; mSaveFile.WriteLine("GotTemp, " + GetTimeString() + ", " + dTemp.ToString("0.0")); mSaveFile.Flush(); } } else if (cFirstCharacter == 'E') // Control of the box has been returned to the 2-button interface { // Tell the threads to stop: SendCommand("STOP", 0, false, 0, eCommandType.Termination); mbOnline = false; UpdateStatus(); } else // The command is not implemented. There is not a settings change associated with this item. { // TODO: Re-enable this option System.Windows.Forms.MessageBox.Show("The specified reply, " + strReply + " is not implemented for this unit. Please verify the command structure."); } } }
protected override void OnMouseDown(MouseEventArgs e) { m_mousedownPoint = new PointF(e.X, e.Y); // used when panning m_dragOffset = new PointF(0, 0); //移动音符放下 if (moving) { moving = false; lines.AddRange(mr.getLines()); } if (ispaste) { ispaste = false; List <Line> l = pr.getLines(); for (int i = 0; i < l.Count; i++) { Line l1 = new Line(l[i].P1, l[i].P2, l[i].S, l[i].isRed, l[i].Color); lines.Add(l1); } } if (m_drawObjectId.Equals("StartPoint")) { TestForm.setStartPoint(e.X, e.Y); } UnitPoint mousepoint = ToUnit(m_mousedownPoint); if (m_snappoint != null) { mousepoint = m_snappoint.SnapPoint; } if (m_commandType == eCommandType.select) { bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled)) { m_commandType = eCommandType.editNode; m_snappoint = null; base.OnMouseDown(e); return; } m_selection = new SelectionRectangle(m_mousedownPoint); } /* * if (m_commandType == eCommandType.move) * { * m_moveHelper.HandleMouseDownForMove(mousepoint, m_snappoint); * } * */ if (m_commandType == eCommandType.draw) { HandleMouseDownWhenDrawing(mousepoint, null); DoInvalidate(true); } else if (m_commandType == eCommandType.symbol) { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm)); CanvasWrapper canvastest = new CanvasWrapper(this, Graphics.FromImage(m_staticImage), ClientRectangle); canvastest.Graphics.SmoothingMode = m_smoothingMode; if (m_drawObjectId == "clef1" || m_drawObjectId == "clef2" || m_drawObjectId == "clef3" || m_drawObjectId == "clef4" || m_drawObjectId == "clef6" || m_drawObjectId == "N2" || m_drawObjectId == "N3" || m_drawObjectId == "N4" || m_drawObjectId == "N5" || m_drawObjectId == "N6" || m_drawObjectId == "N7" || m_drawObjectId == "N8" || m_drawObjectId == "N9" || m_drawObjectId == "N10" || m_drawObjectId == "N11" || m_drawObjectId == "N12" || m_drawObjectId == "s10" || m_drawObjectId == "s11" || m_drawObjectId == "s12" || m_drawObjectId == "N12" || m_drawObjectId == "N13") { // MessageBox.Show("test test " + m_drawObjectId); DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 1); } else if (m_drawObjectId == "bm1" || m_drawObjectId == "bm2" || m_drawObjectId == "bm3" || m_drawObjectId == "bm4" || m_drawObjectId == "bm5" || m_drawObjectId == "bm6" || m_drawObjectId == "bm7" || m_drawObjectId == "bm8" || m_drawObjectId == "bm18" || m_drawObjectId == "o11") { DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 0.7); } else { // MessageBox.Show("test test " + m_drawObjectId); DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 0.4); } canvastest.CanvasCtrl.Refresh(); } /* * if (m_commandType == eCommandType.edit) * { * if (m_editTool == null) * m_editTool = m_model.GetEditTool(m_editToolId); * if (m_editTool != null) * { * if (m_editTool.SupportSelection) * m_selection = new SelectionRectangle(m_mousedownPoint); * * eDrawObjectMouseDown mouseresult = m_editTool.OnMouseDown(m_canvaswrapper, mousepoint, m_snappoint); * // /* * // if (mouseresult == eDrawObjectMouseDown.Continue) * // { * // if (m_editTool.SupportSelection) * // m_selection = new SelectionRectangle(m_mousedownPoint); * // } * // * * / * // * if (mouseresult == eDrawObjectMouseDown.Done) * { * m_editTool.Finished(); * m_editTool = m_model.GetEditTool(m_editToolId); // continue with new tool * //m_editTool = null; * * if (m_editTool.SupportSelection) * m_selection = new SelectionRectangle(m_mousedownPoint); * } * } * DoInvalidate(true); * UpdateCursor(); * } */ base.OnMouseDown(e); }
/// <summary> /// 完成节点编辑 /// </summary> void FinishNodeEdit() { m_commandType = eCommandType.select; m_snappoint = null; }
public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { m_canvaswrapper = new CanvasWrapper(this); m_owner = owner; m_model = datamodel; InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); m_commandType = eCommandType.select; m_cursors.AddCursor(eCommandType.select, Cursors.Arrow); m_cursors.AddCursor(eCommandType.draw, Cursors.Cross); m_cursors.AddCursor(eCommandType.pan, "hmove.cur"); m_cursors.AddCursor(eCommandType.move, Cursors.SizeAll); m_cursors.AddCursor(eCommandType.edit, Cursors.Cross); UpdateCursor(); m_moveHelper = new MoveHelper(this); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); }
protected override void OnMouseDown(MouseEventArgs e) { m_mousedownPoint = new PointF(e.X, e.Y); // used when panning m_dragOffset = new PointF(0,0); if (e.Button == System.Windows.Forms.MouseButtons.Right) CommandEscape(); UnitPoint mousepoint = ToUnit(m_mousedownPoint); if (m_snappoint != null) mousepoint = m_snappoint.SnapPoint; if (m_commandType == eCommandType.editNode) { bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled)) { FinishNodeEdit(); base.OnMouseDown(e); return; } } if (m_commandType == eCommandType.select) { bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled)) { m_commandType = eCommandType.editNode; m_snappoint = null; base.OnMouseDown(e); return; } DoInvalidate(true); UpdateCursor(); m_selection = new SelectionRectangle(m_mousedownPoint); } if (m_commandType == eCommandType.move) { m_moveHelper.HandleMouseDownForMove(mousepoint, m_snappoint); } if (m_commandType == eCommandType.draw) { if (e.Button == System.Windows.Forms.MouseButtons.Middle && m_newObject != null) { if (m_newObject is ModuleItems.Module) (m_newObject as ModuleItems.Module).horizontal = !(m_newObject as ModuleItems.Module).horizontal; return; } HandleMouseDownWhenDrawing(mousepoint, null); DoInvalidate(true); } if (m_commandType == eCommandType.edit) { if (m_editTool == null) m_editTool = m_model.GetEditTool(m_editToolId); if (m_editTool != null) { if (m_editTool.SupportSelection) m_selection = new SelectionRectangle(m_mousedownPoint); eDrawObjectMouseDown mouseresult = m_editTool.OnMouseDown(m_canvaswrapper, mousepoint, m_snappoint); /* if (mouseresult == eDrawObjectMouseDown.Continue) { if (m_editTool.SupportSelection) m_selection = new SelectionRectangle(m_mousedownPoint); } * */ if (mouseresult == eDrawObjectMouseDown.Done) { m_editTool.Finished(); m_editTool = m_model.GetEditTool(m_editToolId); // continue with new tool //m_editTool = null; if (m_editTool.SupportSelection) m_selection = new SelectionRectangle(m_mousedownPoint); } } DoInvalidate(true); UpdateCursor(); } base.OnMouseDown(e); }
public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { M_canvas = this; m_canvaswrapper = new CanvasWrapper(this); m_model = datamodel; ((DataModel)m_model).AddDrawTool("Pen", new DrawTools.LineEdit(false)); ////////////////////////////////////////// //?????????????????????????????????? /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// InitializeComponent(); m_commandType = eCommandType.select; BorderStyle = BorderStyle.None; this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); lines = new List<Line>(); orlines = new List<Line>(); }
public abstract void execCommand(eCommandType cmdType, Function function);
public void CommandEscape() { bool dirty = (m_newObject != null) || (m_snappoint != null); m_newObject = null; m_snappoint = null; if (m_editTool != null) m_editTool.Finished(); m_editTool = null; m_commandType = eCommandType.select; m_moveHelper.HandleCancelMove(); m_nodeMoveHelper.HandleCancelMove(); if (this.Parent is DocumentForm){ DocumentForm temp = this.Parent as DocumentForm; temp.SetHint(""); } DoInvalidate(dirty); UpdateCursor(); }
public void RegisterCommand(eCommandType i_CommandType, ICommand i_Command) { r_CommandDictionary[i_CommandType] = i_Command; }
// Append strCommand to the queue, wait for iTimeToWait milliseconds (minimum 55 ms), and either expect or disregard a reply. public void SendCommand(string strCommand, int iTimeToWaitMS, bool bExpectReply, int iNumCharsToRead, eCommandType eCommType) { cCommandItem pCommand = new cCommandItem(strCommand, iTimeToWaitMS, bExpectReply, iNumCharsToRead, eCommType); mCommandQueue.Add(pCommand); }
public void CommandEscape() { bool dirty = (m_newObject != null) || (m_snappoint != null); m_newObject = null; m_snappoint = null; //if (m_editTool != null) // m_editTool.Finished(); //m_editTool = null; m_commandType = eCommandType.select; //m_moveHelper.HandleCancelMove(); m_nodeMoveHelper.HandleCancelMove(); DoInvalidate(dirty); //UpdateCursor(); }
protected override void OnMouseDown(MouseEventArgs e) { if (m_rectBaseTextBox != null && m_rectBaseTextBox.Tag != null) { ((DrawTools.RectBase)m_rectBaseTextBox.Tag).Text = m_rectBaseTextBox.Text; ((DrawTools.RectBase)m_rectBaseTextBox.Tag).Selected = false; Controls.Remove(m_rectBaseTextBox); m_model.ClearSelectedObjects(); m_rectBaseTextBox = null; DoInvalidate(true); return; } if (e.Button == MouseButtons.Middle) { CommandEscape(); CommandPan(); } if (e.Button == MouseButtons.Right) { CommandEscape(); } m_mousedownPoint = new PointF(e.X, e.Y); // used when panning m_dragOffset = new PointF(0, 0); UnitPoint mousepoint = ToUnit(m_mousedownPoint); if (m_snappoint != null) { mousepoint = m_snappoint.SnapPoint; //snap point: rect point } if (m_commandType == eCommandType.editNode) { //modify a obj's node, e.g: move node bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled, m_snappoint)) { FinishNodeEdit(); base.OnMouseDown(e); return; } } if (m_commandType == eCommandType.select) { //select an exsiting obj bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled, m_snappoint)) { m_commandType = eCommandType.editNode; m_snappoint = null; base.OnMouseDown(e); return; } m_selection = new SelectionRectangle(m_mousedownPoint); } if (m_commandType == eCommandType.move) { m_moveHelper.HandleMouseDownForMove(mousepoint, m_snappoint); } if (m_commandType == eCommandType.draw) { //make a new obj and add it to model HandleMouseDownWhenDrawing(mousepoint, m_snappoint); DoInvalidate(true); } if (m_commandType == eCommandType.edit) { if (m_editTool == null) { m_editTool = m_model.GetEditTool(m_editToolId); } if (m_editTool != null) { if (m_editTool.SupportSelection) { m_selection = new SelectionRectangle(m_mousedownPoint); } eDrawObjectMouseDown mouseresult = m_editTool.OnMouseDown(m_canvaswrapper, mousepoint, m_snappoint); /* * if (mouseresult == eDrawObjectMouseDown.Continue) * { * if (m_editTool.SupportSelection) * m_selection = new SelectionRectangle(m_mousedownPoint); * } * */ if (mouseresult == eDrawObjectMouseDown.Done) { m_editTool.Finished(); m_editTool = m_model.GetEditTool(m_editToolId); // continue with new tool //m_editTool = null; if (m_editTool.SupportSelection) { m_selection = new SelectionRectangle(m_mousedownPoint); } } } DoInvalidate(true); UpdateCursor(); } base.OnMouseDown(e); }
public void CommandSelectEraserTool(string drawobjectid) { bool dirty = (m_newObject != null) || (m_snappoint != null); m_newObject = null; m_snappoint = null; //if (m_editTool != null) // m_editTool.Finished(); //m_editTool = null; m_commandType = eCommandType.select; //m_moveHelper.HandleCancelMove(); m_drawObjectId = drawobjectid; m_nodeMoveHelper.HandleCancelMove(); DoInvalidate(dirty); ispaste = false; moving = false; if(drawobjectid.Equals("Paste")){ ispaste = true; } //UpdateCursor(); }
public void CommandPan() { if (m_commandType == eCommandType.select || m_commandType == eCommandType.move) m_commandType = eCommandType.pan; UpdateCursor(); }
protected override void OnMouseDown(MouseEventArgs e) { m_mousedownPoint = new PointF(e.X, e.Y); // used when panning m_dragOffset = new PointF(0, 0); //移动音符放下 if (moving) { moving = false; lines.AddRange(mr.getLines()); } if (ispaste) { ispaste = false; List<Line> l=pr.getLines(); for (int i = 0; i <l.Count; i++) { Line l1 = new Line(l[i].P1, l[i].P2, l[i].S, l[i].isRed, l[i].Color); lines.Add(l1); } } if (m_drawObjectId.Equals("StartPoint")) { TestForm.setStartPoint(e.X,e.Y); } UnitPoint mousepoint = ToUnit(m_mousedownPoint); if (m_snappoint != null) mousepoint = m_snappoint.SnapPoint; if (m_commandType == eCommandType.select) { bool handled = false; if (m_nodeMoveHelper.HandleMouseDown(mousepoint, ref handled)) { m_commandType = eCommandType.editNode; m_snappoint = null; base.OnMouseDown(e); return; } m_selection = new SelectionRectangle(m_mousedownPoint); } /* if (m_commandType == eCommandType.move) { m_moveHelper.HandleMouseDownForMove(mousepoint, m_snappoint); } * */ if (m_commandType == eCommandType.draw) { HandleMouseDownWhenDrawing(mousepoint, null); DoInvalidate(true); } else if (m_commandType == eCommandType.symbol) { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm)); CanvasWrapper canvastest = new CanvasWrapper(this, Graphics.FromImage(m_staticImage), ClientRectangle); canvastest.Graphics.SmoothingMode = m_smoothingMode; if (m_drawObjectId == "clef1" || m_drawObjectId == "clef2" || m_drawObjectId == "clef3" || m_drawObjectId == "clef4" || m_drawObjectId == "clef6" || m_drawObjectId == "N2" || m_drawObjectId == "N3" || m_drawObjectId == "N4" || m_drawObjectId == "N5" || m_drawObjectId == "N6" || m_drawObjectId == "N7" || m_drawObjectId == "N8" || m_drawObjectId == "N9" || m_drawObjectId == "N10" || m_drawObjectId == "N11" || m_drawObjectId == "N12" || m_drawObjectId == "s10" || m_drawObjectId == "s11" || m_drawObjectId == "s12" || m_drawObjectId == "N12" || m_drawObjectId == "N13" ) { // MessageBox.Show("test test " + m_drawObjectId); DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 1); } else if (m_drawObjectId == "bm1" || m_drawObjectId == "bm2" || m_drawObjectId == "bm3" || m_drawObjectId == "bm4" || m_drawObjectId == "bm5" || m_drawObjectId == "bm6" || m_drawObjectId == "bm7" || m_drawObjectId == "bm8" || m_drawObjectId == "bm18" || m_drawObjectId == "o11") { DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 0.7); } else { // MessageBox.Show("test test " + m_drawObjectId); DrawSymbol(canvastest, e.X, e.Y, ((System.Drawing.Image)(resources.GetObject("ribbonButton_" + m_drawObjectId + ".Image"))), 0.4); } canvastest.CanvasCtrl.Refresh(); } /* if (m_commandType == eCommandType.edit) { if (m_editTool == null) m_editTool = m_model.GetEditTool(m_editToolId); if (m_editTool != null) { if (m_editTool.SupportSelection) m_selection = new SelectionRectangle(m_mousedownPoint); eDrawObjectMouseDown mouseresult = m_editTool.OnMouseDown(m_canvaswrapper, mousepoint, m_snappoint); // /* // if (mouseresult == eDrawObjectMouseDown.Continue) // { // if (m_editTool.SupportSelection) // m_selection = new SelectionRectangle(m_mousedownPoint); // } // * * / // if (mouseresult == eDrawObjectMouseDown.Done) { m_editTool.Finished(); m_editTool = m_model.GetEditTool(m_editToolId); // continue with new tool //m_editTool = null; if (m_editTool.SupportSelection) m_selection = new SelectionRectangle(m_mousedownPoint); } } DoInvalidate(true); UpdateCursor(); } */ base.OnMouseDown(e); }
public void ExecuteCommand(eCommandType i_CommandTypeName) { // getCommand(i_CommandTypeName).DoCommand(); }
public override void ProcessReply(string strReply, eCommandType eType) { // Temp: Show the replies in the command window box: if (!(mpForm.IsClosing)) { SetCommandWindowDelegate pDelegate = new SetCommandWindowDelegate(mpForm.SetCommandWindowText); mpForm.Invoke(pDelegate, new object[] { strReply }); } // Handle special (non-supported command) cases first if (eType == eCommandType.ScanStart) { // We are starting a scan. Make a new entry in the database for the scan and for the settings cDatabaseItem dbiCommand = new cDatabaseItem(eDBCommandType.ScanStart); mDatabaseQueue.Add(dbiCommand); SettingsChanged(); mbScanning = true; } else if (eType == eCommandType.ScanStop) { // The scan has stopped, note so cDatabaseItem dbiCommand = new cDatabaseItem(eDBCommandType.ScanStop); mDatabaseQueue.Add(dbiCommand); mbScanning = false; base.ScanComplete(); } else if (eType == eCommandType.Rescan) { Scan(); } else { // Init vars int iValue; char cFirstCharacter = strReply[0]; strReply = strReply.Remove(0, 1); // If we reach this point, we either have a data point, or a setting change. The majority // of times we come in here will be for data points but the majority of the code below is // for settings changes. bool bSettingsChanged = true; // Ready for a long set of if statments? Go! if (cFirstCharacter == 'A') // IF Gain { iValue = HexStringToInt(strReply); mdIFGain = 10 + iValue * 0.25; } else if (cFirstCharacter == 'B') // Change of Bandwidth (not all SpectraCyber 1 units support this command. { int iIndex = int.Parse(strReply); miBandwidth = marrBandwithValues[iIndex]; } else if (cFirstCharacter == 'D') // Data point { // eCommandType.DataRequests and eCommandType.DataDiscards get us into this block // Neither of which is a settings change bSettingsChanged = false; // Data requests are the only data command that is processed. if(eType == eCommandType.DataRequest) { // A few more vars: int iVoltage = HexStringToInt(strReply); double dVoltage = Math.Round(iVoltage * mdVoltageStepSize, 6); double dFrequency = 0; // Setup the vars for the database item a little more string[] arrFields = new string[] { "fFrequency", "fValue" }; string[] arrValues; eDBCommandType eDBType = eDBCommandType.Data; // Now, build the values for the database item, Continuum and Spectrum modes do this differently. if (meMode == enumMode.Continuum) arrValues = new string[] { null, dVoltage.ToString() }; else { // Calculate the observation frequency: dFrequency = 1000 * mdPLLFrequency + 1371805; // In GHz arrValues = new string[] { dFrequency.ToString(), dVoltage.ToString() }; } if (!(mpForm.IsClosing)) { VoltageTextboxDelegate pDelegate = new VoltageTextboxDelegate(mpForm.SetVoltageTextbox); mpForm.Invoke(pDelegate, new object[] { dVoltage.ToString() }); FrequencyTextboxDelegate pFreqDelegate = new FrequencyTextboxDelegate(mpForm.SetFrequencyTextbox); mpForm.Invoke(pFreqDelegate, new object[] { dFrequency.ToString() }); } cDatabaseItem dbiCommandItem = new cDatabaseItem(arrFields, arrValues, eDBType); mDatabaseQueue.Add(dbiCommandItem); } } else if (cFirstCharacter == 'F') // PLL Frequency Change { iValue = HexStringToInt(strReply); mdPLLFrequency = Math.Round(46 + ((iValue - .05) / 200), 3); } else if (cFirstCharacter == 'G') // Continuum DC Gain { int iIndex = int.Parse(strReply); miContinuumGain = marrGainValues[iIndex]; } else if (cFirstCharacter == 'I') // Continuum Integration Setting { int iIndex = int.Parse(strReply); mdContinuumIntegration = marrContinuumIntegrationValues[iIndex]; } else if (cFirstCharacter == 'J') // Spectrum DC Voltage Offset { iValue = HexStringToInt(strReply); mdDCOffsetSpec = iValue * mdDCOffsetStepSize; } else if (cFirstCharacter == 'K') // Spectrometer DC Gain { int iIndex = int.Parse(strReply); miSpectrumGain = marrGainValues[iIndex]; } else if (cFirstCharacter == 'L') // Spectrometer Integration Setting { int iIndex = int.Parse(strReply); mdSpectrumIntegration = marrSpectrumIntegrationValues[iIndex]; } else if (cFirstCharacter == 'N') // Noise Source Status changed { bool bNoiseSourceOn = false; if (strReply[2] == 1) // Look at the last character in the string mbNoiseSourceStatus = true; mbNoiseSourceStatus = bNoiseSourceOn; } else if (cFirstCharacter == 'O') // Continuum DC Voltage Offset { iValue = HexStringToInt(strReply); mdDCOffsetCont = iValue * mdDCOffsetStepSize; } else if (cFirstCharacter == 'R') // SpectraCyber Reset. { mcommCommunication.Reset(); InitDatamembers(); // Even though the settings have been changed we don't invoke the SettingsChanged method // The eCommandType.ScanStart "command" takes care of sending the settings off to the database bSettingsChanged = false; } else // The command is not implemented. There is not a settings change associated with this item. { // System.Windows.Forms.MessageBox.Show("The specified command is not implemented for this unit. Please verify the command structure."); bSettingsChanged = false; } // If some setting on the SpectraCyber has changed, update all of the settings. if (bSettingsChanged && mbScanning) SettingsChanged(); } }
public Command (eCommandType _Command, dLightWeightProcessBase _Service) { m_Command = _Command; m_Service = _Service; m_Event = new ManualResetEvent (false); }
public void CommandEdit(string editid) { CommandEscape(); m_model.ClearSelectedObjects(); m_commandType = eCommandType.edit; m_editToolId = editid; m_editTool = m_model.GetEditTool(m_editToolId); UpdateCursor(); }
public int DBExeNonQuery(string StrSQL, OracleConnection Connection, OracleTransaction Transaction, OracleCommand pPLServerCommand, eCommandType eCommandType = eCommandType.Text, int eCommandTimeout = 0) { try { var command = pPLServerCommand; command.CommandText = StrSQL; if (eCommandTimeout == 0) { command.CommandTimeout = fldConnectionTimeout; } else { command.CommandTimeout = eCommandTimeout; } if (eCommandType == eCommandType.StoredProcedure) { command.CommandType = CommandType.StoredProcedure; } else { command.CommandType = CommandType.Text; } command.Connection = Connection; command.Transaction = Transaction; return(command.ExecuteNonQuery()); } catch (Exception ex) { throw ex; } }
public void CommandMove(bool handleImmediately) { if (m_model.SelectedCount > 0) { if (handleImmediately && m_commandType == eCommandType.move) m_moveHelper.HandleMouseDownForMove(GetMousePoint(), m_snappoint); m_commandType = eCommandType.move; UpdateCursor(); } }
public ICommand GetCommand(eCommandType i_CommandType) { return r_CommandDictionary[i_CommandType]; }
public void CommandSelectDrawTool(string drawobjectid) { CommandEscape(); m_model.ClearSelectedObjects(); m_commandType = eCommandType.draw; m_drawObjectId = drawobjectid; UpdateCursor(); }
public cCommandItem(string strCommand, int iTimeToNextCommand, bool bExpectReply, int iNumCharsToRead, eCommandType eCommandType) { mstrCommand = strCommand; mstrReply = ""; mbCommandRead = false; mbReplySet = false; mbExpectReply = bExpectReply; if(iTimeToNextCommand > 0) miTimeToNextCommand = iTimeToNextCommand; if(iNumCharsToRead > 0) miNumCharsToRead = iNumCharsToRead; menCommandType = eCommandType; miPriority = SetPriority(); }
void FinishNodeEdit() { m_commandType = eCommandType.select; m_snappoint = null; }
// Processes noise source replies public virtual void ProcessReply(string strReply, eCommandType eType) { // TODO: if a reply to a reset command is received (R000 or R001), we need to mark the unit as being online. if (strReply[0] == 'R') mbOnline = true; }