Index: trunk/MacFaceFloat/MainForm.cs
===================================================================
--- trunk/MacFaceFloat/MainForm.cs	(revision 30)
+++ trunk/MacFaceFloat/MainForm.cs	(revision 20)
@@ -21,5 +21,4 @@
 	public class MainForm : Misuzilla.Windows.Forms.AlphaForm
 	{
-		private System.Windows.Forms.NotifyIcon notifyIcon;
 		private System.Windows.Forms.ContextMenu contextMenu;
 		private System.Windows.Forms.MenuItem menuItemPatternSelect;
@@ -31,12 +30,9 @@
 		private FaceDef _currentFaceDef;
 		private Configuration _config;
-		private float _patternSize;
-
-		private int prevPattern;
-		private FaceDef.PatternSuite prevSuite;
-		private int prevMarkers;
-
-		private CPUUsageCounter cpuCounter;
-		private MemoryUsageCounter memoryCounter;
+		
+		Int32 prevUsage;
+		PerformanceCounter cpuCount;
+		PerformanceCounter pageoutCount;
+		PerformanceCounter pageinCount;
 
 		// RXgN^
@@ -47,10 +43,18 @@
 			this.MoveAtFormDrag = true;
 
-			prevPattern = -1;
-			prevSuite   = FaceDef.PatternSuite.Normal;
-			prevMarkers = -1;
-
-			cpuCounter = new CPUUsageCounter();
-			memoryCounter = new MemoryUsageCounter();
+			prevUsage = -10;
+
+			cpuCount = new PerformanceCounter();
+			cpuCount.CategoryName = "Processor";
+			cpuCount.CounterName  = "% Processor Time";
+			cpuCount.InstanceName = "_Total";
+
+			pageoutCount = new PerformanceCounter();
+			pageoutCount.CategoryName = "Memory";
+			pageoutCount.CounterName  = "Pages Output/sec";
+
+			pageinCount = new PerformanceCounter();
+			pageinCount.CategoryName = "Memory";
+			pageinCount.CounterName  = "Pages Input/sec";
 
 			_updateTimer = new System.Windows.Forms.Timer();
@@ -61,18 +65,8 @@
 
 		void InitializeComponent() {
-			this.notifyIcon = new System.Windows.Forms.NotifyIcon();
 			this.menuItemPatternSelect = new System.Windows.Forms.MenuItem();
 			this.menuItemConfigure = new System.Windows.Forms.MenuItem();
 			this.menuItemExit = new System.Windows.Forms.MenuItem();
 			this.contextMenu = new System.Windows.Forms.ContextMenu();
-
-			//
-			// notifyIcon
-			//
-			this.notifyIcon.Text = "MacFace";
-			this.notifyIcon.Icon = this.Icon;
-			this.notifyIcon.Visible = true;
-			this.notifyIcon.ContextMenu = this.contextMenu;
-
 			// 
 			// menuItemPatternSelect
@@ -195,7 +189,5 @@
 			_currentFaceDef = newFaceDef;
 			_facePath = _currentFaceDef.Path;
-			notifyIcon.Text = "MacFace - " + _currentFaceDef.Title;
-			prevPattern = -1;
-			prevMarkers = -1;
+			prevUsage = -10;
 
 			// XVÄJ
@@ -207,41 +199,30 @@
 		public void CountProcessorUsage(object sender, EventArgs e)
 		{
-			CPUUsage cpuUsage = cpuCounter.CurrentUsage();
-			MemoryUsage memUsage = memoryCounter.CurrentUsage();
-
-			int pattern = cpuUsage.Active / 10;
-
-			FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal;
-			if (memUsage.Available < (10 * 1024 *1024)) 
-			{
-				suite = FaceDef.PatternSuite.MemoryInsufficient;
-			} 
-			else if (memUsage.Available < (30 * 1024 *1024)) 
-			{
-				suite = FaceDef.PatternSuite.MemoryDecline;
+			int usage = (int)cpuCount.NextValue();
+			int pagein = (int)pageinCount.NextValue();
+			int pageout = (int)pageoutCount.NextValue();
+
+			usage /= 10;
+			if (usage > 10) {
+				usage = 10;
+			} else if (usage < 0) {
+				usage = 0;
 			}
 
 			int markers = FaceDef.MarkerNone;
-			if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn;
-			if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut;
-
-			if (prevPattern != pattern || prevSuite != suite || prevMarkers != markers) 
+			if (pagein > 0) markers += FaceDef.MarkerPageIn;
+			if (pageout > 0) markers += FaceDef.MarkerPageOut;
+
+			if (prevUsage != usage) 
 			{
 				Graphics g = this.Graphics;
 				g.Clear(Color.FromArgb(0, 0, 0, 0));
-				_currentFaceDef.DrawPatternImage(g, suite, pattern, markers, _patternSize);
+				_currentFaceDef.DrawPatternImage(g, FaceDef.PatternSuite.Normal, usage, markers);
 				this.Update();
 			}
 				
-			prevPattern = pattern;
-			prevSuite   = suite;
-			prevMarkers = markers;
-		}
-
-		public float PatternSize
-		{
-			get { return _patternSize; }
-			set { _patternSize = value; }
-		}
+			prevUsage = usage;			
+		}
+		
 
 		//
@@ -279,6 +260,4 @@
 		private void MainForm_Closing(object sender, CancelEventArgs e)
 		{
-			notifyIcon.Visible = false;
-
 			// Û¶
 			_config.Opacity = (int) (this.Opacity * 100);
@@ -318,5 +297,4 @@
 		{
 			this.Opacity = (float)_config.Opacity / 100;
-			this.PatternSize = (float)_config.PatternSize / 100;
 			this.Location = _config.Location;
 			this.TransparentMouseMessage = _config.TransparentMouseMessage;
