Ejemplo n.º 1
0
 public VkMessageEventArgs(
     int id, 
     MessageStatus flags, 
     int fromId, 
     DateTime ts, 
     string theme, 
     string body, 
     Dictionary<string, string> attaches)
 {
     this.Flags = flags;
     this.Id = id;
     this.FromId = fromId;
     this.Ts = ts;
     this.Theme = theme;
     this.Body = body;
     this.Attaches = attaches;
 }
Ejemplo n.º 2
0
 public VkMessageEventArgs(
     int id,
     MessageStatus flags,
     int fromId,
     DateTime ts,
     string theme,
     string body,
     Dictionary <string, string> attaches)
 {
     this.Flags    = flags;
     this.Id       = id;
     this.FromId   = fromId;
     this.Ts       = ts;
     this.Theme    = theme;
     this.Body     = body;
     this.Attaches = attaches;
 }
Ejemplo n.º 3
0
 public VkFlagsEventArgs(int id, MessageStatus messageStatus)
 {
     this.ID            = id;
     this.MessageStatus = messageStatus;
 }
Ejemplo n.º 4
0
 public VkFlagsEventArgs(int id, MessageStatus messageStatus)
 {
     this.ID = id;
     this.MessageStatus = messageStatus;
 }
Ejemplo n.º 5
0
        private void ParseUpdate(object[] update)
        {
            switch (short.Parse(update[0].ToString()))
            {
            case 0:
            {
                // user delete a message
                this.OnMessageDeleted(new VkEventArgs(int.Parse(update[1].ToString())));
                break;
            }

            case 1:
            {
                // message flags changed
                var messageStatus = new MessageStatus();
                messageStatus.ParseStatus(int.Parse(update[2].ToString()));
                this.OnFlagsChangedEvent(new VkFlagsEventArgs(int.Parse(update[1].ToString()), messageStatus));
                break;
            }

            case 2:
            {
                // set up message flags
                var messageStatus = new MessageStatus(int.Parse(update[2].ToString()));
                this.OnNewFlagsEvent(new VkFlagsEventArgs(int.Parse(update[1].ToString()), messageStatus));
                break;
            }

            case 3:
            {
                // reset message flags
                var messageStatus = new MessageStatus(int.Parse(update[2].ToString()));
                this.OnResetFlagsEvent(new VkFlagsEventArgs(int.Parse(update[1].ToString()), messageStatus));
                break;
            }

            case 4:
            {
                // new message
                var messageStatus = new MessageStatus(int.Parse(update[2].ToString()));
                this.OnNewMessageEvent(new VkMessageEventArgs(
                                           int.Parse(update[1].ToString()),
                                           messageStatus,
                                           int.Parse(update[3].ToString()),
                                           new DateTime(long.Parse(update[4].ToString())),
                                           update[5].ToString(),
                                           update[6].ToString(),
                                           update[7] as Dictionary <string, string>));
                break;
            }

            case 8:
            {
                // user online
                this.OnUserOnlineEvent(new VkEventArgs(int.Parse(update[1].ToString())));
                break;
            }

            case 9:
            {
                // user offline
                this.OnUserOfflineEvent(new VkUserOfflineEventArgs(int.Parse(update[1].ToString()), int.Parse(update[2].ToString())));
                break;
            }

            case 51:
            {
                // convension params changed
                this.OnConvensionParamsChangedEvent(new VkConvensionParamsChangedEventArgs(int.Parse(update[1].ToString()), update[2].ToString()));
                break;
            }

            case 61:
            {
                // start typing in dialog
                this.OnUserTypingEvent(new VkEventArgs(int.Parse(update[1].ToString())));
                break;
            }

            case 62:
            {
                // start typing in convension
                this.OnUserTypingInConvensionEvent(new VkChatEventArgs(int.Parse(update[1].ToString()), int.Parse(update[2].ToString())));
                break;
            }

            case 70:
            {
                // user make call
                this.OnUserMakeCallEvent(new VkCallEventArgs(int.Parse(update[1].ToString()), int.Parse(update[2].ToString())));
                break;
            }
            }
        }
Ejemplo n.º 6
0
        private void ParseUpdate(object[] update)
        {
            switch (short.Parse(update[0].ToString()))
            {
                case 0:
                    {
                        // user delete a message
                        this.OnMessageDeleted(new VkEventArgs(int.Parse(update[1].ToString())));
                        break;
                    }

                case 1:
                    {
                        // message flags changed
                        var messageStatus = new MessageStatus();
                        messageStatus.ParseStatus(int.Parse(update[2].ToString()));
                        this.OnFlagsChangedEvent(new VkFlagsEventArgs(int.Parse(update[1].ToString()), messageStatus));
                        break;
                    }

                case 2:
                    {
                        // set up message flags
                        var messageStatus = new MessageStatus(int.Parse(update[2].ToString()));
                        this.OnNewFlagsEvent(new VkFlagsEventArgs(int.Parse(update[1].ToString()), messageStatus));
                        break;
                    }

                case 3:
                    {
                        // reset message flags
                        var messageStatus = new MessageStatus(int.Parse(update[2].ToString()));
                        this.OnResetFlagsEvent(new VkFlagsEventArgs(int.Parse(update[1].ToString()), messageStatus));
                        break;
                    }

                case 4:
                    {
                        // new message
                        var messageStatus = new MessageStatus(int.Parse(update[2].ToString()));
                        this.OnNewMessageEvent(new VkMessageEventArgs(
                            int.Parse(update[1].ToString()),
                            messageStatus,
                            int.Parse(update[3].ToString()),
                            new DateTime(long.Parse(update[4].ToString())),
                            update[5].ToString(),
                            update[6].ToString(),
                            update[7] as Dictionary<string, string>));
                        break;
                    }

                case 8:
                    {
                        // user online
                        this.OnUserOnlineEvent(new VkEventArgs(int.Parse(update[1].ToString())));
                        break;
                    }

                case 9:
                    {
                        // user offline
                        this.OnUserOfflineEvent(new VkUserOfflineEventArgs(int.Parse(update[1].ToString()), int.Parse(update[2].ToString())));
                        break;
                    }

                case 51:
                    {
                        // convension params changed
                        this.OnConvensionParamsChangedEvent(new VkConvensionParamsChangedEventArgs(int.Parse(update[1].ToString()), update[2].ToString()));
                        break;
                    }

                case 61:
                    {
                        // start typing in dialog
                        this.OnUserTypingEvent(new VkEventArgs(int.Parse(update[1].ToString())));
                        break;
                    }

                case 62:
                    {
                        // start typing in convension
                        this.OnUserTypingInConvensionEvent(new VkChatEventArgs(int.Parse(update[1].ToString()), int.Parse(update[2].ToString())));
                        break;
                    }

                case 70:
                    {
                        // user make call
                        this.OnUserMakeCallEvent(new VkCallEventArgs(int.Parse(update[1].ToString()), int.Parse(update[2].ToString())));
                        break;
                    }
            }
        }