예제 #1
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        public void MyPMCreateOrShowTab(String name)
        {
            for (int i = 0; i < this.tabControl1.TabPages.Count; i++)
            {
                if (this.tabControl1.TabPages[i] is PMTab)
                {
                    if (this.tabControl1.TabPages[i].Text == name)
                    {
                        this.tabControl1.SelectedIndex = i;
                        return;
                    }
                }
            }

            PMTab new_tab = new PMTab(name, this.EndPoint);

            if (this.IsBlack)
            {
                new_tab.SetToBlack();
            }

            new_tab.HashlinkClicked     += this.LinkHashlinkClicked;
            new_tab.EditScribbleClicked += this.DoEditScribbleClicked;
            new_tab.ImageIndex           = 1;
            this.tabControl1.TabPages.Add(new_tab);
            this.tabControl1.SelectedIndex = (this.tabControl1.TabPages.Count - 1);
        }
예제 #2
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (this.Mode == ScreenMode.Main)
            {
                this.CloseClicked(this.EndPoint, EventArgs.Empty);
            }
            else
            {
                int index = this.tabControl1.SelectedIndex;

                if (index > 0)
                {
                    this.tabControl1.SelectedIndex = 0;

                    if (this.tabControl1.TabPages[index] is PMTab)
                    {
                        PMTab pm = (PMTab)this.tabControl1.TabPages[index];
                        this.tabControl1.TabPages.RemoveAt(index);
                        pm.HashlinkClicked     -= this.LinkHashlinkClicked;
                        pm.EditScribbleClicked -= this.DoEditScribbleClicked;
                        pm.Free();
                        pm.Dispose();
                        pm = null;
                    }
                    else if (this.tabControl1.TabPages[index] is BrowseTab)
                    {
                        BrowseTab bt = (BrowseTab)this.tabControl1.TabPages[index];
                        this.tabControl1.TabPages.RemoveAt(index);
                        bt.Free();
                        bt.Dispose();
                        bt = null;
                    }
                }
            }
        }
예제 #3
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        public void CloseAllTabs(bool including_main)
        {
            if (including_main)
            {
                this.tabControl1.TabPages.RemoveAt(0);

                while (this.splitContainer1.Panel1.Controls.Count > 0)
                {
                    this.splitContainer1.Panel1.Controls.RemoveAt(0);
                }

                while (this.splitContainer1.Panel2.Controls.Count > 0)
                {
                    this.splitContainer1.Panel2.Controls.RemoveAt(0);
                }

                this.splitContainer1.Dispose();
                this.splitContainer1 = null;

                while (this.tabPage1.Controls.Count > 0)
                {
                    this.tabPage1.Controls.RemoveAt(0);
                }

                this.tabPage1.Dispose();
                this.tabPage1 = null;
                this.userListContainer1.Free();
                this.userListContainer1.Dispose();
                this.userListContainer1 = null;
            }

            // pm and file tabs
            for (int i = (this.tabControl1.TabPages.Count - 1); i > -1; i--)
            {
                if (this.tabControl1.TabPages[i] is PMTab)
                {
                    PMTab pm = (PMTab)this.tabControl1.TabPages[i];
                    this.tabControl1.TabPages.RemoveAt(i);
                    pm.HashlinkClicked     -= this.LinkHashlinkClicked;
                    pm.EditScribbleClicked -= this.DoEditScribbleClicked;
                    pm.Free();
                    pm.Dispose();
                    pm = null;
                }
                else if (this.tabControl1.TabPages[i] is BrowseTab)
                {
                    BrowseTab bt = (BrowseTab)this.tabControl1.TabPages[i];
                    this.tabControl1.TabPages.RemoveAt(i);
                    bt.Free();
                    bt.Dispose();
                    bt = null;
                }
            }
        }
예제 #4
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        internal void PMScribbleReceived(Room room, User user, String name, byte[] data)
        {
            this.tabControl1.BeginInvoke((Action)(() =>
            {
                for (int i = 0; i < this.tabControl1.TabPages.Count; i++)
                {
                    if (this.tabControl1.TabPages[i] is PMTab)
                    {
                        if (this.tabControl1.TabPages[i].Text == name)
                        {
                            PMTab tab = (PMTab)this.tabControl1.TabPages[i];
                            tab.Scribble(data);
                            tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == name);

                            if (!tab.First)
                            {
                                tab.First = true;

                                if (room != null && user != null)
                                {
                                    ScriptEvents.OnPmFirstReceived(room, user);
                                }
                            }

                            return;
                        }
                    }
                }

                PMTab new_tab = new PMTab(name, this.EndPoint);

                if (this.IsBlack)
                {
                    new_tab.SetToBlack();
                }

                new_tab.HashlinkClicked += this.LinkHashlinkClicked;
                new_tab.EditScribbleClicked += this.DoEditScribbleClicked;
                new_tab.ImageIndex = 2;
                this.tabControl1.TabPages.Add(new_tab);
                new_tab.Scribble(data);
                new_tab.First = true;

                if (room != null && user != null)
                {
                    ScriptEvents.OnPmFirstReceived(room, user);
                }
            }));
        }
