Index: trunk/MacFaceFloat/MacFaceApp.cs
===================================================================
--- trunk/MacFaceFloat/MacFaceApp.cs	(revision 111)
+++ trunk/MacFaceFloat/MacFaceApp.cs	(revision 117)
@@ -13,4 +13,6 @@
 using System.IO;
 using System.Reflection;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
 
 namespace MacFace.FloatApp
@@ -41,5 +43,7 @@
 		private MacFace.FaceDef curFaceDef;
 
-		[STAThread]
+        private IOptimusMini optimusMini;
+
+        [STAThread]
 		public static void Main(string[] args)
 		{
@@ -126,8 +130,15 @@
 			}
 
+            //IOptimusMini.OnKeyDownCallbackDelegate oKD = new IOptimusMini.OnKeyDownCallbackDelegate(OnKeyDownCallbackHandler);
+            //IOptimusMini.OnDeviceStateChangedCallbackDelegate oDSC = new IOptimusMini.OnDeviceStateChangedCallbackDelegate(OnDeviceStateChangedCallbackHandler);
+            //IOptimusMini.RegisterEventHandler(oKD, oDSC);
+
             patternWindow = null;
             statusWindow = null;
 
             InitializeComponent();
+
+            optimusMini = new IOptimusMini();
+            optimusMini.DisplayOn();
 
             CountProcessorUsage(null, null);
@@ -138,4 +149,14 @@
 			updateTimer.Tick += new EventHandler(this.CountProcessorUsage);
 		}
+
+        void OnKeyDownCallbackHandler(int key)
+        {
+            Console.Write("Keydown {0}\n", key);
+        }
+
+        void OnDeviceStateChangedCallbackHandler(int state)
+        {
+            //useOptimusMini = (state > 0);
+        }
 
 		void InitializeComponent() 
@@ -232,7 +253,7 @@
 		{
 			notifyIcon.Visible = false;
-
 			config.Save();
-		}
+            optimusMini.Dispose();
+        }
 
 		public bool LoadFaceDefine(string path)
@@ -302,27 +323,27 @@
 			if (pageio_count < 0) pageio_count = 0;
 
+			int pattern = cpuUsage.Active / 10;
+			pattern += memUsage.Pageout / 15;
+			pattern += memUsage.Pagein / 30;
+			if (pattern > 10) pattern = 10;
+
+			FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal;
+
+			UInt64 avilable = (UInt64)memStats.TotalVisibleMemorySize * 1024 - memUsage.Used;
+            if (pageio_count > 100) 
+			{
+				suite = FaceDef.PatternSuite.MemoryInsufficient;
+			}
+            else if (avilable < 0) 
+			{
+				suite = FaceDef.PatternSuite.MemoryDecline;
+			}
+
+			int markers = FaceDef.MarkerNone;
+			if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn;
+			if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut;
+
 			if (patternWindow != null) 
 			{
-				int pattern = cpuUsage.Active / 10;
-				pattern += memUsage.Pageout / 15;
-				pattern += memUsage.Pagein / 30;
-				if (pattern > 10) pattern = 10;
-
-				FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal;
-
-				UInt64 avilable = (UInt64)memStats.TotalVisibleMemorySize * 1024 - memUsage.Used;
-                if (pageio_count > 100) 
-				{
-					suite = FaceDef.PatternSuite.MemoryInsufficient;
-				}
-                else if (avilable < 0) 
-				{
-					suite = FaceDef.PatternSuite.MemoryDecline;
-				}
-
-				int markers = FaceDef.MarkerNone;
-				if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn;
-				if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut;
-
 				patternWindow.UpdatePattern(suite, pattern, markers);
 			}
@@ -332,4 +353,15 @@
 				statusWindow.UpdateGraph();
 			}
+
+            if (optimusMini.IsAlive && curFaceDef != null)
+            {
+                Bitmap image = new Bitmap(96, 96);
+                Graphics g = Graphics.FromImage(image);
+                g.FillRectangle(new SolidBrush(Color.White), 0, 0, image.Width, image.Height);
+                curFaceDef.DrawPatternImage(g, suite, pattern, markers, 96F / 128F);
+                g.Dispose();
+
+                optimusMini.ShowPicture(1, image);
+            }
 		}
 
@@ -414,15 +446,15 @@
 		private void configForm_ConfigChanged()
 		{
-			if (patternWindow.FaceDef.Path != config.FaceDefPath) 
-			{
-				bool result = LoadFaceDefine(config.FaceDefPath);
-				// p^[ÏXÉ¸sµ½çÝèð³Éß·
-				if (!result) 
-				{
-					config.FaceDefPath = patternWindow.FaceDef.Path;
-				}
-			}
-
-			if (patternWindow != null) 
+            if (curFaceDef.Path != config.FaceDefPath)
+            {
+                bool result = LoadFaceDefine(config.FaceDefPath);
+                // p^[ÏXÉ¸sµ½çÝèð³Éß·
+                if (!result)
+                {
+                    config.FaceDefPath = patternWindow.FaceDef.Path;
+                }
+            }
+
+            if (patternWindow != null) 
 			{
 				patternWindow.Opacity = (float)config.Opacity / 100;
