/// <summary> /// Button to perform a GroupInitialize /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonInitialize_Click(object sender, EventArgs e) { try { ftp ftpClient = new ftp(@"ftp://192.168.0.254", "Administrator", "Administrator"); LogINIFullPath = strAssemblyPath + logINIPath + "stages.ini"; LogINIFullPath += ".log"; ftpClient.download("Config/stages.ini", LogINIFullPath); Thread.Sleep(500); ftpClient = null; Dictionary <string, string> ini = readINI(LogINIFullPath); TxMaxAccel.Text = ini["MaximumAcceleration"]; textBoxAccelerationInput.Text = TxMaxAccel.Text; TxMaxVel.Text = ini["MaximumVelocity"]; textBoxVelocityInput.Text = TxMaxVel.Text; TxBoundSource.Text = ini["MinimumTargetPosition"]; textBoxSource.Text = TxBoundSource.Text; TxBoundTweezer.Text = ini["MaximumTargetPosition"]; textBoxTweezer.Text = TxBoundTweezer.Text; label_ErrorMessage.Text = string.Empty; if (m_CommunicationOK == false) { label_ErrorMessage.Text = string.Format("Not connected to XPS"); } if (m_xpsInterface != null) { string errorString = string.Empty; int result = m_xpsInterface.GroupInitialize(m_GroupName, out errorString); if (result == CommandInterfaceXPS.XPS.FAILURE) // Communication failure with XPS { if (errorString.Length > 0) { int errorCode = 0; int.TryParse(errorString, out errorCode); m_xpsInterface.ErrorStringGet(errorCode, out m_errorDescription, out errorString); label_ErrorMessage.Text = string.Format("GroupInitialize ERROR {0}: {1}", result, m_errorDescription); } else { label_ErrorMessage.Text = string.Format("Communication failure with XPS after GroupInitialize "); } } } } catch (Exception ex) { ErrorMessageHandlerChanged("Exception in buttonInitialize_Click: " + ex.Message); } }
private void StopShuttle() { int result; string errorString = string.Empty; if (logFlag) { result = m_xpsInterface.GatheringStop(out errorString); result = m_xpsInterface.GatheringStopAndSave(out errorString); ftp ftpClient = new ftp(@"ftp://192.168.0.254", "Administrator", "Administrator"); LogINIFullPath = strAssemblyPath + logINIPath + DateTime.Now.ToString("yy-MM-dd_H-mm-ss"); LogINIFullPath += ".log"; ftpClient.download("Public/Gathering.dat", LogINIFullPath); Thread.Sleep(500); ftpClient = null; } if (emergency) { result = m_xpsInterface.GroupKill(m_GroupName, out errorString); // GroupMoveAbortFast, GroupMoveAbort if (result == CommandInterfaceXPS.XPS.FAILURE) // Communication failure with XP { if (errorString.Length > 0) { int errorCode = 0; int.TryParse(errorString, out errorCode); m_xpsInterface.ErrorStringGet(errorCode, out m_errorDescription, out errorString); m_ErrorMessageChanged(string.Format("GroupKill ERROR {0}: {1}", result, m_errorDescription)); } else { m_ErrorMessageChanged(string.Format("Communication failure with XPS after GroupKill ")); } } AdjustShuttleFlag = false; } do { Application.DoEvents(); // wait for current cycle to end if in the middle of it } while (AdjustShuttleFlag); ShuttleFlag = false; // go off jog emergency = false; }