Index: /trunk/MacFaceFloat/MacFaceApp.cs
===================================================================
--- /trunk/MacFaceFloat/MacFaceApp.cs	(revision 57)
+++ /trunk/MacFaceFloat/MacFaceApp.cs	(revision 58)
@@ -74,4 +74,10 @@
 			updateTimer.Tick += new EventHandler(this.CountProcessorUsage);
 
+			patternWindow = null;
+
+			cpuGraph = null;
+			memoryGraph = null;
+			statusWindow = null;
+
 			InitializeComponent();
 		}
@@ -82,10 +88,14 @@
 [
 			ContextMenu contextMenu = new System.Windows.Forms.ContextMenu();
-			MenuItem menuItemPatternSelect = new System.Windows.Forms.MenuItem();
+			MenuItem menuItemShowPatternWindow = new System.Windows.Forms.MenuItem();
+			MenuItem menuItemShowStatusWindow = new System.Windows.Forms.MenuItem();
 			MenuItem menuItemConfigure = new System.Windows.Forms.MenuItem();
 			MenuItem menuItemExit = new System.Windows.Forms.MenuItem();
 
-			menuItemPatternSelect.Text = "çp^[ÌIð(&S)";
-			menuItemPatternSelect.Click += new System.EventHandler(menuItemPatternSelect_Click);
+			menuItemShowPatternWindow.Text = "p^[EChEðJ­(&P)";
+			menuItemShowPatternWindow.Click +=new EventHandler(menuItemShowPatternWindow_Click);
+
+			menuItemShowStatusWindow.Text = "Xe[^XEChEðJ­(&S)";
+			menuItemShowStatusWindow.Click +=new EventHandler(menuItemShowStatusWindow_Click);
 
 			menuItemConfigure.Text = "MacFace ÌÝè(&C)...";
@@ -97,5 +107,5 @@
 
 			contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-					menuItemPatternSelect, menuItemConfigure, new MenuItem("-"), menuItemExit});
+					menuItemShowPatternWindow, menuItemShowStatusWindow, new MenuItem("-"), menuItemConfigure, new MenuItem("-"), menuItemExit});
 
 			// ÊmACR
@@ -106,16 +116,4 @@
 			this.notifyIcon.Visible = true;
 			this.notifyIcon.ContextMenu = contextMenu;
-
-			// p^[EChE
-			this.patternWindow = new PatternWindow();
-			this.patternWindow.Closing += new System.ComponentModel.CancelEventHandler(patternWindow_Closing);
-
-			// Xe[^XEChE
-			cpuGraph = new Bitmap(5*60, 100);
-			memoryGraph = new Bitmap(5*60, 100);
-			statusWindow = new StatusWindow();
-			statusWindow.Closing += new System.ComponentModel.CancelEventHandler(patternWindow_Closing);
-			statusWindow.cpuGraphPicBox.Image = cpuGraph;
-			statusWindow.memoryGraphPicBox.Image = memoryGraph;
 		}
 
@@ -140,24 +138,9 @@
 			}
 
-			drawCPUGraph();
-			drawMemoryGraph();
-			FormBorderStyle orgStyle = statusWindow.FormBorderStyle;
-			statusWindow.FormBorderStyle = FormBorderStyle.Sizable;
-			statusWindow.StartPosition = FormStartPosition.Manual;
-			statusWindow.Location = config.StatusWindowLocation;
-			statusWindow.FormBorderStyle = orgStyle;
-			statusWindow.Show();
-
-			patternWindow.Location = config.Location;
-			patternWindow.Opacity = (float)config.Opacity / 100;
-			patternWindow.PatternSize = (float)config.PatternSize / 100;
-			patternWindow.TransparentMouseMessage = config.TransparentMouseMessage;
-			patternWindow.Refresh();
-
-			patternWindow.Show();
+			openPatternWindow();
+			openStatusWindow();
 			updateTimer.Start();
 
 			Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
-			Microsoft.Win32.SystemEvents.SessionEnding += new Microsoft.Win32.SessionEndingEventHandler(SystemEvents_SessionEnding);
 			Application.Run(this);
 		}
@@ -167,7 +150,4 @@
 			notifyIcon.Visible = false;
 
-			// Û¶
-			config.Location = patternWindow.Location;
-			config.StatusWindowLocation = statusWindow.Location;
 			config.Save();
 		}
@@ -238,14 +218,17 @@
 			}
 
-			// çp^[·µÖ¦ÍXVð~ßÄ¨­
-			if (updateTimer != null) updateTimer.Stop();
-
-			patternWindow.FaceDef = newFaceDef;
-			patternWindow.Refresh();
-
-			notifyIcon.Text = "MacFace - " + patternWindow.FaceDef.Title;
-
-			// XVÄJ
-			if (updateTimer != null) updateTimer.Start();
+			if (patternWindow != null) 
+			{
+				// çp^[·µÖ¦ÍXVð~ßÄ¨­
+				if (updateTimer != null) updateTimer.Stop();
+
+				patternWindow.FaceDef = newFaceDef;
+				patternWindow.Refresh();
+
+				notifyIcon.Text = "MacFace - " + patternWindow.FaceDef.Title;
+
+				// XVÄJ
+				if (updateTimer != null) updateTimer.Start();
+			}
 
 			return true;
@@ -265,28 +248,73 @@
 			if (memHistoryCount < memHistory.Length) memHistoryCount++;
 
