Esempio n. 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            //set all the options accordingly

            iceChatOptions.SaveWindowPosition = checkSaveWindowPosition.Checked;
            iceChatOptions.TimeStamp = textTimeStamp.Text.Replace(((char)3).ToString(), "").Replace(((char)2).ToString(), ""); ;
            iceChatOptions.ShowTimeStamp = checkTimeStamp.Checked;
            iceChatOptions.AutoJoinInvite = checkJoinInvite.Checked;

            iceChatOptions.LogConsole = checkLogConsole.Checked;
            iceChatOptions.LogChannel = checkLogChannel.Checked;
            iceChatOptions.LogQuery = checkLogQuery.Checked;
            iceChatOptions.LogWindow = checkLogWindow.Checked;
            iceChatOptions.SeperateLogs = checkSeperateLogs.Checked;
            iceChatOptions.LogFormat = comboLogFormat.Text;
            iceChatOptions.LogFolder = labelCurrentLogFolder.Text;
            iceChatOptions.LogReload = checkReloadLogs.Checked;

            iceChatOptions.WindowedMode = checkWindowedMode.Checked;
            iceChatOptions.ShowEmoticons = checkEmoticons.Checked;
            iceChatOptions.ShowEmoticonPicker = checkEmoticonPicker.Checked;
            iceChatOptions.ShowColorPicker = checkColorPicker.Checked;
            iceChatOptions.ShowBasicCommands = checkBasicCommands.Checked;
            iceChatOptions.ShowSendButton = checkShowSend.Checked;
            iceChatOptions.ShowStatusBar = checkStatusBar.Checked;
            iceChatOptions.DisableQueries = checkDisableQueries.Checked;
            iceChatOptions.NewQueryForegound = checkNewQueryForegound.Checked;
            iceChatOptions.WhoisNewQuery = checkWhoisNewQuery.Checked;
            iceChatOptions.AskQuit = checkAskQuit.Checked;
            iceChatOptions.SingleRowTabBar = checkSingleRowCB.Checked;

            iceChatOptions.FlashTaskBarChannel = checkFlashChannelMessage.Checked;
            iceChatOptions.FlashTaskBarChannelAction = checkFlashChannelAction.Checked;
            iceChatOptions.FlashTaskBarPrivate = checkFlashPrivateMessage.Checked;
            iceChatOptions.FlashTaskBarPrivateAction = checkFlashPrivateAction.Checked;

            iceChatOptions.FlashTaskBarNumber = Convert.ToInt32(textFlashTaskbarNumber.Text);
            iceChatOptions.FlashServerTreeIcons = checkFlashChannel.Checked;
            iceChatOptions.FlashServerTreeIconsPrivate = checkFlashPrivate.Checked;

            iceChatOptions.MaximumTextLines = Convert.ToInt32(textMaximumLines.Text);
            iceChatOptions.NickCompleteAfter = textNickComplete.Text.Replace(((char)3).ToString(), "").Replace(((char)2).ToString(), "");
            iceChatOptions.ShowNickHost = checkShowNickHost.Checked;
            iceChatOptions.ShowNickButtons = checkNickShowButtons.Checked;
            iceChatOptions.ShowServerButtons = checkServerShowButtons.Checked;
            iceChatOptions.ChannelOpenKick = checkKickChannelOpen.Checked;
            iceChatOptions.ShowUnreadLine = checkShowUnreadLine.Checked;
            iceChatOptions.MinimizeToTray = checkMinimizeTray.Checked;
            iceChatOptions.ShowSytemTrayIcon = checkShowTrayIcon.Checked;
            iceChatOptions.ShowSytemTrayNotifications = checkShowTrayNotifications.Checked;
            iceChatOptions.SystemTrayText = textSystemTrayText.Text;
            iceChatOptions.SystemTrayIcon = textSystemTrayIcon.Text;

            iceChatOptions.SystemTrayServerMessage = checkTrayServerMessage.Checked;
            iceChatOptions.SystemTrayBuddyOnline = checkTrayBuddyOnline.Checked;
            iceChatOptions.SystemTrayChannelMention = checkNickChan.Checked;
            iceChatOptions.SystemTrayQueryMessage = checkNewQuery.Checked;

            iceChatOptions.Language = ((LanguageItem)comboBoxLanguage.SelectedItem).LanguageName;
            iceChatOptions.ShowTopic = checkTopicBar.Checked;

            //set all the fonts
            iceChatFonts.FontSettings[0].FontName = textConsoleFont.Text;
            iceChatFonts.FontSettings[0].FontSize = float.Parse(textConsoleFontSize.Text);

            iceChatFonts.FontSettings[1].FontName = textChannelFont.Text;
            iceChatFonts.FontSettings[1].FontSize = float.Parse(textChannelFontSize.Text);

            iceChatFonts.FontSettings[2].FontName = textQueryFont.Text;
            iceChatFonts.FontSettings[2].FontSize = float.Parse(textQueryFontSize.Text);

            iceChatFonts.FontSettings[3].FontName = textNickListFont.Text;
            iceChatFonts.FontSettings[3].FontSize = float.Parse(textNickListFontSize.Text);

            iceChatFonts.FontSettings[4].FontName = textServerListFont.Text;
            iceChatFonts.FontSettings[4].FontSize = float.Parse(textServerListFontSize.Text);

            iceChatFonts.FontSettings[5].FontName = textInputFont.Text;
            iceChatFonts.FontSettings[5].FontSize = float.Parse(textInputFontSize.Text);

            iceChatFonts.FontSettings[6].FontName = textDockTabFont.Text;
            iceChatFonts.FontSettings[6].FontSize = float.Parse(textDockTabSize.Text);

            iceChatFonts.FontSettings[7].FontName = textMenuBarFont.Text;
            iceChatFonts.FontSettings[7].FontSize = float.Parse(textMenuBarSize.Text);

            iceChatFonts.FontSettings[8].FontName = textChannelBarFont.Text;
            iceChatFonts.FontSettings[8].FontSize = float.Parse(textChannelBarSize.Text);

            //dcc settings
            iceChatOptions.DCCChatAutoAccept = checkAutoDCCChat.Checked;
            iceChatOptions.DCCFileAutoAccept = checkAutoDCCFile.Checked;
            iceChatOptions.DCCChatAutoAcceptBuddyOnly = checkAutoDCCChatBuddy.Checked;
            iceChatOptions.DCCFileAutoAcceptBuddyOnly = checkAutoDCCFileBuddy.Checked;

            iceChatOptions.DCCChatIgnore = checkIgnoreDCCChat.Checked;
            iceChatOptions.DCCFileIgnore = checkIgnoreDCCFile.Checked;
            iceChatOptions.DCCChatTimeOut = Convert.ToInt32(textDCCChatTimeout.Text);
            iceChatOptions.DCCPortLower = Convert.ToInt32(textDCCPortLow.Text);
            iceChatOptions.DCCPortUpper = Convert.ToInt32(textDCCPortHigh.Text);
            iceChatOptions.DCCReceiveFolder = textDCCReceiveFolder.Text;
            iceChatOptions.DCCSendFolder = textDCCSendFolder.Text;
            iceChatOptions.DCCLocalIP = textDCCLocalIP.Text;
            iceChatOptions.DCCBufferSize = Convert.ToInt32(comboBufferSize.Text);
            iceChatOptions.DCCAutogetRouterIP = checkAutoGetLocalIP.Checked;

            //save the emoticons
            iceChatEmoticons.listEmoticons.Clear();
            //re-add them all back in
            int i = 0;
            foreach (ListViewItem lvi in listViewEmot.Items)
            {
                EmoticonItem ei = new EmoticonItem();
                ei.EmoticonImage = lvi.SubItems[1].Text;
                ei.Trigger = lvi.Text;
                ei.ID = i++;
                iceChatEmoticons.AddEmoticon(ei);
            }

            FormMain.Instance.IceChatEmoticons = iceChatEmoticons;

            // apply language change
            FormMain.Instance.IceChatCurrentLanguageFile = (LanguageItem) comboBoxLanguage.SelectedItem;

            //Event Settings
            iceChatOptions.JoinEventLocation = comboJoinEvent.SelectedIndex;
            iceChatOptions.PartEventLocation = comboPartEvent.SelectedIndex;
            iceChatOptions.QuitEventLocation = comboQuitEvent.SelectedIndex;
            iceChatOptions.ModeEventLocation = comboModeEvent.SelectedIndex;
            iceChatOptions.KickEventLocation = comboKickEvent.SelectedIndex;
            iceChatOptions.TopicEventLocation = comboTopicEvent.SelectedIndex;
            iceChatOptions.ChannelMessageEventLocation = comboChannelMessageEvent.SelectedIndex;
            iceChatOptions.ChannelActionEventLocation = comboChannelActionEvent.SelectedIndex;
            iceChatOptions.ChannelNoticeEventLocation = comboChannelNoticeEvent.SelectedIndex;
            iceChatOptions.WhoisEventLocation = comboWhoisEvent.SelectedIndex;
            iceChatOptions.NickChangeEventLocation = comboNickEvent.SelectedIndex;

            iceChatOptions.ServerMessageEventLocation = comboServerMessageEvent.SelectedIndex;
            iceChatOptions.ServerNoticeEventLocation = comboServerNoticeEvent.SelectedIndex;
            iceChatOptions.ServerErrorEventLocation = comboServerErrorEvent.SelectedIndex;
            iceChatOptions.UserNoticeEventLocation = comboUserNoticeEvent.SelectedIndex;

            iceChatOptions.SoundUseExternalCommand = checkExternalPlayCommand.Checked;
            iceChatOptions.SoundExternalCommand = textExternalPlayCommand.Text;
            iceChatOptions.SoundPlayActive = checkPlayActive.Checked;

            //away settings
            iceChatOptions.AwayCommand = textAwayCommand.Text;
            iceChatOptions.ReturnCommand = textReturnCommand.Text;
            iceChatOptions.SendAwayCommands = checkSendAwayReturn.Checked;
            iceChatOptions.SendAwayPrivateMessage = checkAwayMessagePrivate.Checked;
            iceChatOptions.PrivateAwayMessage = textAwayPrivateMessage.Text;
            iceChatOptions.AutoAway = checkAutoAway.Checked;
            iceChatOptions.AutoReturn = checkAutoReturn.Checked;

            if (textAutoAwayMinutes.Text.Length == 0)
            {
                iceChatOptions.AutoAwayTime = 0;
                iceChatOptions.AutoAway = false;
            }
            else
            {
                //check if value is an integer
                int result;
                if (Int32.TryParse(textAutoAwayMinutes.Text, out result))
                    iceChatOptions.AutoAwayTime = result;
                else
                {
                    iceChatOptions.AutoAwayTime = 0;
                    iceChatOptions.AutoAway = false;
                }
            }

            iceChatOptions.AutoAwaySystemTray = checkAutoAwayTray.Checked;
            iceChatOptions.AutoAwayMessage = textAutoAwayMessage.Text;

            iceChatOptions.AutoPerformStartupEnable = checkAutoPerformStartup.Checked;
            iceChatOptions.AutoPerformStartup = textAutoPerformStartup.Text.Trim().Split(new String[] { Environment.NewLine }, StringSplitOptions.None);

            foreach (Plugin p in  FormMain.Instance.LoadedPlugins)
            {
                IceChatPlugin ipc = p as IceChatPlugin;
                if (ipc != null)
                {
                    if (ipc.plugin.Enabled == true)
                        ipc.plugin.SaveSettingsForm();
                }
            }

            if (SaveOptions != null)
                SaveOptions();

            this.Close();
        }
Esempio n. 2
0
 public void AddEmoticon(EmoticonItem item)
 {
     listEmoticons.Add(item);
 }