Permalink
Browse files

added reg settings for news feed

  • Loading branch information...
1 parent 6b9ea33 commit 3c5f4f29eb2795cfe240995c08d0e65bc8321dcb seuffert committed Dec 14, 2011
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -97,7 +97,9 @@ partial class FormMain : Form
SharpPcap.CaptureDeviceList pcap_devices = null;
private Dictionary<IPAddress, GatewayIPAddressInformationCollection> network_device_gateways = new Dictionary<IPAddress, GatewayIPAddressInformationCollection>();
-
+
+ private TabPage tab_newsfeed = null;
+
public FormMain()
{
#if DEBUG
@@ -155,7 +157,8 @@ private void Form1_Load(object sender, EventArgs e)
tabControl1.SelectedTab = tabPage_settings;
autoswitch_on_chat_message = checkBox_chatAutoSwitch.Checked;
- loadNewsFeed();
+ if (checkBox_showNewsFeed.Checked)
+ loadNewsFeed(textBox_newsFeedUri.Text);
}
private void ShowVersionInfoMessages()
@@ -305,6 +308,8 @@ private void initWithRegistryValues()
checkBox_minimize2systray.Checked = s.REG_MINIMIZE2SYSTRAY;
checkBox_preventSystemStandby.Checked = s.REG_PREVENT_SYSTEM_STANDY;
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;
if (checkBox_enable_MAC_list.Checked)
checkBox_mac_restriction.Enabled = true;
@@ -345,6 +350,8 @@ private void saveRegistryValues()
s.REG_SNIFFER_FORWARD_ALL_HIGH_PORT_BROADCASTS = checkBox_forward_all_high_port_broadcast.Checked;
s.REG_MINIMIZE2SYSTRAY = checkBox_minimize2systray.Checked;
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.Save();
}
@@ -1730,10 +1737,11 @@ private void checkBox_preventSystemStandby_CheckedChanged(object sender, EventAr
xbs_system_functions.restoreSystemSleepState();
}
- private void loadNewsFeed()
+ private void loadNewsFeed( String url )
{
+ richTextBox_newsFeed.Clear();
+
string result = null;
- String url = "http://www.secudb.de/~seuffert/xbslink/feed";
WebClient client = new WebClient();
client.Proxy = null;
try
@@ -1742,16 +1750,25 @@ private void loadNewsFeed()
}
catch (WebException wex)
{
- // handle error
- MessageBox.Show("Error loading news feed: " + wex.Message);
+ richTextBox_newsFeed.AppendText("Error loading news feed: " + wex.Message);
return;
}
FontFamily myFontFamily = new FontFamily("Arial");
Font font_head = new Font(myFontFamily, 14, FontStyle.Bold, GraphicsUnit.Pixel);
Font font_summary = new Font(myFontFamily, 10, FontStyle.Regular, GraphicsUnit.Pixel);
- SyndicationFeed feed = SyndicationFeed.Load(XmlReader.Create(new System.IO.StringReader(result)));
+ SyndicationFeed feed;
+ try
+ {
+ feed = SyndicationFeed.Load(XmlReader.Create(new System.IO.StringReader(result)));
+ }
+ catch (Exception ex)
+ {
+ richTextBox_newsFeed.AppendText("Error parsing news feed");
+ return;
+ }
+
foreach (SyndicationItem item in feed.Items)
{
String date = item.PublishDate.Month + "-" + item.PublishDate.Day;
@@ -1777,5 +1794,18 @@ private void richTextBox_about_LinkClicked(object sender, LinkClickedEventArgs e
{
System.Diagnostics.Process.Start(e.LinkText);
}
+
+ private void checkBox_showNewsFeed_CheckedChanged(object sender, EventArgs e)
+ {
+ if (checkBox_showNewsFeed.Checked)
+ {
+ tabControl1.TabPages.Insert(0, tabPage_newsFeed);
+ loadNewsFeed( textBox_newsFeedUri.Text );
+ }
+ else
+ {
+ tabControl1.TabPages.Remove(tabPage_newsFeed);
+ }
+ }
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -83,5 +83,11 @@
<Setting Name="REG_PREVENT_SYSTEM_STANDY" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
+ <Setting Name="REG_SHOW_NEWS_FEED" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">True</Value>
+ </Setting>
+ <Setting Name="REG_NEWS_FEED_URI" Type="System.String" Scope="User">
+ <Value Profile="(Default)">http://www.secudb.de/~seuffert/xbslink/feed</Value>
+ </Setting>
</Settings>
</SettingsFile>
@@ -93,6 +93,12 @@
<setting name="REG_PREVENT_SYSTEM_STANDY" serializeAs="String">
<value>True</value>
</setting>
+ <setting name="REG_SHOW_NEWS_FEED" serializeAs="String">
+ <value>True</value>
+ </setting>
+ <setting name="REG_NEWS_FEED_URI" serializeAs="String">
+ <value>http://www.secudb.de/~seuffert/xbslink/feed</value>
+ </setting>
</XBSlink.Properties.Settings>
</userSettings>
</configuration>
View
@@ -90,6 +90,12 @@
<setting name="REG_PREVENT_SYSTEM_STANDY" serializeAs="String">
<value>True</value>
</setting>
+ <setting name="REG_SHOW_NEWS_FEED" serializeAs="String">
+ <value>True</value>
+ </setting>
+ <setting name="REG_NEWS_FEED_URI" serializeAs="String">
+ <value>http://www.secudb.de/~seuffert/xbslink/feed</value>
+ </setting>
</XBSlink.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 3c5f4f2

Please sign in to comment.