private void CreateRobotDispatcher() { try { WagoPane.ConnectToBK(m_BK); //Todo: Deviceinit wo? m_BK.SetConfig("127.0.0.1", 502); m_BK.Start(); m_EventStopThread = new ManualResetEvent(false); m_EventThreadStopped = new ManualResetEvent(false); RobotInterface DispatcherInterface = new RobotInterface(null, modulDisplay1, null, null, m_ModuleState, null); RobotInterface Robot1Interface = new RobotInterface(stationDisplay1, null, null, null, m_ModuleState, m_BK); RobotInterface Robot2Interface = new RobotInterface(stationDisplay2, modulDisplay1, resultTable1, partHistoryTable1, m_ModuleState, m_BK); m_RobotDispatcher = new DemoRobotDispatcher(m_EventStopThread, m_EventThreadStopped, DispatcherInterface, Robot1Interface, Robot2Interface); //ToDo: Anzeigeelemnte mit Ereignishandlern verbinden this.counterEditor1.ConnectEvent(m_RobotDispatcher.GetRefRobot2().GetRefCounter()); } catch (SystemException e) { DlgError.HandleException(e); } }
/// <summary> /// kopiert die Daten vom Benutzerinterface in Typparameter. /// </summary> /// <returns></returns> protected override bool PanelToParams() { /* \code */ string _error = ""; bool _ret = base.PanelToParams(); if (this.txtCustomerNo.Text.Length <= 0) { _error += ",CustomerNo cannot be empty"; _ret = false; } if (this.txtVoltage.Value > 16 || this.txtVoltage.Value < 0) { _error += ",Voltage has to be in range 0..16V"; _ret = false; } if (_ret) { GetParams().m_CustTypeNumber = this.txtCustomerNo.Text; GetParams().m_SupplyVoltage = double.Parse(this.txtVoltage.Value.ToString()); } else { DlgError.HandleException(new Exception(_error)); } return(_ret); /* \endcode */ }
public void Save() { SerializerXML _stream = null; try { _stream = new SerializerXML("UserDat", "1.0.0.0"); _stream.OpenOutputStream(s_UserFilePath); _stream.WriteElementStart("Application"); WriteToSerializer(_stream); _stream.WriteElementEnd("Application"); _stream.CloseOutputStream(); _stream = null; } catch (Exception e) { DlgError.HandleException(e); } finally { if (_stream != null) { _stream.CloseOutputStream(); } } }
public static void Error(string modul, string function, Exception ex) { DlgError dlgError = new DlgError(); dlgError.Ex = ex; dlgError.Function = function; dlgError.Modul = modul; if (dlgError.InvokeRequired) { dlgError.Invoke(new MethodInvoker(() => { Error(modul, function, ex); })); } else { DialogResult e = dlgError.ShowDialog(); // DialogResult r = MessageBox.Show(stb.ToString(),"Fehler...",MessageBoxButtons.OKCancel); if (e == DialogResult.Cancel) { Application.Exit(); } } }
public void Load() { string DocType = string.Empty; SerializerXML _stream = null; try { _stream = new SerializerXML("UserDat", "1.0.0.0"); _stream.OpenInputStream(s_UserFilePath); if (_stream.GetDetectedSerializerName() != "UserDat") { throw new FormatException(""); } string NodeGroup; do { NodeGroup = _stream.GetNodeName(); if (_stream.GetNodeType() != SerializerBase.NodeType.NodeEnd) { if (NodeGroup == "Application") { ReadFromSerializer(_stream); } } } while (_stream.ReadNext()); _stream.CloseInputStream(); _stream = null; } catch (Exception e) { DlgError.HandleException(e); } finally { if (_stream != null) { _stream.CloseInputStream(); } } }