1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 // (c) 2008-2011 Moz (@syo68k)
4 // (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 // (c) 2014 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
10 // This file is part of OpenTween.
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
28 using System.Collections.Generic;
29 using System.ComponentModel;
34 using System.Windows.Forms;
35 using OpenTween.Thumbnail;
37 namespace OpenTween.Setting.Panel
39 public partial class CooperatePanel : SettingPanelBase
41 public CooperatePanel()
42 => this.InitializeComponent();
44 public void LoadConfig(SettingCommon settingCommon)
46 this.CheckNicoms.Checked = settingCommon.Nicoms;
47 this.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(settingCommon.TranslateLanguage);
48 this.UserAppointUrlText.Text = settingCommon.UserAppointUrl;
49 this.EnableImgAzyobuziNetCheckBox.Checked = settingCommon.EnableImgAzyobuziNet;
50 this.ImgAzyobuziNetDisabledInDMCheckBox.Checked = settingCommon.ImgAzyobuziNetDisabledInDM;
51 this.MapThumbnailProviderComboBox.SelectedIndex = (int)settingCommon.MapThumbnailProvider;
52 this.MapThumbnailHeightTextBox.Text = settingCommon.MapThumbnailHeight.ToString();
53 this.MapThumbnailWidthTextBox.Text = settingCommon.MapThumbnailWidth.ToString();
54 this.MapThumbnailZoomTextBox.Text = settingCommon.MapThumbnailZoom.ToString();
57 public void SaveConfig(SettingCommon settingCommon)
59 settingCommon.Nicoms = this.CheckNicoms.Checked;
60 settingCommon.TranslateLanguage = Bing.GetLanguageEnumFromIndex(this.ComboBoxTranslateLanguage.SelectedIndex);
61 settingCommon.UserAppointUrl = this.UserAppointUrlText.Text;
62 settingCommon.EnableImgAzyobuziNet = this.EnableImgAzyobuziNetCheckBox.Checked;
63 settingCommon.ImgAzyobuziNetDisabledInDM = this.ImgAzyobuziNetDisabledInDMCheckBox.Checked;
64 settingCommon.MapThumbnailProvider = (MapProvider)this.MapThumbnailProviderComboBox.SelectedIndex;
65 settingCommon.MapThumbnailHeight = int.Parse(this.MapThumbnailHeightTextBox.Text);
66 settingCommon.MapThumbnailWidth = int.Parse(this.MapThumbnailWidthTextBox.Text);
67 settingCommon.MapThumbnailZoom = int.Parse(this.MapThumbnailZoomTextBox.Text);
70 private void UserAppointUrlText_Validating(object sender, CancelEventArgs e)
72 if (!UserAppointUrlText.Text.StartsWith("http", StringComparison.Ordinal) && !string.IsNullOrEmpty(UserAppointUrlText.Text))
74 MessageBox.Show("Text Error:正しいURLではありません");
78 private void EnableImgAzyobuziNetCheckBox_CheckedChanged(object sender, EventArgs e)
79 => this.ImgAzyobuziNetDisabledInDMCheckBox.Enabled = this.EnableImgAzyobuziNetCheckBox.Checked;