예제 #5
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        public void UpdateVoiceTime(int seconds)
        {
            if (this.tabControl1.SelectedTab is PMTab)
            {
                PMTab tab = (PMTab)this.tabControl1.SelectedTab;
                tab.UpdateVoiceTime(seconds);
            }
            else if (!(this.tabControl1.SelectedTab is BrowseTab))
            {
                if (seconds == -1)
                {
                    this.writingPanel1.Mode          = WritingPanelMode.Writing;
                    this.writingPanel1.RecordingTime = 0;
                }
                else
                {
                    this.writingPanel1.Mode          = WritingPanelMode.Recording;
                    this.writingPanel1.RecordingTime = seconds;
                }

                this.writingPanel1.Invalidate();
            }
        }
예제 #6
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        public void MyPMJSText(String target, String text, AresFont font)
        {
            if (this.tabControl1.InvokeRequired)
            {
                this.tabControl1.BeginInvoke(new MyPMJSTextHandler(this.MyPMJSText), target, text, font);
            }
            else
            {
                for (int i = 0; i < this.tabControl1.TabPages.Count; i++)
                {
                    if (this.tabControl1.TabPages[i] is PMTab)
                    {
                        if (this.tabControl1.TabPages[i].Text == target)
                        {
                            PMTab tab = (PMTab)this.tabControl1.TabPages[i];
                            tab.PM(this.MyName, text, font);
                            tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == target);
                            return;
                        }
                    }
                }

                PMTab new_tab = new PMTab(target, this.EndPoint);

                if (this.IsBlack)
                {
                    new_tab.SetToBlack();
                }

                new_tab.HashlinkClicked     += this.LinkHashlinkClicked;
                new_tab.EditScribbleClicked += this.DoEditScribbleClicked;
                new_tab.ImageIndex           = 2;
                this.tabControl1.TabPages.Add(new_tab);
                new_tab.PM(this.MyName, text, font);
            }
        }
예제 #7
0
파일: RoomPanel.cs 프로젝트: hollow87/cb0t
        internal void PMTextReceived(Room room, User user, String name, String text, AresFont font, PMTextReceivedType type)
        {
            this.tabControl1.BeginInvoke((Action)(() =>
            {
                for (int i = 0; i < this.tabControl1.TabPages.Count; i++)
                {
                    if (this.tabControl1.TabPages[i] is PMTab)
                    {
                        if (this.tabControl1.TabPages[i].Text == name)
                        {
                            PMTab tab = (PMTab)this.tabControl1.TabPages[i];

                            if (type == PMTextReceivedType.Announce)
                            {
                                tab.Announce(text);

                                if (text.Contains("voice_clip"))
                                {
                                    tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == name);
                                }
                            }
                            else
                            {
                                tab.PM(name, text, font);
                                tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == name);

                                if (!tab.AutoReplySent)
                                {
                                    if (Settings.GetReg <bool>("can_pm_reply", true))
                                    {
                                        this.SendAutoReply(name, EventArgs.Empty);
                                        String[] lines = Settings.GetReg <String>("pm_reply", "Hello +n, please leave a message.").Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                                        AresFont f = null;

                                        if (Settings.MyFont != null)
                                        {
                                            f = Settings.MyFont.Copy();
                                        }

                                        foreach (String str in lines)
                                        {
                                            String rtext = str.Replace("+n", name);

                                            if (!String.IsNullOrEmpty(rtext))
                                            {
                                                while (Encoding.UTF8.GetByteCount(rtext) > 200)
                                                {
                                                    rtext = rtext.Substring(0, rtext.Length - 1);
                                                }

                                                tab.PM(this.MyName, rtext, f);
                                            }
                                        }
                                    }

                                    tab.AutoReplySent = true;
                                }
                            }

                            if (!tab.First)
                            {
                                tab.First = true;

                                if (room != null && user != null)
                                {
                                    ScriptEvents.OnPmFirstReceived(room, user);
                                }
                            }

                            return;
                        }
                    }
                }

                PMTab new_tab = new PMTab(name, this.EndPoint);

                if (this.IsBlack)
                {
                    new_tab.SetToBlack();
                }

                new_tab.HashlinkClicked += this.LinkHashlinkClicked;
                new_tab.EditScribbleClicked += this.DoEditScribbleClicked;
                new_tab.ImageIndex = 2;
                this.tabControl1.TabPages.Add(new_tab);

                if (type == PMTextReceivedType.Announce)
                {
                    new_tab.Announce(text);
                }
                else
                {
                    new_tab.PM(name, text, font);

                    if (Settings.GetReg <bool>("can_pm_reply", true))
                    {
                        this.SendAutoReply(name, EventArgs.Empty);
                        String[] lines = Settings.GetReg <String>("pm_reply", "Hello +n, please leave a message.").Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                        AresFont f = null;

                        if (Settings.MyFont != null)
                        {
                            f = Settings.MyFont.Copy();
                        }

                        foreach (String str in lines)
                        {
                            String rtext = str.Replace("+n", name);

                            if (!String.IsNullOrEmpty(text))
                            {
                                while (Encoding.UTF8.GetByteCount(rtext) > 200)
                                {
                                    rtext = rtext.Substring(0, rtext.Length - 1);
                                }

                                new_tab.PM(this.MyName, rtext, f);
                            }
                        }
                    }

                    new_tab.AutoReplySent = true;
                    new_tab.First = true;

                    if (room != null && user != null)
                    {
                        ScriptEvents.OnPmFirstReceived(room, user);
                    }
                }
            }));
        }