Пример #1
0
        /// <summary>
        /// Возвращает словарь параметров.
        /// </summary>
        public override Dictionary <string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            parameters["chat_id"] = ChatID.ToString();
            parameters["title"]   = Title;

            return(parameters);
        }
Пример #2
0
        /// <summary>
        /// Возвращает словарь параметров.
        /// </summary>
        public override Dictionary <string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            if (ChatID != 0)
            {
                parameters["chat_id"] = ChatID.ToString();
            }
            if (UserID != 0)
            {
                parameters["user_id"] = UserID.ToString();
            }

            return(parameters);
        }
Пример #3
0
        /// <summary>
        /// Возвращает словарь параметров.
        /// </summary>
        public override Dictionary <string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            if (ChatID != 0)
            {
                parameters["chat_id"] = ChatID.ToString();
            }
            else if (UserID != 0)
            {
                parameters["user_id"] = UserID.ToString();
            }
            else
            {
                parameters["domain"] = Domain;
            }
            if (UserIDs != null && UserIDs.Count != 0)
            {
                parameters["user_ids"] = String.Join(",", UserIDs);
            }
            if (!String.IsNullOrWhiteSpace(Message))
            {
                parameters["message"] = Message;
            }
            //if (@Guid != 0) parameters["guid"] = @Guid.ToString();
            if (Lat != null)
            {
                parameters["lat"] = Lat;
            }
            if (Long != null)
            {
                parameters["long"] = Long;
            }
            if (Attachment != null && Attachment.Count != 0)
            {
                parameters["attachment"] = String.Join(",", Attachment);
            }
            if (ForwardMessages != null && ForwardMessages.Count != 0)
            {
                parameters["forward_messages"] = String.Join(",", ForwardMessages);
            }
            if (StickerID != 0)
            {
                parameters["sticker_id"] = StickerID.ToString();
            }

            return(parameters);
        }
Пример #4
0
        /// <summary>
        /// Отправляет сообщение в беседу.
        /// </summary>
        private async Task SendMessage()
        {
            var text = EnteredText.Trim();

            EnteredText = String.Empty;
            var msg = new VKMessage
            {
                Body        = text,
                Date        = DateTime.Now,
                ChatID      = IsChat ? ChatID : 0,
                UserID      = ServiceHelper.SettingsService.AccessToken.UserID,
                Type        = VKMessageType.Sent,
                SentType    = VKSentMessageType.Sending,
                Attachments = Attachments.ToList()
            };

            Messages.Insert(0, msg);
            Messages.NewSentMessages.Add(msg);

            var param = new Dictionary <string, string>();

            param["message"] = text;

            if (IsChat)
            {
                param["chat_id"] = ChatID.ToString();
            }
            else
            {
                param["user_id"] = UserID.ToString();
            }

            var request  = new UniversalVKRequest <ulong>(VKMethodsConstants.MessageSend, param);
            var response = await request.ExecuteAsync();

            if (response.Error.ErrorType == VKErrors.None)
            {
                msg.ID       = response.Response;
                msg.SentType = VKSentMessageType.Unread;
            }
            else
            {
                msg.SentType = VKSentMessageType.Error;
            }
        }
Пример #5
0
        /// <summary>
        /// Возвращает коллекцию параметров.
        /// </summary>
        public override Dictionary <string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            parameters["chat_id"] = ChatID.ToString();
            if (X != 0)
            {
                parameters["crop_x"] = X.ToString();
            }
            if (Y != 0)
            {
                parameters["crop_y"] = Y.ToString();
            }
            if (Width != 0)
            {
                parameters["crop_width"] = Width.ToString();
            }

            return(parameters);
        }
Пример #6
0
        /// <summary>
        /// Возвращает словарь параметров.
        /// </summary>
        public override Dictionary<string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            if (IsSingle)
                parameters["chat_id"] = ChatID.ToString();
            else
                parameters["chat_ids"] = String.Join(",", ChatIDs);
            if (NameCase != VKUserNameCase.nom)
                parameters["name_case"] = NameCase.ToString();
            if (Fields == null) parameters["fields"] = VKMethodsConstants.ExtendedProfileFields;
            else
            {
                var builder = new StringBuilder();
                for (int i = 0; i < Fields.Count; i++)
                    builder.Append(Fields[i] + ",");
                parameters["fields"] = builder.ToString();
            }

            return parameters;
        }