Permalink
Browse files

added option to switch to news tab on updated news

  • Loading branch information...
1 parent 3c5f4f2 commit 976f3dcae18aece19b366ed1283a0fe509ee0a12 seuffert committed Dec 14, 2011
Oops, something went wrong.
View
@@ -310,6 +310,7 @@ private void initWithRegistryValues()
xbs_chat.message_when_nodes_join_or_leave = s.REG_CHAT_NODEINFOMESSAGES;
checkBox_showNewsFeed.Checked = s.REG_SHOW_NEWS_FEED;
textBox_newsFeedUri.Text = s.REG_NEWS_FEED_URI;
+ checkBox_switchToNewsTab.Checked = s.REG_NEWS_FEED_SWITCH_TO_TAB;
if (checkBox_enable_MAC_list.Checked)
checkBox_mac_restriction.Enabled = true;
@@ -352,6 +353,7 @@ private void saveRegistryValues()
s.REG_PREVENT_SYSTEM_STANDY = checkBox_preventSystemStandby.Checked;
s.REG_SHOW_NEWS_FEED = checkBox_showNewsFeed.Checked;
s.REG_NEWS_FEED_URI = textBox_newsFeedUri.Text;
+ s.REG_NEWS_FEED_SWITCH_TO_TAB = checkBox_switchToNewsTab.Checked;
s.Save();
}
@@ -1769,8 +1771,11 @@ private void loadNewsFeed( String url )
return;
}
+ String first_id = null;
foreach (SyndicationItem item in feed.Items)
{
+ if (first_id == null)
+ first_id = item.Id;
String date = item.PublishDate.Month + "-" + item.PublishDate.Day;
richTextBox_newsFeed.SelectionFont = font_head;
richTextBox_newsFeed.SelectionColor = Color.DarkRed;
@@ -1783,6 +1788,13 @@ private void loadNewsFeed( String url )
richTextBox_newsFeed.AppendText(item.Links[0].Uri.ToString() + Environment.NewLine);
richTextBox_newsFeed.AppendText(Environment.NewLine);
}
+
+ if ((first_id != xbs_settings.settings.REG_NEWS_FEED_NEWEST_ID) && checkBox_switchToNewsTab.Checked)
+ {
+ tabControl1.SelectedTab = tabPage_newsFeed;
+ xbs_settings.settings.REG_NEWS_FEED_NEWEST_ID = first_id;
+ xbs_settings.settings.Save();
+ }
}
private void richTextBox_newsFeed_LinkClicked(object sender, LinkClickedEventArgs e)
Oops, something went wrong.
@@ -89,5 +89,11 @@
<Setting Name="REG_NEWS_FEED_URI" Type="System.String" Scope="User">
<Value Profile="(Default)">http://www.secudb.de/~seuffert/xbslink/feed</Value>
</Setting>
+ <Setting Name="REG_NEWS_FEED_NEWEST_ID" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
+ <Setting Name="REG_NEWS_FEED_SWITCH_TO_TAB" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">True</Value>
+ </Setting>
</Settings>
</SettingsFile>
@@ -99,6 +99,12 @@
<setting name="REG_NEWS_FEED_URI" serializeAs="String">
<value>http://www.secudb.de/~seuffert/xbslink/feed</value>
</setting>
+ <setting name="REG_NEWS_FEED_NEWEST_ID" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="REG_NEWS_FEED_SWITCH_TO_TAB" serializeAs="String">
+ <value>True</value>
+ </setting>
</XBSlink.Properties.Settings>
</userSettings>
</configuration>
View
@@ -96,6 +96,12 @@
<setting name="REG_NEWS_FEED_URI" serializeAs="String">
<value>http://www.secudb.de/~seuffert/xbslink/feed</value>
</setting>
+ <setting name="REG_NEWS_FEED_NEWEST_ID" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="REG_NEWS_FEED_SWITCH_TO_TAB" serializeAs="String">
+ <value>True</value>
+ </setting>
</XBSlink.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 976f3dc

Please sign in to comment.