Параметры метода messages.send
Ejemplo n.º 1
0
        /*
         * private void InitMessagesListView()
         * {
         *  MessagesListView.OwnerDraw = true;
         *  MessagesListView.HeaderStyle = ColumnHeaderStyle.Nonclickable;
         *  MessagesListView.RowHeight = 50;
         *
         *  //Creating the columns
         *  BrightIdeasSoftware.OLVColumn PictureColumn = new BrightIdeasSoftware.OLVColumn();
         *  BrightIdeasSoftware.OLVColumn TitleColumn = new BrightIdeasSoftware.OLVColumn();
         *  BrightIdeasSoftware.OLVColumn TextColumn = new BrightIdeasSoftware.OLVColumn();
         *  BrightIdeasSoftware.OLVColumn DateColumn = new BrightIdeasSoftware.OLVColumn();
         *
         *  //Adding the columns to the Objectlistview
         *  MessagesListView.AllColumns.Add(PictureColumn);
         *  MessagesListView.AllColumns.Add(TitleColumn);
         *  MessagesListView.AllColumns.Add(TextColumn);
         *  MessagesListView.AllColumns.Add(DateColumn);
         *
         *  //Directing the columns to the correct variable names.
         *
         *
         *  PictureColumn.AspectName = "Image";
         *  TitleColumn.AspectName = "Name";
         *  TextColumn.AspectName = "Text";
         *  DateColumn.AspectName = "Date";
         *
         *
         *  //Setting the header Title on each column
         *  PictureColumn.Text = "Image";
         *  TitleColumn.Text = "Name";
         *  TextColumn.Text = "Text";
         *  DateColumn.Text = "Date"; ;
         *  //Set the columns to fill the width of the objectlistview
         *
         *  // PictureColumn.FillsFreeSpace = true;
         *  //TitleColumn.FillsFreeSpace = true;
         *
         *  TextColumn.WordWrap = true;
         *
         *  TitleColumn.WordWrap = true;
         *  TextColumn.FillsFreeSpace = true;
         *
         *
         *  DateColumn.AspectToStringConverter = delegate (object x)
         *  {
         *      DateTime t = (DateTime)x;
         *      t = t.AddHours(3);
         *      var now = DateTime.Now;
         *      var difference = now.Subtract(t);
         *
         *      if (difference.Days == 0)
         *      {
         *          return t.ToShortTimeString();
         *      }
         *      else if (t.Year <= now.Year)
         *      {
         *          return t.Day.ToString() + "." + t.ToString("MMM");
         *      }
         *      else
         *      {
         *          return t.Date.ToString();
         *      }
         *  };
         * }*/
        private void ButtonSendDialog_Click(object sender, EventArgs e)
        {
            var Params = new VkNet.Model.RequestParams.MessagesSendParams();

            Params.Message  = RichTextBoxDialog.Text;
            Params.RandomId = new Random().Next();
            Params.PeerId   = D.Context.ActiveChat.Conv.Peer.LocalId;
            var Msg = D.api.Messages.Send(Params);

            RichTextBoxDialog.Clear();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p">Параметры.</param>
 /// <returns></returns>
 internal static VkParameters ToVkParameters(MessagesSendParams p)
 {
     return(new VkParameters
     {
         { "user_id", p.UserId },
         { "domain", p.Domain },
         { "chat_id", p.ChatId },
         { "user_ids", p.UserIds },
         { "message", HttpUtility.UrlEncode(p.Message) },
         { "random_id", p.RandomId },
         { "lat", p.Lat },
         { "long", p.Longitude },
         { "attachment", p.Attachments },
         { "forward_messages", p.ForwardMessages },
         { "sticker_id", p.StickerId },
         { "captcha_sid", p.CaptchaSid },
         { "captcha_key", p.CaptchaKey },
         { "peer_id", p.PeerId }
     });
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p">Параметры.</param>
 /// <returns></returns>
 public static VkParameters ToVkParameters(MessagesSendParams p)
 {
     return(new VkParameters
     {
         { "user_id", p.UserId },
         { "domain", p.Domain },
         { "chat_id", p.ChatId },
         { "user_ids", p.UserIds },
         { "message", WebUtilityHelper.UrlEncode(p.Message) },
         { "random_id", p.RandomId },
         { "lat", p.Lat?.ToString("0.000000", System.Globalization.CultureInfo.InvariantCulture) },
         { "long", p.Longitude?.ToString("0.000000", System.Globalization.CultureInfo.InvariantCulture) },
         { "attachment", p.Attachments },
         { "forward_messages", p.ForwardMessages },
         { "sticker_id", p.StickerId },
         { "captcha_sid", p.CaptchaSid },
         { "captcha_key", p.CaptchaKey },
         { "peer_id", p.PeerId }
     });
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p"> Параметры. </param>
 /// <returns> </returns>
 public static VkParameters ToVkParameters(MessagesSendParams p)
 {
     return(new VkParameters
     {
         { "user_id", p.UserId }
         , { "domain", p.Domain }
         , { "chat_id", p.ChatId }
         , { "user_ids", p.UserIds }
         , { "message", p.Message }
         , { "random_id", p.RandomId }
         , { "lat", p.Lat }
         , { "long", p.Longitude }
         , { "attachment", p.Attachments }
         , { "forward_messages", p.ForwardMessages }
         , { "keyboard", p.Keyboard != null?JsonConvert.SerializeObject(p.Keyboard) : "" }
         , { "sticker_id", p.StickerId }
         , { "captcha_sid", p.CaptchaSid }
         , { "captcha_key", p.CaptchaKey }
         , { "peer_id", p.PeerId }
     });
 }
Ejemplo n.º 5
0
        public long Send(
            long id,
            bool isChat,
            string message,
            string title = "",
            MediaAttachment attachment = null,
            IEnumerable<long> forwardMessagedIds = null,
            bool fromChat = false,
            double? latitude = null,
            double? longitude = null,
            long? randomId = null,
            long? captchaSid = null,
            string captchaKey = null)
        {
            var parameters = new MessagesSendParams
            {
                UserId = (isChat ? (long?)null : id),
                Message = message,
                ForwardMessages = forwardMessagedIds,
                Lat = latitude,
                Attachments = attachment == null ? null : new List<MediaAttachment> { attachment },
                RandomId = randomId,
                CaptchaKey = captchaKey,
                CaptchaSid = captchaSid,
                Longitude = longitude,
                ChatId = (isChat ? (long?)null : id)
            };

            return Send(parameters);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p">Параметры.</param>
 /// <returns></returns>
 public static VkParameters ToVkParameters(MessagesSendParams p)
 {
     return new VkParameters
     {
         { "user_id", p.UserId },
         { "domain", p.Domain },
         { "chat_id", p.ChatId },
         { "user_ids", p.UserIds },
         { "message", WebUtilityHelper.UrlEncode(p.Message) },
         { "random_id", p.RandomId },
         { "lat", p.Lat?.ToString("0.000000", System.Globalization.CultureInfo.InvariantCulture) },
         { "long", p.Longitude?.ToString("0.000000", System.Globalization.CultureInfo.InvariantCulture) },
         { "attachment", p.Attachments },
         { "forward_messages", p.ForwardMessages },
         { "sticker_id", p.StickerId },
         { "captcha_sid", p.CaptchaSid },
         { "captcha_key", p.CaptchaKey },
         { "peer_id", p.PeerId }
     };
 }
Ejemplo n.º 7
0
		/// <summary>
		/// Привести к типу VkParameters.
		/// </summary>
		/// <param name="p">Параметры.</param>
		/// <returns></returns>
		internal static VkParameters ToVkParameters(MessagesSendParams p)
		{
			return new VkParameters
			{
				{ "user_id", p.UserId },
				{ "domain", p.Domain },
				{ "chat_id", p.ChatId },
				{ "user_ids", p.UserIds },
				{ "message", HttpUtility.UrlEncode(p.Message) },
				{ "guid", p.Guid },
				{ "lat", p.Lat },
				{ "long", p.Longitude },
				{ "attachment", p.Attachments },
				{ "forward_messages", p.ForwardMessages },
				{ "sticker_id", p.StickerId },
				{ "captcha_sid", p.CaptchaSid },
				{ "captcha_key", p.CaptchaKey },
				{ "peer_id", p.PeerId }
			};
		}