-			int pattern = cpuUsage.Active / 10;
-
-			FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal;
-
-			int avilable = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024 - memUsage.Committed;
-			if (avilable < (10 * 1024 *1024)) 
-			{
-				suite = FaceDef.PatternSuite.MemoryInsufficient;
-			} 
-			else if (memUsage.Available < (30 * 1024 *1024)) 
-			{
-				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);
-
+			if (patternWindow != null) 
+			{
+				FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal;
+
+				int pattern = cpuUsage.Active / 10;
+				int avilable = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024 - memUsage.Committed;
+				if (avilable < (10 * 1024 *1024)) 
+				{
+					suite = FaceDef.PatternSuite.MemoryInsufficient;
+				} 
+				else if (memUsage.Available < (30 * 1024 *1024)) 
+				{
+					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);
+			}
+
+			if (statusWindow != null) 
+			{
+				drawCPUGraph();
+				drawMemoryGraph();
+				statusWindow.cpuGraphPicBox.Invalidate();
+				statusWindow.memoryGraphPicBox.Invalidate();
+			}
+		}
+
+		public void openPatternWindow()
+		{
+			// p^[EChE
+			patternWindow = new PatternWindow();
+			patternWindow.Closed += new EventHandler(patternWindow_Closed);
+			patternWindow.Move +=new EventHandler(patternWindow_Move);
+
+			LoadFaceDefine(config.FaceDefPath);
+
+			patternWindow.Location = config.Location;
+			patternWindow.Opacity = (float)config.Opacity / 100;
+			patternWindow.PatternSize = (float)config.PatternSize / 100;
+			patternWindow.TransparentMouseMessage = config.TransparentMouseMessage;
+			patternWindow.Refresh();
+
+			patternWindow.Show();
+		}
+
+		public void openStatusWindow()
+		{
+			statusWindow = new StatusWindow();
+			statusWindow.Closed += new EventHandler(statusWindow_Closed);
+			statusWindow.Move +=new EventHandler(statusWindow_Move);
+
+			FormBorderStyle orgStyle = statusWindow.FormBorderStyle;
+			statusWindow.FormBorderStyle = FormBorderStyle.Sizable;
+			statusWindow.StartPosition = FormStartPosition.Manual;
+			statusWindow.Location = config.StatusWindowLocation;
+			statusWindow.FormBorderStyle = orgStyle;
+
+			cpuGraph = new Bitmap(5*60, 100);
+			memoryGraph = new Bitmap(5*60, 100);
+			statusWindow.cpuGraphPicBox.Image = cpuGraph;
+			statusWindow.memoryGraphPicBox.Image = memoryGraph;
 			drawCPUGraph();
 			drawMemoryGraph();
-			statusWindow.cpuGraphPicBox.Invalidate();
-			statusWindow.memoryGraphPicBox.Invalidate();
+
+			statusWindow.Show();
 		}
 
@@ -303,5 +331,15 @@
 		{
 			updateTimer.Stop();
-			patternWindow.Close();
+
+			if (patternWindow != null)
+			{
+				patternWindow.Close();
+			}
+
+			if (statusWindow != null) 
+			{
+				statusWindow.Close();
+			}
+
 			ExitThread();
 		}
@@ -325,9 +363,12 @@
 				}
 			}
-			
-			patternWindow.Opacity = (float)config.Opacity / 100;
-			patternWindow.PatternSize = (float)config.PatternSize / 100;
-			patternWindow.TransparentMouseMessage = config.TransparentMouseMessage;
-			patternWindow.Refresh();
+
+			if (patternWindow != null) 
+			{
+				patternWindow.Opacity = (float)config.Opacity / 100;
+				patternWindow.PatternSize = (float)config.PatternSize / 100;
+				patternWindow.TransparentMouseMessage = config.TransparentMouseMessage;
+				patternWindow.Refresh();
+			}
 		}
 
@@ -468,19 +509,44 @@
 		}
 
-		private void patternWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
-		{
-			if (!doExit)
-			{
-				e.Cancel = true;
-			}
-		}
-
-		private void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e)
-		{
-			doExit = true;
-			updateTimer.Stop();
-			patternWindow.Close();
-			statusWindow.Close();
-			ExitThread();
+		private void patternWindow_Closed(object sender, EventArgs e)
+		{
+			patternWindow.Dispose();
+			patternWindow = null;
+		}
+
+		private void statusWindow_Closed(object sender, EventArgs e)
+		{
+			cpuGraph.Dispose();
+			cpuGraph = null;
+			memoryGraph.Dispose();
+			memoryGraph = null;
+			statusWindow.Dispose();
+			statusWindow = null;
+		}
+
+		private void menuItemShowPatternWindow_Click(object sender, EventArgs e)
+		{
+			if (patternWindow == null) 
+			{
+				openPatternWindow();
+			}
+		}
+
+		private void menuItemShowStatusWindow_Click(object sender, EventArgs e)
+		{
+			if (statusWindow == null) 
+			{
+				openStatusWindow();
+			}
+		}
+
+		private void patternWindow_Move(object sender, EventArgs e)
+		{
+			config.Location = patternWindow.Location;
+		}
+
+		private void statusWindow_Move(object sender, EventArgs e)
+		{
+			config.StatusWindowLocation = statusWindow.Location;
 		}
 	}
Index: /trunk/MacFaceFloat/StatusWindow.cs
===================================================================
--- /trunk/MacFaceFloat/StatusWindow.cs	(revision 57)
+++ /trunk/MacFaceFloat/StatusWindow.cs	(revision 58)
@@ -80,5 +80,4 @@
 			this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
 			this.ClientSize = new System.Drawing.Size(314, 232);
-			this.ControlBox = false;
 			this.Controls.Add(this.cpuGraphPicBox);
 			this.Controls.Add(this.memoryGraphPicBox);
