Ejemplo n.º 1
0
        private void HandleSMSG_JOURNAL_MODIFY(SSEventArgs ea)
        {
            SSocket ss = ea.SSocket;
            JournalPacket pck = ss.Metadata as JournalPacket;
            if (pck != null)
            {
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, (DispatcherOperationCallback)delegate(object o)
                {
                    if (jm.Journal.Contains(pck.Data.ID))
                        jm.Set(pck.Data.ID, pck.Data);
                    else
                        jm.Add(pck.Data.ID, pck.Data);

                    if (ss.Command != OpcoDes.SMSG_JOURNAL_MODIFY)
                        return null;

                    jm.Save();

                    DateText_SelectedDateChanged(null, null);

                    return null;
                }, null);
            }
        }
Ejemplo n.º 2
0
        private void HandleSMSG_JOURNAL_SYNC_END(SSEventArgs ea)
        {
            SSocket ss = ea.SSocket;
            ResponsePacket pck = ss.Metadata as ResponsePacket;
            Trace.Write("SMSG_JOURNAL_SYNC_END " + pck.Response);
            if (pck.Response == "SYNC_1")
            {
                
                this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (DispatcherOperationCallback)delegate(object o)
                {
                    jm.SendJournalIds();
                    jm.Save();

                    DateText_SelectedDateChanged(null, null);
                    Trace.Write("SendJournalList COMPLETE!");

                    return null;
                }, null);
            }
            else if (pck.Response == "SYNC_2")
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (DispatcherOperationCallback)delegate(object o)
                {
                    jm.Save();

                    DateText_SelectedDateChanged(null, null);
                    Trace.Write("SendJournalIds COMPLETE!");

                    return null;
                }, null);
            }
        }
Ejemplo n.º 3
0
        private void HandleSMSG_JOURNAL_REMOVE(SSEventArgs ea)
        {
            SSocket ss = ea.SSocket;
            ResponsePacket pck = ss.Metadata as ResponsePacket;
            if (pck != null)
            {
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, (DispatcherOperationCallback)delegate(object o)
                {
                    int id = Convert.ToInt32(pck.Response);
                    jm.Remove(id);

                    if (ss.Command != OpcoDes.SMSG_JOURNAL_REMOVE)
                        return null;

                    jm.Save();
                    DateText_SelectedDateChanged(null, null);

                    return null;
                }, null);
            }
        }
Ejemplo n.º 4
0
        private void HandleSMSG_JOURNAL_ADD(SSEventArgs ea)
        {
            SSocket ss = ea.SSocket;
            
            JournalPacket pck = ss.Metadata as JournalPacket;
            
            if (pck != null)
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (DispatcherOperationCallback)delegate(object o)
                {
                    var t = jm.Add(pck.Data.ID, pck.Data);

                    if (ss.Command != OpcoDes.SMSG_JOURNAL_ADD)
                        return null;

                    jm.Save();

                    if (JournalAdd.Instance.IsVisible)
                    {
                        MessageBox.Show("Запись успешно добавлена!");
                        JournalAdd.Instance.EntryID = pck.Data.ID;
                    }
                    DateText_SelectedDateChanged(null, null);
                    return null;
                }, null);
            }
        }
Ejemplo n.º 5
0
        private void HandleSMSG_ERROR(SSEventArgs ea)
        {
            SSocket sSocket = ea.SSocket;
            ErrorPacket pck = (ErrorPacket)sSocket.Metadata;

            if (pck != null)
            {
                Thread.Sleep(200);
                ShowError(pck.Data.ERRORCAT, pck.Data.ERRORMSG);
            }
        }
Ejemplo n.º 6
0
 private void HandleSMSG_PING(SSEventArgs ea)
 {
     ping_template data = new ping_template(ea.EventTime.ToString(), true);  // send TRUE!!!
     PingPacket pck = new PingPacket(data);
     client.SendCommand(client.ServerIp, OpcoDes.CMSG_PONG, pck.GetType().FullName, pck);
 }
Ejemplo n.º 7
0
 private void HandleSMSG_SERVER_STOPED(SSEventArgs ea)
 {
     var sSocket = ea.SSocket;
     var pck = (ResponsePacket)sSocket.Metadata;
     if (pck != null)
     {
     }
         
 }
Ejemplo n.º 8
0
 private void HandleSMSG_USER_AUTHENTICATED(SSEventArgs ea)
 {
     Trace.Write("[OETS.Client] [SMSG_USER_AUTHENTICATED] " + ((ResponsePacket)ea.SSocket.Metadata).Response);
     jm.SendJournalList();
 }
Ejemplo n.º 9
0
        void OnCommandReceived(object sender, SSEventArgs ea)
        {
            SSocket SSocket = ea.SSocket;
            Trace.WriteLine("[OETS.Client] [Received] <-- " + SSocket.Command);

            switch (SSocket.Command)
            {
                case OpcoDes.SMSG_USER_AUTHENTICATED:
                    HandleSMSG_USER_AUTHENTICATED(ea);
                    break;
                case OpcoDes.SMSG_PING:
                    HandleSMSG_PING(ea);
                    break;
                case OpcoDes.SMSG_ERROR:
                    HandleSMSG_ERROR(ea);
                    break;
                case OpcoDes.SMSG_SERVER_STOPED:
                    HandleSMSG_SERVER_STOPED(ea);
                    break;
                case OpcoDes.SMSG_JOURNAL_ADD:
                case OpcoDes.SMSG_JOURNAL_ADD_SYNC:
                    HandleSMSG_JOURNAL_ADD(ea);
                    break;
                case OpcoDes.SMSG_JOURNAL_MODIFY:
                case OpcoDes.SMSG_JOURNAL_MODIFY_SYNC:
                    HandleSMSG_JOURNAL_MODIFY(ea);
                    break;
                case OpcoDes.SMSG_JOURNAL_REMOVE:
                case OpcoDes.SMSG_JOURNAL_REMOVE_SYNC:
                    HandleSMSG_JOURNAL_REMOVE(ea);
                    break;
                case OpcoDes.SMSG_JOURNAL_SYNC_END:
                    HandleSMSG_JOURNAL_SYNC_END(ea);
                    break;
            }
        }