private Twitter tw;
private bool _ValidationError = false;
- private MyCommon.EVENTTYPE _MyEventNotifyFlag;
- private MyCommon.EVENTTYPE _isMyEventNotifyFlag;
public List<UserAccount> UserAccounts;
private long? InitialUserId;
- public bool IsRemoveSameEvent;
public TwitterConfiguration TwitterConfiguration = TwitterConfiguration.DefaultConfiguration();
this.ProxyPanel.LoadConfig(settingLocal);
this.CooperatePanel.LoadConfig(settingCommon);
this.ConnectionPanel.LoadConfig(settingCommon);
+ this.NotifyPanel.LoadConfig(settingCommon);
}
public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
this.ProxyPanel.SaveConfig(settingLocal);
this.CooperatePanel.SaveConfig(settingCommon);
this.ConnectionPanel.SaveConfig(settingCommon);
+ this.NotifyPanel.SaveConfig(settingCommon);
}
private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
}
#endif
- try
- {
- EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
- GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
- ForceEventNotify = this.NotifyPanel.CheckForceEventNotify.Checked;
- FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
- EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
- this.IsRemoveSameEvent = this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked;
- }
- catch(Exception)
- {
- MessageBox.Show(Properties.Resources.Save_ClickText3);
- this.DialogResult = DialogResult.Cancel;
- return;
- }
}
private void Setting_FormClosing(object sender, FormClosingEventArgs e)
}
}
- ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
- this.NotifyPanel.CheckForceEventNotify.Checked = ForceEventNotify;
- this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
- SoundFileListup();
-
- this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
-
this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
public string RecommendStatusText { get; set; }
- public bool EventNotifyEnabled { get; set; }
-
- public MyCommon.EVENTTYPE EventNotifyFlag
- {
- get
- {
- return _MyEventNotifyFlag;
- }
- set
- {
- _MyEventNotifyFlag = value;
- }
- }
-
- public MyCommon.EVENTTYPE IsMyEventNotifyFlag
- {
- get
- {
- return _isMyEventNotifyFlag;
- }
- set
- {
- _isMyEventNotifyFlag = value;
- }
- }
-
- public bool ForceEventNotify { get; set; }
- public bool FavEventUnread { get; set; }
-
- public string EventSoundFile { get; set; }
-
private bool StartAuth()
{
//現在の設定内容で通信
// ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
//}
- private class EventCheckboxTblElement
- {
- public CheckBox CheckBox;
- public MyCommon.EVENTTYPE Type;
- }
-
- private EventCheckboxTblElement[] GetEventCheckboxTable()
- {
- EventCheckboxTblElement[] _eventCheckboxTable = new EventCheckboxTblElement[8];
-
- _eventCheckboxTable[0] = new EventCheckboxTblElement();
- _eventCheckboxTable[0].CheckBox = this.NotifyPanel.CheckFavoritesEvent;
- _eventCheckboxTable[0].Type = MyCommon.EVENTTYPE.Favorite;
-
- _eventCheckboxTable[1] = new EventCheckboxTblElement();
- _eventCheckboxTable[1].CheckBox = this.NotifyPanel.CheckUnfavoritesEvent;
- _eventCheckboxTable[1].Type = MyCommon.EVENTTYPE.Unfavorite;
-
- _eventCheckboxTable[2] = new EventCheckboxTblElement();
- _eventCheckboxTable[2].CheckBox = this.NotifyPanel.CheckFollowEvent;
- _eventCheckboxTable[2].Type = MyCommon.EVENTTYPE.Follow;
-
- _eventCheckboxTable[3] = new EventCheckboxTblElement();
- _eventCheckboxTable[3].CheckBox = this.NotifyPanel.CheckListMemberAddedEvent;
- _eventCheckboxTable[3].Type = MyCommon.EVENTTYPE.ListMemberAdded;
-
- _eventCheckboxTable[4] = new EventCheckboxTblElement();
- _eventCheckboxTable[4].CheckBox = this.NotifyPanel.CheckListMemberRemovedEvent;
- _eventCheckboxTable[4].Type = MyCommon.EVENTTYPE.ListMemberRemoved;
-
- _eventCheckboxTable[5] = new EventCheckboxTblElement();
- _eventCheckboxTable[5].CheckBox = this.NotifyPanel.CheckBlockEvent;
- _eventCheckboxTable[5].Type = MyCommon.EVENTTYPE.Block;
-
- _eventCheckboxTable[6] = new EventCheckboxTblElement();
- _eventCheckboxTable[6].CheckBox = this.NotifyPanel.CheckUserUpdateEvent;
- _eventCheckboxTable[6].Type = MyCommon.EVENTTYPE.UserUpdate;
-
- _eventCheckboxTable[7] = new EventCheckboxTblElement();
- _eventCheckboxTable[7].CheckBox = this.NotifyPanel.CheckListCreatedEvent;
- _eventCheckboxTable[7].Type = MyCommon.EVENTTYPE.ListCreated;
-
- return _eventCheckboxTable;
- }
-
- private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
- {
- MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
- MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
-
- foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
- {
- switch (tbl.CheckBox.CheckState)
- {
- case CheckState.Checked:
- evt = evt | tbl.Type;
- myevt = myevt | tbl.Type;
- break;
- case CheckState.Indeterminate:
- evt = evt | tbl.Type;
- break;
- case CheckState.Unchecked:
- break;
- }
- }
- eventnotifyflag = evt;
- isMyeventnotifyflag = myevt;
- }
-
- private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
- {
- MyCommon.EVENTTYPE evt = eventnotifyflag;
- MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
-
- this.NotifyPanel.CheckEventNotify.Checked = rootEnabled;
-
- foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
- {
- if ((evt & tbl.Type) != 0)
- {
- if ((myevt & tbl.Type) != 0)
- {
- tbl.CheckBox.CheckState = CheckState.Checked;
- }
- else
- {
- tbl.CheckBox.CheckState = CheckState.Indeterminate;
- }
- }
- else
- {
- tbl.CheckBox.CheckState = CheckState.Unchecked;
- }
- tbl.CheckBox.Enabled = rootEnabled;
- }
-
- }
-
- private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
- {
- foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
- {
- tbl.CheckBox.Enabled = this.NotifyPanel.CheckEventNotify.Checked;
- }
- }
-
//private void CheckForceEventNotify_CheckedChanged(object sender, EventArgs e)
//{
// _MyForceEventNotify = CheckEventNotify.Checked;
// _MyTranslateLanguage = (new Google()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
//}
- private void SoundFileListup()
- {
- if (EventSoundFile == null) EventSoundFile = "";
- this.NotifyPanel.ComboBoxEventNotifySound.Items.Clear();
- this.NotifyPanel.ComboBoxEventNotifySound.Items.Add("");
- DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
- if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
- {
- oDir = oDir.GetDirectories("Sounds")[0];
- }
- foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
- {
- this.NotifyPanel.ComboBoxEventNotifySound.Items.Add(oFile.Name);
- }
- int idx = this.NotifyPanel.ComboBoxEventNotifySound.Items.IndexOf(EventSoundFile);
- if (idx == -1) idx = 0;
- this.NotifyPanel.ComboBoxEventNotifySound.SelectedIndex = idx;
- }
-
//private void ComboBoxEventNotifySound_VisibleChanged(object sender, EventArgs e)
//{
// SoundFileListup();
this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
- this.NotifyPanel.CheckEventNotify.CheckedChanged += this.CheckEventNotify_CheckedChanged;
this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;
this.FontPanel.btnUnread.Click += this.btnFontAndColor_Click;
this.CheckEventNotify.CheckState = System.Windows.Forms.CheckState.Checked;
this.CheckEventNotify.Name = "CheckEventNotify";
this.CheckEventNotify.UseVisualStyleBackColor = true;
+ this.CheckEventNotify.CheckedChanged += new System.EventHandler(this.CheckEventNotify_CheckedChanged);
//
// NotifyPanel
//
using System.Linq;
using System.Text;
using System.Windows.Forms;
+using System.IO;
namespace OpenTween.Setting.Panel
{
{
InitializeComponent();
}
+
+ public void LoadConfig(SettingCommon settingCommon)
+ {
+ this.ApplyEventNotifyFlag(settingCommon.EventNotifyEnabled, settingCommon.EventNotifyFlag, settingCommon.IsMyEventNotifyFlag);
+ this.CheckForceEventNotify.Checked = settingCommon.ForceEventNotify;
+ this.CheckFavEventUnread.Checked = settingCommon.FavEventUnread;
+
+ this.SoundFileListup();
+ var soundFileIdx = this.ComboBoxEventNotifySound.Items.IndexOf(settingCommon.EventSoundFile);
+ if (soundFileIdx != -1)
+ this.ComboBoxEventNotifySound.SelectedIndex = soundFileIdx;
+
+ this.IsRemoveSameFavEventCheckBox.Checked = settingCommon.IsRemoveSameEvent;
+ }
+
+ public void SaveConfig(SettingCommon settingCommon)
+ {
+ settingCommon.EventNotifyEnabled = this.CheckEventNotify.Checked;
+ this.GetEventNotifyFlag(ref settingCommon.EventNotifyFlag, ref settingCommon.IsMyEventNotifyFlag);
+ settingCommon.ForceEventNotify = this.CheckForceEventNotify.Checked;
+ settingCommon.FavEventUnread = this.CheckFavEventUnread.Checked;
+ settingCommon.EventSoundFile = (string)this.ComboBoxEventNotifySound.SelectedItem;
+ settingCommon.IsRemoveSameEvent = this.IsRemoveSameFavEventCheckBox.Checked;
+ }
+
+ private void SoundFileListup()
+ {
+ this.ComboBoxEventNotifySound.Items.Clear();
+ this.ComboBoxEventNotifySound.Items.Add("");
+ DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
+ if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
+ {
+ oDir = oDir.GetDirectories("Sounds")[0];
+ }
+ foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
+ {
+ this.ComboBoxEventNotifySound.Items.Add(oFile.Name);
+ }
+ }
+
+ private class EventCheckboxTblElement
+ {
+ public CheckBox CheckBox;
+ public MyCommon.EVENTTYPE Type;
+ }
+
+ private EventCheckboxTblElement[] GetEventCheckboxTable()
+ {
+ return new[]
+ {
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckFavoritesEvent,
+ Type = MyCommon.EVENTTYPE.Favorite,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckUnfavoritesEvent,
+ Type = MyCommon.EVENTTYPE.Unfavorite,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckFollowEvent,
+ Type = MyCommon.EVENTTYPE.Follow,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckListMemberAddedEvent,
+ Type = MyCommon.EVENTTYPE.ListMemberAdded,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckListMemberRemovedEvent,
+ Type = MyCommon.EVENTTYPE.ListMemberRemoved,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckBlockEvent,
+ Type = MyCommon.EVENTTYPE.Block,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckUserUpdateEvent,
+ Type = MyCommon.EVENTTYPE.UserUpdate,
+ },
+ new EventCheckboxTblElement
+ {
+ CheckBox = this.CheckListCreatedEvent,
+ Type = MyCommon.EVENTTYPE.ListCreated,
+ },
+ };
+ }
+
+ private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
+ {
+ MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
+ MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
+
+ foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
+ {
+ switch (tbl.CheckBox.CheckState)
+ {
+ case CheckState.Checked:
+ evt = evt | tbl.Type;
+ myevt = myevt | tbl.Type;
+ break;
+ case CheckState.Indeterminate:
+ evt = evt | tbl.Type;
+ break;
+ case CheckState.Unchecked:
+ break;
+ }
+ }
+ eventnotifyflag = evt;
+ isMyeventnotifyflag = myevt;
+ }
+
+ private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
+ {
+ MyCommon.EVENTTYPE evt = eventnotifyflag;
+ MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
+
+ this.CheckEventNotify.Checked = rootEnabled;
+
+ foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
+ {
+ if ((evt & tbl.Type) != 0)
+ {
+ if ((myevt & tbl.Type) != 0)
+ {
+ tbl.CheckBox.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ tbl.CheckBox.CheckState = CheckState.Indeterminate;
+ }
+ }
+ else
+ {
+ tbl.CheckBox.CheckState = CheckState.Unchecked;
+ }
+ tbl.CheckBox.Enabled = rootEnabled;
+ }
+ }
+
+ private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
+ {
+ foreach (var tbl in this.GetEventCheckboxTable())
+ {
+ tbl.CheckBox.Enabled = this.CheckEventNotify.Checked;
+ }
+ }
}
}
this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;
- SettingDialog.EventNotifyEnabled = _cfgCommon.EventNotifyEnabled;
- SettingDialog.EventNotifyFlag = _cfgCommon.EventNotifyFlag;
- SettingDialog.IsMyEventNotifyFlag = _cfgCommon.IsMyEventNotifyFlag;
- SettingDialog.ForceEventNotify = _cfgCommon.ForceEventNotify;
- SettingDialog.FavEventUnread = _cfgCommon.FavEventUnread;
- SettingDialog.EventSoundFile = _cfgCommon.EventSoundFile;
-
//廃止サービスが選択されていた場合bit.lyへ読み替え
if (_cfgCommon.AutoShortUrlFirst < 0)
_cfgCommon.AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
//Regex statregex = new Regex("^0*");
SettingDialog.RecommendStatusText = " [TWNv" + Regex.Replace(MyCommon.FileVersion.Replace(".", ""), "^0*", "") + "]";
- SettingDialog.IsRemoveSameEvent = _cfgCommon.IsRemoveSameEvent;
-
//ハッシュタグ関連
HashSupl = new AtIdSupplement(_cfgCommon.HashTags, "#");
HashMgr = new HashtagManage(HashSupl,
private bool IsEventNotifyAsEventType(MyCommon.EVENTTYPE type)
{
- return SettingDialog.EventNotifyEnabled && (type & SettingDialog.EventNotifyFlag) != 0 || type == MyCommon.EVENTTYPE.None;
+ return this._cfgCommon.EventNotifyEnabled && (type & this._cfgCommon.EventNotifyFlag) != 0 || type == MyCommon.EVENTTYPE.None;
}
private bool IsMyEventNotityAsEventType(Twitter.FormattedEvent ev)
{
- return (ev.Eventtype & SettingDialog.IsMyEventNotifyFlag) != 0 ? true : !ev.IsMe;
+ return (ev.Eventtype & this._cfgCommon.IsMyEventNotifyFlag) != 0 ? true : !ev.IsMe;
}
private bool BalloonRequired(Twitter.FormattedEvent ev)
{
if ((
IsEventNotifyAsEventType(ev.Eventtype) && IsMyEventNotityAsEventType(ev) &&
- (NewPostPopMenuItem.Checked || (SettingDialog.ForceEventNotify && ev.Eventtype != MyCommon.EVENTTYPE.None)) &&
+ (NewPostPopMenuItem.Checked || (this._cfgCommon.ForceEventNotify && ev.Eventtype != MyCommon.EVENTTYPE.None)) &&
!_initial &&
(
(
_cfgCommon.TokenSecret = tw.AccessTokenSecret;
_cfgCommon.UserAccounts = SettingDialog.UserAccounts;
- _cfgCommon.EventNotifyEnabled = SettingDialog.EventNotifyEnabled;
- _cfgCommon.EventNotifyFlag = SettingDialog.EventNotifyFlag;
- _cfgCommon.IsMyEventNotifyFlag = SettingDialog.IsMyEventNotifyFlag;
- _cfgCommon.ForceEventNotify = SettingDialog.ForceEventNotify;
- _cfgCommon.FavEventUnread = SettingDialog.FavEventUnread;
- _cfgCommon.EventSoundFile = SettingDialog.EventSoundFile;
if (IdeographicSpaceToSpaceToolStripMenuItem != null &&
IdeographicSpaceToSpaceToolStripMenuItem.IsDisposed == false)
{
_cfgCommon.AllAtReply = tw.AllAtReply;
_cfgCommon.UseImageService = ImageSelector.ServiceIndex;
_cfgCommon.UseImageServiceName = ImageSelector.ServiceName;
- _cfgCommon.IsRemoveSameEvent = SettingDialog.IsRemoveSameEvent;
_cfgCommon.Save();
}
}
//サウンド再生
- string snd = SettingDialog.EventSoundFile;
+ string snd = this._cfgCommon.EventSoundFile;
if (!_initial && this._cfgCommon.PlaySound && !string.IsNullOrEmpty(snd))
{
- if ((ev.Eventtype & SettingDialog.EventNotifyFlag) != 0 && IsMyEventNotityAsEventType(ev))
+ if ((ev.Eventtype & this._cfgCommon.EventNotifyFlag) != 0 && IsMyEventNotityAsEventType(ev))
{
try
{
ShowUserTimeline();
}
- public bool FavEventChangeUnread
- {
- get { return SettingDialog.FavEventUnread; }
- }
-
private string GetUserIdFromCurPostOrInput(string caption)
{
string id = "";
var tweetEvent = TwitterStreamEvent<TwitterStatus>.ParseJson(content);
evt.Target = "@" + tweetEvent.TargetObject.User.ScreenName + ":" + WebUtility.HtmlDecode(tweetEvent.TargetObject.Text);
evt.Id = tweetEvent.TargetObject.Id;
- if (AppendSettingDialog.Instance.IsRemoveSameEvent)
+ if (SettingCommon.Instance.IsRemoveSameEvent)
{
if (StoredEvent.Any(ev =>
{
post.FavoritedCount++;
if (!TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.Favorites).Contains(post.StatusId))
{
- if (AppendSettingDialog.Instance.FavEventUnread && post.IsRead)
+ if (SettingCommon.Instance.FavEventUnread && post.IsRead)
{
post.IsRead = false;
}
}
else
{
- if (AppendSettingDialog.Instance.FavEventUnread)
+ if (SettingCommon.Instance.FavEventUnread)
{
TabInformations.GetInstance().SetRead(false, TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.Favorites).TabName, TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.Favorites).IndexOf(post.StatusId));
}