private void onMessage(iMonNativeApi.iMonDisplayNotifyCode code, IntPtr data) { this.OnLog("Message received: " + code + "(" + data + ")"); switch (code) { case iMonNativeApi.iMonDisplayNotifyCode.PluginSuccess: case iMonNativeApi.iMonDisplayNotifyCode.HardwareConnected: case iMonNativeApi.iMonDisplayNotifyCode.iMonRestarted: this.displayType = (iMonDisplayType)data; this.onStateChanged(true); break; case iMonNativeApi.iMonDisplayNotifyCode.PluginFailed: this.onError(this.getErrorType((iMonNativeApi.iMonDisplayInitResult)data)); break; case iMonNativeApi.iMonDisplayNotifyCode.HardwareDisconnected: case iMonNativeApi.iMonDisplayNotifyCode.iMonClosed: this.onError(this.getErrorType(code)); break; case iMonNativeApi.iMonDisplayNotifyCode.LCDTextScrollDone: this.lcd.OnScrollFinished(); break; } }
private iMonErrorType getErrorType(iMonNativeApi.iMonDisplayNotifyCode notifyCode) { this.OnLogError("Interpreting notify error type: " + notifyCode); switch (notifyCode) { case iMonNativeApi.iMonDisplayNotifyCode.PluginFailed: return(iMonErrorType.Unknown); case iMonNativeApi.iMonDisplayNotifyCode.iMonClosed: return(iMonErrorType.iMonClosed); case iMonNativeApi.iMonDisplayNotifyCode.HardwareDisconnected: return(iMonErrorType.HardwareDisconnected); } return(iMonErrorType.Unknown); }