当前位置: 首页>>代码示例>>C#>>正文


C# ChatMessage类代码示例

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


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


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