Exemplo n.º 1
0
        public string SelectSentMessages(string associateID)
        {
            DllMessage objDal = new DllMessage();

            try
            {
                return(objDal.GetSentMessages(associateID));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
Exemplo n.º 2
0
        public string RecordInsert(PropMessage objProperty, string associateID)
        {
            DllMessage objDal = new DllMessage();

            try
            {
                return(objDal.InsertD(objProperty, associateID));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
Exemplo n.º 3
0
        private void handleMessage(DllMessage msg)
        {
            if(msg.type != DllMessageType.NEW_RECORDS)
                Log.Info("Got message of type " + msg.type.ToString());

            switch (msg.type)
            {
                case DllMessageType.NEW_RECORDS:
                {
                    DllMessageNewRecords m = msg as DllMessageNewRecords;

                    OnNewRecord(m.records);

                    break;
                }
                case DllMessageType.START_CAPTURE_RESP:
                {
                    if (pendingMessageState != PendingMessageState.StartCaptureSent)
                    {
                        Log.Error("Unexpected message in current state {0}", pendingMessageState);
                        break;
                    }

                    DllMessageStartCaptureResp m = msg as DllMessageStartCaptureResp;

                    if (m.okay)
                    {
                        Log.Info("DLL confirms capture start");

                        captureState = CaptureState.Capturing;
                        notifyEvent(EventNotification.CaptureStarted);
                    }

                    if (pendingMessageCallback != null)
                    {
                        pendingMessageCallback(EventNotification.CaptureStarted, m.okay);
                        pendingMessageCallback = null;
                    }

                    pendingMessageState = PendingMessageState.Attached;
                    break;
                }
                case DllMessageType.STOP_CAPTURE_RESP:
                {
                    if (pendingMessageState != PendingMessageState.StopCaptureSent)
                    {
                        Log.Error("Unexpected message in current state {0}", pendingMessageState);
                        break;
                    }

                    DllMessageStopCaptureResp m = msg as DllMessageStopCaptureResp;

                    if (m.okay)
                    {
                        Log.Info("DLL confirms capture stop");

                        captureState = CaptureState.NotCapturing;
                        notifyEvent(EventNotification.CaptureStopped);
                    }

                    if (pendingMessageCallback != null)
                    {
                        pendingMessageCallback(EventNotification.CaptureStopped, m.okay);
                        pendingMessageCallback = null;
                    }

                    pendingMessageState = PendingMessageState.Attached;
                    break;
                }
                case DllMessageType.SCREENDATA:
                {
                        DllMessageScreendata m = msg as DllMessageScreendata;

                        Log.Info("Got screendata of size {0}", m.data.Count);

                        File.WriteAllBytes("test-screenshot.tga", m.data.ToArray());
                        break;
                }
            }
        }