public EventArgs(JADA.Event myEvent) { this.Type = myEvent.EventType; this.Result = myEvent.Result; this.SessionId = myEvent.SessionId; this.StreamId = myEvent.StreamId; this.RequestId = myEvent.RequestId; this.WhoAmI = myEvent.WhoAmI; this.UsaAudio = myEvent.UsaAudio; this.ItemType = myEvent.ItemType; this.PointX = myEvent.PointX; this.PointY = myEvent.PointY; this.Area = myEvent.Area; this.Description = myEvent.Description; this.ChatText = myEvent.ChatText; this.Utente = myEvent.Utente; this.Password = myEvent.Password; this.AreaRequests = myEvent.AreaRequests; this.TotalRequests = myEvent.TotalRequests; this.AreaPendingRequests = myEvent.AreaPendingRequests; this.TotalPendingRequests = myEvent.TotalPendingRequests; this.FileName = myEvent.FileName; this.Time = myEvent.Time; this.CurrFrame = myEvent.CurrFrame; this.Frames = myEvent.Frames; }
//********************************************************************* // // G E S T I O N E E V E N T I // //********************************************************************* public void HandleEventThread() { int iRet, iEventType; var evtPtr = new IntPtr(); JADA.Event evtSelf = null; while (true) { iRet = JADA_ConnGetNextEvent(connSelf, 15000, ref evtPtr); if (iRet == 0) { try { evtSelf = new JADA.Event(evtPtr); EventArgs e = new EventArgs(evtSelf); iEventType = evtSelf.EventType; switch (iEventType) { /* Opcode degli eventi: connessione */ case JADA.Event.EVT_CONNECTION_CONNECTED: EventHandler ConnectionConnectedHandler = this.ConnectionConnected; if (null != ConnectionConnectedHandler) { ConnectionConnectedHandler(this, e); } break; case JADA.Event.EVT_CONNECTION_OPENED: EventHandler ConnectionOpenedHandler = this.ConnectionOpened; if (null != ConnectionOpenedHandler) { ConnectionOpenedHandler(this, e); } break; case JADA.Event.EVT_CONNECTION_CLOSED: EventHandler ConnectionClosedHandler = this.ConnectionClosed; if (null != ConnectionClosedHandler) { ConnectionClosedHandler(this, e); } break; case JADA.Event.EVT_SESSIONS_LIST: EventHandler SessionListHandler = this.SessionList; if (null != SessionListHandler) { SessionListHandler(this, e); } break; case JADA.Event.EVT_REQUESTS_LIST: EventHandler RequestsListHandler = this.RequestsList; if (null != RequestsListHandler) { RequestsListHandler(this, e); } break; case JADA.Event.EVT_LIST_COUNTERS: EventHandler CountersListHandler = this.CountersList; if (null != CountersListHandler) { CountersListHandler(this, e); } break; case JADA.Event.EVT_PARAMETERS_LIST: EventHandler ParameterListHandler = this.ParameterList; if (null != ParameterListHandler) { ParameterListHandler(this, e); } break; case JADA.Event.EVT_COMBO_VALUES: EventHandler ComboValuesHandler = this.ComboValues; if (null != ComboValuesHandler) { ComboValuesHandler(this, e); } break; case JADA.Event.EVT_MSG_RESULT: EventHandler MsgResultHandler = this.MsgResult; if (null != MsgResultHandler) { MsgResultHandler(this, e); } break; case JADA.Event.EVT_PING_REPLY: EventHandler PingReplyHandler = this.PingReply; if (null != PingReplyHandler) { PingReplyHandler(this, e); } break; /* Opcode degli eventi: supporto */ case JADA.Event.EVT_SUPPORT_OPENED: EventHandler SupportOpenedHandler = this.SupportOpened; if (null != SupportOpenedHandler) { SupportOpenedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_ACCEPTED: EventHandler SupportAcceptedHandler = this.SupportAccepted; if (null != SupportAcceptedHandler) { SupportAcceptedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_LOADED: EventHandler SupportLoadedHandler = this.SupportLoaded; if (null != SupportLoadedHandler) { SupportLoadedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_CONNECTED: EventHandler SupportConnectedHandler = this.SupportConnected; if (null != SupportConnectedHandler) { SupportConnectedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_SOLICITED: EventHandler SupportSolicitedHandler = this.SupportSolicited; if (null != SupportSolicitedHandler) { SupportSolicitedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_CLOSED: EventHandler SupportClosedHandler = this.SupportClosed; if (null != SupportClosedHandler) { SupportClosedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_SUSPENDED: EventHandler SupportSuspendedHandler = this.SupportSuspended; if (null != SupportSuspendedHandler) { SupportSuspendedHandler(this, e); } break; case JADA.Event.EVT_SUPPORT_RESUMED: EventHandler SupportResumedHandler = this.SupportResumed; if (null != SupportResumedHandler) { SupportResumedHandler(this, e); } break; case JADA.Event.EVT_CHATTEXT_RECEIVED: EventHandler ChatTextReceivedHandler = this.ChatTextReceived; if (null != ChatTextReceivedHandler) { ChatTextReceivedHandler(this, e); } break; /* Opcode degli eventi: media */ case JADA.Event.EVT_CALL_OPENED: EventHandler CallOpenedHandler = this.CallOpened; if (null != CallOpenedHandler) { CallOpenedHandler(this, e); } //StartAudio(); //myAudioRestartTimer = new System.Threading.Timer(new TimerCallback(RestartAudioTimer), null, 0, 5 * 60 * 1000); break; case JADA.Event.EVT_CALL_CLOSED: //if (myAudioRestartTimer != null) //{ // myAudioRestartTimer.Dispose(); myAudioRestartTimer = null; //} //StopAudio(); EventHandler CallClosedHandler = this.CallClosed; if (null != CallClosedHandler) { CallClosedHandler(this, e); } break; case JADA.Event.EVT_CALL_ABORTED: //if (myAudioRestartTimer != null) //{ // myAudioRestartTimer.Dispose(); myAudioRestartTimer = null; //} //StopAudio(); EventHandler CallAbortedHandler = this.CallAborted; if (null != CallAbortedHandler) { CallAbortedHandler(this, e); } break; /* Opcode degli eventi: VNC */ case JADA.Event.EVT_DESKTOP_OPENED: EventHandler DesktopOpenedHandler = this.DesktopOpened; if (null != DesktopOpenedHandler) { DesktopOpenedHandler(this, e); } break; case JADA.Event.EVT_DESKTOP_REQUESTED: EventHandler DesktopRequestedHandler = this.DesktopRequested; if (null != DesktopRequestedHandler) { DesktopRequestedHandler(this, e); } break; case JADA.Event.EVT_DESKTOP_CLOSED: EventHandler DesktopClosedHandler = this.DesktopClosed; if (null != DesktopClosedHandler) { DesktopClosedHandler(this, e); } break; case JADA.Event.EVT_WHITEBOARD_OPENED: EventHandler WhiteboardOpenedHandler = this.WhiteboardOpened; if (null != WhiteboardOpenedHandler) { WhiteboardOpenedHandler(this, e); } break; case JADA.Event.EVT_WHITEBOARD_CLEANED: EventHandler WhiteboardCleanedHandler = this.WhiteboardCleaned; if (null != WhiteboardCleanedHandler) { WhiteboardCleanedHandler(this, e); } break; case JADA.Event.EVT_WHITEBOARD_CLOSED: EventHandler WhiteboardClosedHandler = this.WhiteboardClosed; if (null != WhiteboardClosedHandler) { WhiteboardClosedHandler(this, e); } break; case JADA.Event.EVT_SET_DRAW_POINTER: EventHandler DrawPointerMovedHandler = this.DrawPointerMoved; if (null != DrawPointerMovedHandler) { DrawPointerMovedHandler(this, e); } break; case JADA.Event.EVT_RESET_DRAW_POINTER: EventHandler DrawPointerResetHandler = this.DrawPointerReset; if (null != DrawPointerResetHandler) { DrawPointerResetHandler(this, e); } break; /* Opcode degli eventi: FTP */ case JADA.Event.EVT_FTP_OPENED: EventHandler HandlerFtpOpened = this.FtpOpened; if (null != HandlerFtpOpened) { HandlerFtpOpened(this, e); } break; case JADA.Event.EVT_DIRECTORY_LIST: EventHandler DirectoryListHandler = this.DirectoryList; if (null != DirectoryListHandler) { DirectoryListHandler(this, e); } break; case JADA.Event.EVT_FILE_SENT: EventHandler FileSentHandler = this.FileSent; if (null != FileSentHandler) { FileSentHandler(this, e); } break; case JADA.Event.EVT_FILE_RECEIVED: EventHandler FileReceivedHandler = this.FileReceived; if (null != FileReceivedHandler) { FileReceivedHandler(this, e); } break; case JADA.Event.EVT_FTP_CLOSED: EventHandler FtpClosedHandler = this.FtpClosed; if (null != FtpClosedHandler) { FtpClosedHandler(this, e); } break; default: JADA.Common.LogMessage(String.Format("Tipo evento {0} non gestito da Connection", iEventType)); break; } } catch (Exception e) { JADA.Common.LogMessage(String.Format("HandleEventThread {0}\n{1}", e.Message, e.StackTrace)); // MessageBox.Show("Errore nell'applicazione: i dettagli sono stati salvati nel file di log", "JADA"); } finally { if (evtSelf != null) { evtSelf.Dispose(); } } } } }
public void HandleEventThread() { int iRet, iEventType; var evtPtr = new IntPtr(); JADA.Event evtSelf = null; while (true) { iRet = JADA_ReqGetNextEvent(reqSelf, 15000, ref evtPtr); if (iRet == 0) { try { evtSelf = new JADA.Event(evtPtr); EventArgs e = new EventArgs(evtSelf); iEventType = evtSelf.EventType; switch (iEventType) { case JADA.Event.EVT_CHATTEXT_RECEIVED: EventHandler ChatTextReceivedHandler = this.ChatTextReceived; if (null != ChatTextReceivedHandler) { ChatTextReceivedHandler(this, e); } break; case JADA.Event.EVT_CALL_OPENED: EventHandler CallOpenedHandler = this.CallOpened; if (null != CallOpenedHandler) { CallOpenedHandler(this, e); } StartAudio(); myAudioRestartTimer = new System.Threading.Timer(new TimerCallback(RestartAudioTimer), null, 0, 5 * 60 * 1000); break; case JADA.Event.EVT_CALL_CLOSED: if (myAudioRestartTimer != null) { myAudioRestartTimer.Dispose(); myAudioRestartTimer = null; } StopAudio(); EventHandler CallClosedHandler = this.CallClosed; if (null != CallClosedHandler) { CallClosedHandler(this, e); } break; case JADA.Event.EVT_CALL_ABORTED: if (myAudioRestartTimer != null) { myAudioRestartTimer.Dispose(); myAudioRestartTimer = null; } StopAudio(); EventHandler CallAbortedHandler = this.CallAborted; if (null != CallAbortedHandler) { CallAbortedHandler(this, e); } break; case JADA.Event.EVT_DESKTOP_OPENED: EventHandler DesktopOpenedHandler = this.DesktopOpened; if (null != DesktopOpenedHandler) { DesktopOpenedHandler(this, e); } break; case JADA.Event.EVT_DESKTOP_REQUESTED: EventHandler DesktopRequestedHandler = this.DesktopRequested; if (null != DesktopRequestedHandler) { DesktopRequestedHandler(this, e); } break; case JADA.Event.EVT_DESKTOP_CLOSED: EventHandler DesktopClosedHandler = this.DesktopClosed; if (null != DesktopClosedHandler) { DesktopClosedHandler(this, e); } break; case JADA.Event.EVT_WHITEBOARD_OPENED: EventHandler WhiteboardOpenedHandler = this.WhiteboardOpened; if (null != WhiteboardOpenedHandler) { WhiteboardOpenedHandler(this, e); } break; case JADA.Event.EVT_WHITEBOARD_CLEANED: EventHandler WhiteboardCleanedHandler = this.WhiteboardCleaned; if (null != WhiteboardCleanedHandler) { WhiteboardCleanedHandler(this, e); } break; case JADA.Event.EVT_WHITEBOARD_CLOSED: EventHandler WhiteboardClosedHandler = this.WhiteboardClosed; if (null != WhiteboardClosedHandler) { WhiteboardClosedHandler(this, e); } break; case JADA.Event.EVT_SET_DRAW_POINTER: EventHandler DrawPointerMovedHandler = this.DrawPointerMoved; if (null != DrawPointerMovedHandler) { DrawPointerMovedHandler(this, e); } break; case JADA.Event.EVT_RESET_DRAW_POINTER: EventHandler DrawPointerResetHandler = this.DrawPointerReset; if (null != DrawPointerResetHandler) { DrawPointerResetHandler(this, e); } break; case JADA.Event.EVT_PARAMETERS_LIST: EventHandler ParameterListReceivedHandler = this.ParameterListReceived; if (null != ParameterListReceivedHandler) { ParameterListReceivedHandler(this, e); } break; case JADA.Event.EVT_DIRECTORY_LIST: EventHandler DirectoryListReceivedHandler = this.DirectoryListReceived; if (null != DirectoryListReceivedHandler) { DirectoryListReceivedHandler(this, e); } break; case JADA.Event.EVT_PING_REPLY: EventHandler PingReplyHandler = this.PingReply; if (null != PingReplyHandler) { PingReplyHandler(this, e); } break; } } catch (Exception e) { JADA.Common.LogMessage(String.Format("HandleEventThread {0}\n{1}", e.Message, e.StackTrace)); // MessageBox.Show("Errore nell'applicazione: i dettagli sono stati salvati nel file di log", "AREAS Customer Assistant"); } finally { if (evtSelf != null) { evtSelf.Dispose(); } } } } }
//********************************************************************* // // G E S T I O N E E V E N T I // //********************************************************************* public void CheckEventTimer(object o) { int iRet, iEventType; var evtPtr = new IntPtr(); iRet = JADA_SesGetNextEvent(sesSelf, 1, ref evtPtr); if (iRet == 0) { // try { JADA.Event evtSelf = new JADA.Event(evtPtr); EventArgs e = new EventArgs(evtSelf); iEventType = evtSelf.EventType; switch (iEventType) { case JADA.Event.EVT_SESSION_OPENED: EventHandler SessionOpenedHandler = this.SessionOpened; if (null != SessionOpenedHandler) { SessionOpenedHandler(this, e); } break; case JADA.Event.EVT_SESSION_CLOSED: EventHandler SessionClosedHandler = this.SessionClosed; if (null != SessionClosedHandler) { SessionClosedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_OPENED: EventHandler RequestOpenedHandler = this.RequestOpened; if (null != RequestOpenedHandler) { RequestOpenedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_ACCEPTED: EventHandler RequestAcceptedHandler = this.RequestAccepted; if (null != RequestAcceptedHandler) { RequestAcceptedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_LOADED: EventHandler RequestLoadedHandler = this.RequestLoaded; if (null != RequestLoadedHandler) { RequestLoadedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_CONNECTED: EventHandler RequestConnectedHandler = this.RequestConnected; if (null != RequestConnectedHandler) { RequestConnectedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_SOLICITED: EventHandler RequestSolicitedHandler = this.RequestSolicited; if (null != RequestSolicitedHandler) { RequestSolicitedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_CLOSED: EventHandler RequestClosedHandler = this.RequestClosed; if (null != RequestClosedHandler) { RequestClosedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_SUSPENDED: EventHandler RequestSuspendedHandler = this.RequestSuspended; if (null != RequestSuspendedHandler) { RequestSuspendedHandler(this, e); } break; case JADA.Event.EVT_REQUEST_RESUMED: EventHandler RequestResumedHandler = this.RequestResumed; if (null != RequestResumedHandler) { RequestResumedHandler(this, e); } break; case JADA.Event.EVT_MSG_RESULT: EventHandler ResultReceivedHandler = this.ResultReceived; if (null != ResultReceivedHandler) { ResultReceivedHandler(this, e); } break; case JADA.Event.EVT_SESSIONS_LIST: EventHandler SessionListReceivedHandler = this.SessionListReceived; if (null != SessionListReceivedHandler) { SessionListReceivedHandler(this, e); } break; case JADA.Event.EVT_REQUESTS_LIST: EventHandler RequestListReceivedHandler = this.RequestListReceived; if (null != RequestListReceivedHandler) { RequestListReceivedHandler(this, e); } break; case JADA.Event.EVT_LIST_COUNTERS: EventHandler ListCountersReceivedHandler = this.ListCountersReceived; if (null != ListCountersReceivedHandler) { ListCountersReceivedHandler(this, e); } break; case JADA.Event.EVT_FILE_SENT: EventHandler FileSentHandler = this.FileSent; if (null != FileSentHandler) { FileSentHandler(this, e); } break; case JADA.Event.EVT_FILE_RECEIVED: EventHandler FileReceivedHandler = this.FileReceived; if (null != FileReceivedHandler) { FileReceivedHandler(this, e); } break; } //} //catch (Exception e) //{ // JADA.Common.LogMessage(String.Format("CheckEventTimer {0}\n{1}", e.Message, e.StackTrace)); // MessageBox.Show("Errore nell'applicazione: i dettagli sono stati salvati nel file di log", "AREAS Customer Assistant"); //} } }