• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ChatMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ChatMessage的典型用法代码示例。如果您正苦于以下问题:C# ChatMessage类的具体用法?C# ChatMessage怎么用?C# ChatMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChatMessage类属于命名空间,在下文中一共展示了ChatMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: btnSendMessage_Click_1

        private void btnSendMessage_Click_1(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(tbChatMessage.Text))
            {
                string bericht = tbChatMessage.Text;
                DateTime datum = DateTime.Now;

                if (lbChatVrijwilligers.SelectedItem != null)
                {
                    foreach (Vrijwilliger vw in AccountHandler.Vrijwilligers)
                    {
                        if (vw.ToString() == (string)lbChatVrijwilligers.SelectedItem)
                        {
                            DatabaseHandler.AddChatMessage(bericht, datum, 2, vw.Id);
                            ChatMessage chatMessage = new ChatMessage(bericht, datum);
                            HelpHandler.AddChatMessage(chatMessage);
                            lbChatMessage.Items.Add(chatMessage.ToString());
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Vul een chatbericht in");
            }
        }
开发者ID:WesleyI,项目名称:ICT4Participation,代码行数:26,代码来源:HelpbehoevendeForm.cs


示例2: ProcessCommand

        public override async Task<bool> ProcessCommand(ChatMessage msg, string command)
        {
            if (IsFriendshipCannonRunning)
                return false;

            IsFriendshipCannonRunning = true;

            _msg = msg;

            await SendMessage("Orbital Friendship Cannon - Online");

            await Task.Delay(TimeSpan.FromMilliseconds(3000));

            await SendMessage("Acquiring Target...");

            await Task.Delay(TimeSpan.FromMilliseconds(2000));

            await SendMessage("Target Locked");

            await Task.Delay(TimeSpan.FromMilliseconds(2000));

            await SendMessage("Firing : " + "http://www.allmystery.de/i/t1ce2b1_FiringOrbitalFriendshipCannon.gif?bc");

            int asdf = 3;

            IsFriendshipCannonRunning = false;

            //Timer t = new Timer(AcquireTarget, 5, 0, 8000);

            return true;
        }
开发者ID:Nagato23,项目名称:LunaSkypeBot,代码行数:31,代码来源:FriendshipCannonCommand.cs


示例3: GetRelativeEntries

			public IList<ChatMessage> GetRelativeEntries (ChatMessage message, int entriesBefore, int entriesAfter)
			{
				IEnumerable<ChatMessage> result = null;

				lock (this) {
					if (0 != entriesBefore) {
						IEnumerable<ChatMessage> beforeResult = this.Query<ChatMessage> (@"SELECT * FROM ? ORDER BY When, _id DESC LIMIT ? WHERE When <= ? AND _id != ?", tableName, entriesBefore, message.When.Ticks, message.Id);

						result = beforeResult.Reverse ();
					}

					if (0 != entriesAfter) {
						IEnumerable<ChatMessage> afterResult = this.Query<ChatMessage> (@"SELECT * FROM ? ORDER BY When, _id ASC LIMIT ? WHERE When >= ? AND _id != ?", tableName, entriesAfter, message.When.Ticks, message.Id);
						if (null == result)
							return afterResult.ToList ();

						return result.Concat (afterResult).ToList ();
					}

					if (null != result) {
						return result.ToList ();
					}
				}

				return new List<ChatMessage> ();
			}
开发者ID:SeanmanX,项目名称:opandroid,代码行数:26,代码来源:ChatMessageDatabase.cs


示例4: Any

        public object Any(PostChatToChannel request)
        {
            var sub = ServerEvents.GetSubscriptionInfo(request.From);
            if (sub == null)
                throw HttpError.NotFound("Subscription {0} does not exist".Fmt(request.From));

            var msg = new ChatMessage
            {
                Id = Interlocked.Increment(ref msgId),
                FromUserId = sub.UserId,
                FromName = sub.DisplayName,
                Message = request.Message,
            };

            if (request.ToUserId != null)
            {
                msg.Private = true;
                ServerEvents.NotifyUserId(request.ToUserId, request.Selector, msg);
                var toSubs = ServerEvents.GetSubscriptionInfosByUserId(request.ToUserId);
                foreach (var toSub in toSubs)
                {
                    msg.Message = "@{0}: {1}".Fmt(toSub.DisplayName, msg.Message);
                    ServerEvents.NotifySubscription(request.From, request.Selector, msg);
                }
            }
            else
            {
                ServerEvents.NotifyChannel(request.Channel, request.Selector, msg);
            }

            return msg;
        }
开发者ID:permadiwibisono,项目名称:Test,代码行数:32,代码来源:Program.cs


示例5: _OnMessageReceived

 private static void _OnMessageReceived(ChatMessage pMessage, TChatMessageStatus status)
 {
     if ((status == TChatMessageStatus.cmsReceived || status == TChatMessageStatus.cmsSent) && pMessage.ChatName.IndexOf(_SkypeChatUniqueCode) >= 0)
     {
         SlackSender.SendMessage("*" + (String.IsNullOrEmpty(pMessage.Sender.DisplayName) ? _BotSkypeName : pMessage.Sender.DisplayName) + "* : " + pMessage.Body);
     }
 }
开发者ID:vladdy-moses,项目名称:Integration-Bot-of-Skype-and-Slack,代码行数:7,代码来源:SkypeManager.cs


示例6: ChatItem

        public ChatItem(ChatMessage chat)
            : base()
        {
            this.messageLabel = new Label();
            this.timeLabel = new Label();

            this.AutoSize = true;
            this.setAppearance(chat.IsDoctor);
            this.Controls.Add(this.messageLabel);
            this.Controls.Add(this.timeLabel);
            this.MinimumSize = new System.Drawing.Size(150, 60);
            this.Name = "messageContainer";
            this.Padding = new System.Windows.Forms.Padding(6);

            //
            // Message Label
            //
            this.messageLabel.AutoSize = true;
            this.messageLabel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.messageLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.messageLabel.Location = new System.Drawing.Point(6, 6);
            this.messageLabel.MaximumSize = new System.Drawing.Size(250, 0);
            this.messageLabel.Size = new System.Drawing.Size(121, 20);
            this.messageLabel.Text = chat.Message.Replace("\n", "");
            //
            // Time Label
            //
            this.timeLabel.AutoSize = true;
            this.timeLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.timeLabel.Font = new System.Drawing.Font("Segoe UI Semilight", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.timeLabel.Location = new System.Drawing.Point(6, 26);
            this.timeLabel.Margin = new System.Windows.Forms.Padding(6);
            this.timeLabel.Size = new System.Drawing.Size(32, 13);
            this.timeLabel.Text = Helper.MillisecondsToTime(chat.TimeStamp);
        }
开发者ID:kennyboy55,项目名称:ErgometerIPR,代码行数:35,代码来源:ChatItem.cs


示例7: SkypeOnMessageStatus

 /// <summary>
 /// The skype on message status.
 /// </summary>
 /// <param name="chatMessage">
 /// The chat message.
 /// </param>
 /// <param name="status">
 /// The status.
 /// </param>
 private void SkypeOnMessageStatus(ChatMessage chatMessage, TChatMessageStatus status)
 {
     if (chatMessage.Body.StartsWith("!mail"))
     {
         chatMessage.Chat.SendMessage("mailer called.");
     }
 }
开发者ID:pjmagee,项目名称:Skypnet,代码行数:16,代码来源:MailerSkypnetModule.cs


示例8: IsAdmin

        public bool IsAdmin(ChatMessage msg)
        {
            if (ConfigManager.GlobalConfig.GlobalAdmins.Contains(msg.Sender.Handle.ToLowerInvariant()))
                return true;

            return false;
        }
开发者ID:natfoth,项目名称:LunaSkypeBot,代码行数:7,代码来源:CommandProcessor.cs


示例9: ProcessCommand

        public override async Task<bool> ProcessCommand(ChatMessage msg, string command)
        {
            var searchMessage = msg.SendBotMessage("Searching....");

            var searchTerms = "";

            if (command.StartsWith("s "))
                searchTerms = command.Remove(0, 1).Trim();
            else
            {
                searchTerms = command.Remove(0, 6).Trim();
            }


            var result = DatabaseManager.GetRandomImageSearch(searchTerms);

            if(result.Length == 0)
                searchMessage.EditMessage("No Results Found");
            else
            {
                searchMessage.EditMessage(result);
            }

            return true;
        }
开发者ID:natfoth,项目名称:LunaSkypeBot,代码行数:25,代码来源:SearchCommand.cs


示例10: ShowAsync

        /// <summary>
        /// Shows the Messaging application, using the specified recipient list and message body.
        /// </summary>
        /// <param name="recipient">The recipient list for the new SMS message.</param>
        /// <param name="body">The body text of the new SMS message.</param>
        /// <returns>The <see cref="Task"/> object representing the asynchronous operation.</returns>
        public async Task ShowAsync(string recipient, string body)
        {
#if WINDOWS_PHONE
            new SmsComposeTask()
            {
                To = recipient,
                Body = body
            }.Show();

            await Task.FromResult(0);
#elif WINDOWS_PHONE_APP
            var chatMessage = new ChatMessage
            {
                Body = body
            };

            chatMessage.Recipients.Add(recipient);

            await ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
#else
            var smsUrl = "sms:" + Uri.EscapeDataString(recipient);

            if (!string.IsNullOrEmpty(body))
            {
                smsUrl += "?body=" + Uri.EscapeDataString(body);
            }

            await Launcher.LaunchUriAsync(new Uri(smsUrl, UriKind.Absolute));
#endif
        }
开发者ID:kira409908735,项目名称:Cimbalino-Toolkit,代码行数:36,代码来源:SmsComposeService.cs


示例11: ProcessCommand

        public override async Task<bool> ProcessCommand(ChatMessage msg, string command)
        {
           // var chatHandler = msg.

            ChatClass chat = (ChatClass) msg.Chat;

            var chatname = chat.Name;

            var list = ConfigManager.GlobalConfig.LunaOfTheDayList;

            if (list.Contains(chatname))
            {
                ConfigManager.GlobalConfig.LunaOfTheDayList.Remove(chatname);
                msg.SendBotMessage("Removed from the Luna Of The Day List");
            }
            else
            {
                ConfigManager.GlobalConfig.LunaOfTheDayList.Add(chatname);
                msg.SendBotMessage("Registered to the Luna Of The Day List");
            }

            ConfigManager.GlobalConfig.Save();

            return true;
        }
开发者ID:natfoth,项目名称:LunaSkypeBot,代码行数:25,代码来源:LunaOfTheDayCommand.cs


示例12: Main

        public static void Main()
        {
            // Client2 client = new Client2();
              //  client.sendText("this should be printed and also returned");

            User from = new User();
            User to = new User();

            from.id = 1;
            from.name = "test1";

            from.password = "meh";

            to.id = 2;
            to.name = "test2";
            to.password = "qwe";

            ChatMessage msg = new ChatMessage();
            msg.from = from;
            msg.to = to;
            msg.content = "Hello";
            msg.toXml();
            //System.Console.Write("{0}",msg.toXml());
            System.Console.ReadKey();
        }
开发者ID:wike,项目名称:ChatSystem,代码行数:25,代码来源:Program.cs


示例13: ProcessCommand

        public override async Task<bool> ProcessCommand(ChatMessage msg, string command)
        {
            var parameter = GetParameter(command);
            var secondary = GetSecondaryParameter(command);

            int newAccessLevel;
            if (!int.TryParse(secondary, out newAccessLevel))
            {
                msg.SendBotMessage("Failed to parse new Access Level : ( " + secondary + " )" + " - For the user : ( " + parameter + " )");
                return true;
            }


            if (!ConfigManager.Config.AccessLevels.ContainsKey(parameter.ToLowerInvariant()))
            {
                ConfigManager.Config.AccessLevels.Add(parameter.ToLowerInvariant(), newAccessLevel);
            }
            else
            {
                ConfigManager.Config.AccessLevels[parameter.ToLowerInvariant()] = newAccessLevel;
            }

            msg.SendBotMessage("Set the Access Level for the User : ( " + parameter + " )" + " - To Level : ( " + newAccessLevel + " )");

            ConfigManager.Config.Save();

            // msg.SendBotMessage("Adding Quote : \"" + quoteToAdd + "\" - To Pony (" + pony + ")");

            return true;
        }
开发者ID:natfoth,项目名称:LunaSkypeBot,代码行数:30,代码来源:SetPermissionsCommand.cs


示例14: ProcessCommand

        public override async Task<bool> ProcessCommand(ChatMessage msg, string command)
        {

            msg.SendBotMessage(GetRandomCelestiaPic());

            return true;
        }
开发者ID:Nagato23,项目名称:LunaSkypeBot,代码行数:7,代码来源:CelestiaCommand.cs


示例15: ProcessCommand

        public override async Task<bool> ProcessCommand(ChatMessage msg, string command)
        {
            var files = Directory.GetFiles("G:\\Dropbox\\Public\\Pics\\pony", "*", SearchOption.AllDirectories).ToList();
            if (files.Count == 0)
                return true;

            //files = Directory.GetFiles("G:\\Dropbox\\Public\\Pics\\pony\\Luna\\NSFW", "*", SearchOption.AllDirectories).ToList();

            var random = new LunaRandom();

            var file = files[random.Next(files.Count)];

            var dropboxLink = await Utils.GetDropboxLinkForFilePath(file);

            bool nsfw = false;

            if (ConfigManager.Config.SFWOnly)
            {
                while (dropboxLink.Contains(@"/nsfw/"))
                    dropboxLink = await Utils.GetDropboxLinkForFilePath(file);
            }

            if (dropboxLink.Contains(@"/nsfw/", StringComparison.OrdinalIgnoreCase))
                nsfw = true;


            if(nsfw)
                msg.SendBotMessage("NSFW : " + dropboxLink);
            else
                msg.SendBotMessage(dropboxLink);

            return true;
        }
开发者ID:natfoth,项目名称:LunaSkypeBot,代码行数:33,代码来源:RandomCommand.cs


示例16: SetPersonalInfo

 public void SetPersonalInfo(ChatMessage chatInfo)
 {
     this.mChatInfo = chatInfo;
     if (this.mChatInfo != null)
     {
         this.mSb.Remove(0, this.mSb.Length).Append("Lv").Append(chatInfo.Level).Append(" ").Append(chatInfo.Name);
         this.mNameLabel.text = this.mSb.ToString();
         if (string.IsNullOrEmpty(chatInfo.GuildName))
         {
             this.mGuildNameLabel.text = Singleton<StringManager>.Instance.GetString("chatTxt10");
         }
         else
         {
             this.mGuildNameLabel.text = chatInfo.GuildName;
         }
         this.mIcon.spriteName = Tools.GetPlayerIcon(this.mChatInfo.FashionID);
         this.mQualityMask.spriteName = Tools.GetItemQualityIcon(LocalPlayer.GetQuality(this.mChatInfo.ConstellationLevel));
         FriendData friendData = Globals.Instance.Player.FriendSystem.GetFriendData(this.mChatInfo.PlayerID);
         if (friendData != null)
         {
             this.friendType = friendData.FriendType;
         }
         bool flag = friendData != null && friendData.FriendType == 1;
         bool flag2 = friendData != null && friendData.FriendType == 2;
         this.mBacklistLabel.text = Singleton<StringManager>.Instance.GetString((!flag2) ? "friend_25" : "friend_26");
         this.mFriendLabel.text = Singleton<StringManager>.Instance.GetString((!flag) ? "friend_27" : "friend_28");
     }
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:28,代码来源:GUIPersonalInfoLayerV2F.cs


示例17: AddMessage

 internal void AddMessage(ChatMessage msg)
 {
     lock (messages) {
         messages.Enqueue(msg);
         while (messages.Count > 10) messages.Dequeue();
     }
 }
开发者ID:zzattack,项目名称:TwitchChat,代码行数:7,代码来源:ChatControl.cs


示例18: OnChatMessage

        public override void OnChatMessage(ChatMessage c)
        {
            if (State == MeterState.Stopped)
              {
            return;
              }

              if (c.IsCombat)
              {
            CombatMessage msg = c as CombatMessage;

            if (msg.CombatType == CombatLogType.DamageDone)
            {

              if (String.Compare(msg.Damage.Target, target, true) == 0 ||
              String.IsNullOrEmpty(target) )
              {
            damagedone += msg.Damage.Points;
            if (State != MeterState.Running)
            { // change state to running since we hit our target
              State = MeterState.Running;
            }
              }
            }
            else if (msg.CombatType == CombatLogType.TargetKilled)
            {
              // Stop if our target was killed.
              if (String.Compare(msg.Target, target, true) == 0)
              {
            Stop();
              }
            }
              }
        }
开发者ID:n0la,项目名称:dclog,代码行数:34,代码来源:AverageTargetMeter.cs


示例19: ShowAsync

        /// <summary>
        /// Shows the Messaging application, using the specified recipient list and message body.
        /// </summary>
        /// <param name="recipient">The recipient list for the new SMS message.</param>
        /// <param name="body">The body text of the new SMS message.</param>
        /// <returns>The <see cref="Task"/> object representing the asynchronous operation.</returns>
        public virtual Task ShowAsync(string recipient, string body)
        {
#if WINDOWS_PHONE || WINDOWS_PHONE_81
            new SmsComposeTask()
            {
                To = recipient,
                Body = body
            }.Show();

            return Task.FromResult(0);
#elif WINDOWS_PHONE_APP || WINDOWS_UWP
            var chatMessage = new ChatMessage
            {
                Body = body
            };

            if (!string.IsNullOrEmpty(recipient))
            {
                chatMessage.Recipients.Add(recipient);
            }

            return ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage).AsTask();
#else
            var smsUri = new UriBuilder("sms:")
               .SetPath(recipient)
               .AppendQueryParameterIfValueNotEmpty("body", body)
               .Uri;

            return Launcher.LaunchUriAsync(smsUri).AsTask();
#endif
        }
开发者ID:Cimbalino,项目名称:Cimbalino-Toolkit,代码行数:37,代码来源:SmsComposeService.cs


示例20: setMessageHistorySize

 public void setMessageHistorySize(int newSize)
 {
     //messageHistory = newSize;
     messages = new ChatMessage[newSize];
     for (int i = 0; i < messages.Length; i++) {
         messages[i] = new ChatMessage();
     }
 }
开发者ID:MilesAway1980,项目名称:Battle-Action,代码行数:8,代码来源:ChatMessage.cs



注:本文中的ChatMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ChatSourceType类代码示例发布时间:2022-05-24
下一篇:
C# ChatLanguage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap