public SetMode(Menu _menu, CWindow window)
        {
            InitializeComponent();
            this.menu = _menu;

            this.parentWindow = window;
            this.lblName.Text = window.ChatName;
            ImportReplyModes();
        }
        private void CheckForNewChat(IReadOnlyCollection<IWebElement> elemChatWindows)
        {
            for (int i = 0; i < elemChatWindows.Count; i++) {
                string sID = GetProfileLink(elemChatWindows.ElementAt(i));

                if (sID == null) {
                    continue;
                }
                if (!windows.ContainsKey(sID)) {
                    CWindow window = new CWindow(this, replier.Whitelist, elemChatWindows.ElementAt(i));
                    window.SetReplyMode(new CInherit());
                    window.ChatMsgReceived += window_ChatMsgReceived;

                    CDebug.Print("Added a new chat: " + window.ChatName, ConsoleColor.Green);
                    windows.Add(sID, window);
                    if (ChatAdded != null) {
                        ChatAdded(window);
                    }
                    this.replier.ChatAdded_(window);
                }
            }
        }
 public virtual void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
 }
 public virtual void Initialize(CWindow window)
 {
 }
 public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
     chatMaster.SendMessageToWindow(window, GetInsult());
     base.Reply(chatMaster, window, message);
 }
 public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
     chatMaster.SendMessageToWindowNoSend(window, "AAA");
     base.Reply(chatMaster, window, message);
 }
        public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
        {
            string msg = message.Message.ToLower().Trim();
            RPS _r = RPS.Paper;

            if (msg.StartsWith("rock")) {
                _r = RPS.Rock;
            } else if (msg.StartsWith("paper")) {
                _r = RPS.Paper;
            } else if (msg.StartsWith("scissors")) {
                _r = RPS.Scissors;
            } else {
                chatMaster.SendMessageToWindow(window, "Hi, " + window.ChatName + ". I'm not available right now; but how about some rock, paper scissors? You can go first!");
                return;
            }

            Random r = new Random();
            RPS r1 = (RPS)r.Next(0, 2);
            chatMaster.SendMessageToWindow(window, "I chose " + r1.ToString());

            int iWinner = Logic(_r, r1);
            switch (iWinner) {
                case -1:
                    chatMaster.SendMessageToWindow(window, "Looks like that was a draw!");
                    break;

                case 0:
                    chatMaster.SendMessageToWindow(window, "Looks like I won that one!!! :D");
                    break;

                case 1:
                    chatMaster.SendMessageToWindow(window, "Ok, you won that one. :/");
                    break;
            }

            base.Reply(chatMaster, window, message);
        }
Exemple #8
0
 private void autoreplier_ChatRemoved(CWindow window)
 {
     ImportUsers();
 }
 public void ChatMsgReceived_(CWindow window, CMessage message)
 {
     if (this.ChatMessageReceived != null) {
         this.ChatMessageReceived(window, message);
     }
 }
 public void WhitelistUser(CWindow window)
 {
     WhitelistUser(window.ChatName, window.ProfileLink);
 }
 public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
     chatMaster.ParentReplyMode.Reply(chatMaster, window, message);
     base.Reply(chatMaster, window, message);
 }
 public void SyncReplyMode(CWindow window)
 {
     window.SetReplyMode(chatMaster.ParentReplyMode);
 }
 public void ChatRemoved_(CWindow window)
 {
     if (this.ChatRemoved != null) {
         this.ChatRemoved(window);
     }
 }
 private void window_ChatMsgReceived(CWindow window, CMessage message)
 {
     CDebug.Print("Chat message from " + window.ChatName + ", at " +
         message.TimeReceived + ": " + message.Message, ConsoleColor.DarkGray);
     this.replier.ChatMsgReceived_(window, message);
 }
        public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
        {
            char[] strArray = message.Message.ToArray();
            Array.Reverse(strArray);

            string strReversed = new string(strArray);
            chatMaster.SendMessageToWindow(window, strReversed);
            base.Reply(chatMaster, window, message);
        }
 public void SendMessageToWindowNoSend(CWindow window, string sMessage)
 {
     process.Process(new CTypeMessage(driver, window, new CMessage(sMessage, null, null)));
 }
Exemple #17
0
 private void autoreplier_ChatMessageReceived(CWindow window, CMessage message)
 {
     // TODO: Is this necessary?
 }