using System; using System.IO; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using blurxml; //blursoft XML-related classes (particularly RSS stuff) using HeadlineManager; namespace blurbsnews { /// /// Summary description for Form1. /// Form 1 is the fronen, sucka /// public class Form1 : System.Windows.Forms.Form { private RSSReader rss_reader; private HeadlineFilter rss_filter; private XmlHeadlineManager hmgr; private System.ComponentModel.IContainer components; private System.Windows.Forms.Timer moveDownTimer; private System.Windows.Forms.Timer moveUpTimer; private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.ContextMenu contextMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.Timer checkNewTimer; private System.Windows.Forms.MenuItem menuItem3; private Screen screen = Screen.PrimaryScreen; private int maxAppHeight; private double opChangeVal; private int moveIncrement; private System.Windows.Forms.Panel panel1; private AxSHDocVw.AxWebBrowser axWebBrowser1; private bool toggle; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); rss_reader = new RSSReader( ); Headline[] sr = rss_reader.process_feed( rss_reader.slashdot ); rss_filter = new HeadlineFilter( sr ); hmgr = new XmlHeadlineManager( ); hmgr.add_headlines( sr ); hmgr.transform_to_html( ); Object o = null; //better ways? what are the following params? axWebBrowser1.Navigate("c:\\program files\\bsnews\\headlines.html",ref o,ref o,ref o, ref o); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.moveDownTimer = new System.Windows.Forms.Timer(this.components); this.moveUpTimer = new System.Windows.Forms.Timer(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.contextMenu1 = new System.Windows.Forms.ContextMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.checkNewTimer = new System.Windows.Forms.Timer(this.components); this.panel1 = new System.Windows.Forms.Panel(); this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit(); this.SuspendLayout(); // // moveDownTimer // this.moveDownTimer.Interval = 10; this.moveDownTimer.Tick += new System.EventHandler(this.moveDownTimer_Tick); // // moveUpTimer // this.moveUpTimer.Interval = 10; this.moveUpTimer.Tick += new System.EventHandler(this.moveUpTimer_Tick); // // notifyIcon1 // this.notifyIcon1.ContextMenu = this.contextMenu1; this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); this.notifyIcon1.Text = "notifyIcon1"; this.notifyIcon1.Visible = true; // // contextMenu1 // this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem2, this.menuItem3}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.Text = "Close"; this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); // // menuItem2 // this.menuItem2.Index = 1; this.menuItem2.Text = "Open"; this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); // // menuItem3 // this.menuItem3.Index = 2; this.menuItem3.Text = "Hide"; this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); // // checkNewTimer // this.checkNewTimer.Enabled = true; this.checkNewTimer.Interval = 1600000; this.checkNewTimer.Tick += new System.EventHandler(this.checkNewTimer_Tick); // // panel1 // this.panel1.BackColor = System.Drawing.Color.Silver; this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] { this.axWebBrowser1}); this.panel1.Location = new System.Drawing.Point(5, 4); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(429, 152); this.panel1.TabIndex = 0; // // axWebBrowser1 // this.axWebBrowser1.ContainingControl = this; this.axWebBrowser1.Enabled = true; this.axWebBrowser1.Location = new System.Drawing.Point(16, 16); this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState"))); this.axWebBrowser1.Size = new System.Drawing.Size(392, 120); this.axWebBrowser1.TabIndex = 0; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224))); this.ClientSize = new System.Drawing.Size(440, 160); this.ControlBox = false; this.Controls.AddRange(new System.Windows.Forms.Control[] { this.panel1}); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "bsnews"; this.Load += new System.EventHandler(this.Form1_Load); this.panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit(); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void button1_Click(object sender, System.EventArgs e) { this.Close(); } private void button1_Click_1(object sender, System.EventArgs e) { moveDownTimer.Enabled = true; } private void Form1_Load(object sender, System.EventArgs e) { maxAppHeight = 160; moveIncrement = 2; opChangeVal = (double)moveIncrement / (double)maxAppHeight; this.Left = screen.WorkingArea.Width - this.Width; this.Top = screen.WorkingArea.Height - this.Height; toggle = true; } private void setHeadlines() { } private void moveDownTimer_Tick(object sender, System.EventArgs e) { if (this.Top < screen.WorkingArea.Height) { this.Top = this.Top + this.moveIncrement; //this.Height = this.Height - this.moveIncrement; /*if (toggle) { if (this.Opacity > 0.05) { this.Opacity = this.Opacity - (opChangeVal * 2); } toggle = false; } else { toggle = true; }*/ } else { moveDownTimer.Enabled = false; } } private void moveUpTimer_Tick(object sender, System.EventArgs e) { if (this.Top > (screen.WorkingArea.Height - this.maxAppHeight)) { //this.Height = this.Height + this.moveIncrement; this.Top = this.Top - this.moveIncrement; /*if (toggle) { if (this.Opacity < 1) { this.Opacity = this.Opacity + opChangeVal*2; } toggle=false; } else { toggle=true; }*/ } else { moveUpTimer.Enabled = false; } } private void menuItem1_Click(object sender, System.EventArgs e) { this.Close(); } private void menuItem2_Click(object sender, System.EventArgs e) { this.BringToFront(); moveUpTimer.Enabled = true; } private void checkNewTimer_Tick(object sender, System.EventArgs e) { checkForNew(); } private void checkForNew() { Headline[] headlines = rss_reader.process_feed( rss_reader.slashdot ); Headline[] newones = rss_filter.filter_for_new( headlines ); hmgr.add_headlines( newones ); hmgr.transform_to_html( ); Object o = null; axWebBrowser1.Navigate("c:\\program files\\bsnews\\headlines.html",ref o,ref o,ref o,ref o); } private void menuItem3_Click(object sender, System.EventArgs e) { this.moveDownTimer.Enabled = true; } } }