Beispiel #1
0
 public void AddChannel(ChannelSetting channel)
 {
     listChannels.Add(channel);
 }
Beispiel #2
0
 public void RemoveChannel(ChannelSetting channel)
 {
     listChannels.Remove(channel);
 }
Beispiel #3
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            //need to send the part message
            //System.Diagnostics.Debug.WriteLine("closing form:" + this.Text + ":" + this.Controls.Count + ":" + e.CloseReason);

            try
            {
                if (this.Controls.Count == 2)
                {
                    if (dockedControl.WindowStyle == IceTabPage.WindowType.Console)
                    {
                        if (e.CloseReason == CloseReason.UserClosing)
                        {
                            e.Cancel = true;
                            return;
                        }
                        else
                        {
                            if (FormMain.Instance.IceChatOptions.SaveWindowPosition == true)
                            {
                                ChannelSetting cs = FormMain.Instance.ChannelSettings.FindChannel("Console", "");
                                if (cs != null)
                                {
                                    cs.WindowLocation = this.Location;
                                    if (this.WindowState == FormWindowState.Normal)
                                    {
                                        cs.WindowSize = this.Size;
                                    }
                                }
                                else
                                {
                                    ChannelSetting cs1 = new ChannelSetting();
                                    cs1.ChannelName    = "Console";
                                    cs1.NetworkName    = "";
                                    cs1.WindowLocation = this.Location;
                                    if (this.WindowState == FormWindowState.Normal)
                                    {
                                        cs1.WindowSize = this.Size;
                                    }

                                    FormMain.Instance.ChannelSettings.AddChannel(cs1);
                                }

                                FormMain.Instance.SaveChannelSettings();
                            }
                        }
                    }

                    if (dockedControl.WindowStyle == IceTabPage.WindowType.Channel)
                    {
                        if (FormMain.Instance.IceChatOptions.SaveWindowPosition == true)
                        {
                            ChannelSetting cs = FormMain.Instance.ChannelSettings.FindChannel(dockedControl.TabCaption, dockedControl.Connection.ServerSetting.NetworkName);
                            if (cs != null)
                            {
                                cs.WindowLocation = this.Location;
                                if (this.WindowState == FormWindowState.Normal)
                                {
                                    cs.WindowSize = this.Size;
                                }
                            }
                            else
                            {
                                ChannelSetting cs1 = new ChannelSetting();
                                cs1.ChannelName    = dockedControl.TabCaption;
                                cs1.NetworkName    = dockedControl.Connection.ServerSetting.NetworkName;
                                cs1.WindowLocation = this.Location;
                                if (this.WindowState == FormWindowState.Normal)
                                {
                                    cs1.WindowSize = this.Size;
                                }

                                FormMain.Instance.ChannelSettings.AddChannel(cs1);
                            }

                            FormMain.Instance.SaveChannelSettings();
                        }

                        if (kickedChannel == false)
                        {
                            bool dontPart = true;
                            if (e.CloseReason == CloseReason.MdiFormClosing)
                            {
                                if (dockedControl.Connection.ServerSetting.UseBNC == true)
                                {
                                    dontPart = false;
                                }
                            }

                            if (dontPart)
                            {
                                FormMain.Instance.ParseOutGoingCommand(dockedControl.Connection, "/part " + dockedControl.TabCaption);
                            }
                        }
                    }
                    else if (dockedControl.WindowStyle == IceTabPage.WindowType.Query)
                    {
                        FormMain.Instance.ParseOutGoingCommand(dockedControl.Connection, "/close " + dockedControl.TabCaption);
                    }
                    else
                    {
                        //remove this from the channel bar
                        FormMain.Instance.RemoveWindow(dockedControl.Connection, dockedControl.TabCaption, dockedControl.WindowStyle);
                    }
                }
            }
            catch (Exception ee)
            {
                System.Diagnostics.Debug.WriteLine(ee.Message);
                System.Diagnostics.Debug.WriteLine(ee.StackTrace);
            }
        }