Index: /trunk/MacFaceFloat/ConfigurationForm.cs
===================================================================
--- /trunk/MacFaceFloat/ConfigurationForm.cs	(revision 38)
+++ /trunk/MacFaceFloat/ConfigurationForm.cs	(revision 39)
@@ -3,4 +3,5 @@
 using System.Collections;
 using System.ComponentModel;
+using System.Diagnostics;
 using System.Windows.Forms;
 using System.IO;
@@ -14,5 +15,5 @@
 	public class ConfigurationForm : System.Windows.Forms.Form
 	{
-		private MainForm _mainForm;
+		private MacFaceApp _app;
 		private Configuration _config;
 
@@ -42,5 +43,5 @@
 		private System.ComponentModel.IContainer components;
 
-		public ConfigurationForm(MainForm mainForm)
+		public ConfigurationForm(MacFaceApp app)
 		{
 			//
@@ -49,7 +50,6 @@
 			InitializeComponent();
 
-			_mainForm = mainForm;
 			_config = Configuration.GetInstance();
-
+			_app = app;
 		}
 
@@ -371,5 +371,10 @@
 		private void ConfigurationForm_Load(object sender, System.EventArgs e)
 		{
-			// SÊð\¦B
+			// úlÌZbg
+			trackBarOpacity.Value = _config.Opacity;
+			trackBarPatternSize.Value = _config.PatternSize;
+			checkMouseMessage.Checked = _config.TransparentMouseMessage;
+
+			// êx·×ÄÌplðñ\¦É·é
 			foreach (Panel pane in panelContainer.Controls) 
 			{
@@ -378,18 +383,13 @@
 			}
 
+			// SÊÌÝðÂÉ·é
 			panelAppearance.Show();
-
-			// úlðZbgB
-			trackBarOpacity.Value = (int) (_mainForm.Opacity * 100);
-			trackBarPatternSize.Value = (int)(_mainForm.PatternSize * 100);
-			checkMouseMessage.Checked = Configuration.GetInstance().TransparentMouseMessage;
 		}
 
 		private void buttonOK_Click(object sender, System.EventArgs e)
 		{
-			Configuration config = Configuration.GetInstance();
-			config.Opacity = trackBarOpacity.Value;
-			config.PatternSize = trackBarPatternSize.Value;
-			config.TransparentMouseMessage = checkMouseMessage.Checked;
+			_config.Opacity = trackBarOpacity.Value;
+			_config.PatternSize = trackBarPatternSize.Value;
+			_config.TransparentMouseMessage = checkMouseMessage.Checked;
 
 			this.Close();
@@ -514,5 +514,6 @@
 			if (item != null) 
 			{
-				_mainForm.LoadFaceDefine(item.SubItems[1].Text);
+				// TODO: ±±¾¯A^CÉÝèàeª½f³êéÌÍ½¥ÁÛ¢
+				_app.LoadFaceDefine(item.SubItems[1].Text);
 			}
 		}
@@ -533,5 +534,5 @@
 			try 
 			{
-				System.Diagnostics.Process.Start(linkWebSite.Text);
+				Process.Start(linkWebSite.Text);
 			} 
 			catch (Win32Exception) {}
Index: /trunk/MacFaceFloat/MacFaceApp.cs
===================================================================
--- /trunk/MacFaceFloat/MacFaceApp.cs	(revision 39)
+++ /trunk/MacFaceFloat/MacFaceApp.cs	(revision 39)
@@ -0,0 +1,268 @@
+/*
+ * MacFace AvP[VNX
+ *
+ * $Id$
+ * 
+ * project created on 2004/06/02 at 2:43
+ * 
+ */
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Data;
+using System.IO;
+using System.Reflection;
+
+namespace MacFace.FloatApp
+{
+	/// <summary>
+	/// MacFaceApp ÌTvÌà¾Å·B
+	/// </summary>
+	public class MacFaceApp : ApplicationContext
+	{
+
+		private Configuration config;
+
+		private NotifyIcon notifyIcon;
+		private MainForm patternWindow;
+		
+		private System.Windows.Forms.Timer updateTimer;
+		private CPUUsageCounter cpuCounter;
+		private MemoryUsageCounter memoryCounter;
+
+
+		[STAThread]
+		public static void Main(string[] args)
+		{
+			MacFaceApp app = new MacFaceApp();
+			app.StartApplication();
+		}
+
+		public MacFaceApp()
+		{
+			config = Configuration.GetInstance();
+			config.Load();
+
+			cpuCounter = new CPUUsageCounter();
+			memoryCounter = new MemoryUsageCounter();
+
+			updateTimer = new System.Windows.Forms.Timer();
+			updateTimer.Enabled = false;
+			updateTimer.Interval = 1000;
+			updateTimer.Tick += new EventHandler(this.CountProcessorUsage);
+
+			InitializeComponent();
+		}
+
+		void InitializeComponent() 
+		{
+			// ReLXgj
+[
+			ContextMenu contextMenu = new System.Windows.Forms.ContextMenu();
+			MenuItem menuItemPatternSelect = 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);
+
+			menuItemConfigure.Text = "MacFace ÌÝè(&C)...";
+			menuItemConfigure.Click +=new EventHandler(menuItemConfigure_Click);
+
+			menuItemExit.Index = 0;
+			menuItemExit.Text = "I¹(&X)";
+			menuItemExit.Click += new System.EventHandler(menuItemExit_Click);
+
+			contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+					menuItemPatternSelect, menuItemConfigure, new MenuItem("-"), menuItemExit});
+
+			// ÊmACR
+			Assembly asm = Assembly.GetExecutingAssembly();
+			this.notifyIcon = new System.Windows.Forms.NotifyIcon();
+			this.notifyIcon.Text = "MacFace";
+			this.notifyIcon.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico"));
+			this.notifyIcon.Visible = true;
+			this.notifyIcon.ContextMenu = contextMenu;
+
+			// p^[EChE
+			this.patternWindow = new MainForm();
+		}
+
+		public void StartApplication()
+		{
+			// çp^[ÇÝÝ
+			bool result = false;
+			if (Directory.Exists(config.FaceDefPath))
+			{
+				result = LoadFaceDefine(config.FaceDefPath);
+			}
+
+			if (!result)
+			{
+				if (!SelectFaceDefine(Application.StartupPath))
+				{
+					Application.Exit();
+					return;
+				}
+			}
+
+			Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
+
+			patternWindow.Location = config.Location;
+			ApplyConfiguration();
+
+			patternWindow.Show();
+			updateTimer.Start();
+
+			Application.Run(this);
+		}
+
+		void Application_ApplicationExit(object sender, EventArgs e)
+		{
+			notifyIcon.Visible = false;
+
+			// Û¶
+			config.FaceDefPath = patternWindow.FaceDef.Path;
+			config.Location = patternWindow.Location;
+			config.Save();
+		}
+
+		/*
+		 * çp^[è`tH_Ið
+		 */
+		public bool SelectFaceDefine()
+		{
+			return SelectFaceDefine(Application.StartupPath);
+		}
+
+		public bool SelectFaceDefine(string defaultPath)
+		{
+			while (true) 
+			{
+				FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
+				folderBrowser.SelectedPath = defaultPath;
+				folderBrowser.Description = "çp^[t@CÌ¶Ý·étH_ðIðµÄ­¾³¢B";
+				if (folderBrowser.ShowDialog() == DialogResult.OK) 
+				{
+					if (LoadFaceDefine(folderBrowser.SelectedPath)) 
+					{
+						return true;
+					}
+				}
+				else 
+				{
+					return false;
+				}
+			}
+
+		}
+
+
+		public bool LoadFaceDefine(string path)
+		{
+			FaceDef newFaceDef = null;
+			string plistPath = Path.Combine(path, "faceDef.plist");
+
+			if (!File.Exists(plistPath))
+			{
+				System.Windows.Forms.MessageBox.Show(
+					String.Format("wè³ê½tH_Éçp^[è`XMLt@C \"faceDef.plist\" ª¶ÝµÜ¹ñB\n\ntH_:\n{0}", path),
+					"MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
+				return false;
+			}
+			
+			try 
+			{
+				newFaceDef = new MacFace.FaceDef(path);
+			} 
+			catch (System.IO.IOException ie) 
+			{
+				System.Windows.Forms.MessageBox.Show(
+					String.Format("çp^[è`XMLt@CðÇÝÞÛÉG[ª­¶µÜµ½B\n\n´ö:\n{0}",
+					ie.ToString()), "MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
+				
+				return false;
+			}
+			catch (System.Xml.XmlException xe) 
+			{
+				System.Windows.Forms.MessageBox.Show(
+					String.Format("çp^[è`XMLt@CðÇÝÉG[ª­¶µÜµ½B\n\n´ö:\n{0}",
+					xe.ToString()), "MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
+				
+				return false;
+			}
+
+			// çp^[·µÖ¦ÍXVð~ßÄ¨­
+			if (updateTimer != null) updateTimer.Stop();
+
+			patternWindow.FaceDef = newFaceDef;
+			patternWindow.RefreshPattern();
+
+			notifyIcon.Text = "MacFace - " + patternWindow.FaceDef.Title;
+
+			// XVÄJ
+			if (updateTimer != null) updateTimer.Start();
+
+			return true;
+		}
+
+		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 markers = FaceDef.MarkerNone;
+			if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn;
+			if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut;
+
+			patternWindow.UpdatePattern(suite, pattern, markers);
+		}
+
+		// TODO:[fBOÌúÝèÆÝèÏXÌ½fÍª¯é×«
+		private void ApplyConfiguration()
+		{
+			patternWindow.Opacity = (float)config.Opacity / 100;
+			patternWindow.PatternSize = (float)config.PatternSize / 100;
+			patternWindow.TransparentMouseMessage = config.TransparentMouseMessage;
+
+			patternWindow.RefreshPattern();
+		}
+
+		/*
+		 * j
+[NbNCxg
+		 */
+		public void menuItemPatternSelect_Click(object sender, System.EventArgs e)
+		{
+			SelectFaceDefine(patternWindow.FaceDef.Path);	
+		}
+
+		public void menuItemExit_Click(object sender, System.EventArgs e)
+		{
+			updateTimer.Stop();
+			patternWindow.Close();
+			ExitThread();
+		}
+
+		private void menuItemConfigure_Click(object sender, EventArgs e)
+		{
+			ConfigurationForm configForm = new ConfigurationForm(this);
+			if (configForm.ShowDialog() == DialogResult.OK) 
+			{
+				ApplyConfiguration();
+			}
+		}
+	}
+}
Index: /trunk/MacFaceFloat/MacFaceFloat.csproj
===================================================================
--- /trunk/MacFaceFloat/MacFaceFloat.csproj	(revision 38)
+++ /trunk/MacFaceFloat/MacFaceFloat.csproj	(revision 39)
@@ -144,4 +144,9 @@
                 />
                 <File
+                    RelPath = "MacFaceApp.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "MainForm.cs"
                     SubType = "Form"
Index: /trunk/MacFaceFloat/MainForm.cs
===================================================================
--- /trunk/MacFaceFloat/MainForm.cs	(revision 38)
+++ /trunk/MacFaceFloat/MainForm.cs	(revision 39)
@@ -1,7 +1,6 @@
 /*
- * MainForm.cs
+ * MacFace p^[EChENX
+ *
  * $Id$
- * 
- * project created on 2004/06/02 at 2:43
  * 
  */
@@ -10,11 +9,4 @@
 using System.Windows.Forms;
 using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Data;
-using System.IO;
-using System.Diagnostics;
-using System.Threading;
-using System.Reflection;
 
 namespace MacFace.FloatApp
@@ -22,28 +14,10 @@
 	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;
-		private System.Windows.Forms.MenuItem menuItemConfigure;
-		private System.Windows.Forms.MenuItem menuItemExit;
+		private FaceDef curFaceDef;
+		private float patternSize;
 
-		private Configuration _config;
-
-		private System.Windows.Forms.Timer _updateTimer;
-		private CPUUsageCounter cpuCounter;
-		private MemoryUsageCounter memoryCounter;
-
-		private FaceDef _currentFaceDef;
-		private float _patternSize;
 		private FaceDef.PatternSuite curSuite;
 		private int curPattern;
 		private int curMarkers;
-
-		[STAThread]
-		public static void Main(string[] args)
-		{
-			MainForm form = new MainForm();
-			form.StartApplication();
-		}
 
 		// RXgN^
@@ -51,7 +25,4 @@
 		{
 			InitializeComponent();
-
-			Assembly asm = Assembly.GetExecutingAssembly();
-			this.notifyIcon.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico"));
 
 			this.TransparentMouseMessage = false;
@@ -61,58 +32,10 @@
 			curPattern = 0;
 			curMarkers = 0;
-
-			cpuCounter = new CPUUsageCounter();
-			memoryCounter = new MemoryUsageCounter();
-
-			_updateTimer = new System.Windows.Forms.Timer();
-			_updateTimer.Tick += new EventHandler(this.CountProcessorUsage);
-			_updateTimer.Enabled = false;
-			_updateTimer.Interval = 1000;
 		}
 
-		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
-			// 
-			this.menuItemPatternSelect.Text = "çp^[ÌIð(&S)";
-			this.menuItemPatternSelect.Click += new System.EventHandler(this.menuItemPatternSelect_Click);
-
-			// 
-			// menuItemConfigure
-			// 
-			this.menuItemConfigure.Text = "MacFace ÌÝè(&C)...";
-			this.menuItemConfigure.Click +=new EventHandler(menuItemConfigure_Click);
-			// 
-			// menuItemExit
-			// 
-			this.menuItemExit.Index = 0;
-			this.menuItemExit.Shortcut = System.Windows.Forms.Shortcut.CtrlQ;
-			this.menuItemExit.Text = "I¹(&X)";
-			this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
-			// 
-			// contextMenu
-			// 
-			this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-						this.menuItemPatternSelect, this.menuItemConfigure, new MenuItem("-"), this.menuItemExit});
-			// 
-			// MainForm
-			// 
+		void InitializeComponent()
+		{
 			this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
 			this.ClientSize = new System.Drawing.Size(120, 101);
-			this.ContextMenu = this.contextMenu;
 			this.ControlBox = false;
 			this.MaximizeBox = false;
@@ -125,171 +48,14 @@
 		}
 
-		public void StartApplication()
-		{
-			// Ýè
-			_config = Configuration.GetInstance();
-			_config.Load();
-
-
-			// çp^[ÇÝÝ
-			bool result = false;
-			if (Directory.Exists(_config.FaceDefPath))
-			{
-				result = LoadFaceDefine(_config.FaceDefPath);
-			}
-
-			if (!result)
-			{
-				if (!SelectFaceDefine(Application.StartupPath))
-				{
-					Application.Exit();
-					return;
-				}
-			}
-
-			Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
-
-			this.Location = _config.Location;
-			ApplyConfiguration();
-
-			_updateTimer.Start();
-			Application.Run(this);
-		}
-
-		void Application_ApplicationExit(object sender, EventArgs e)
-		{
-			notifyIcon.Visible = false;
-
-			// Û¶
-			_config.Opacity = (int)(this.Opacity * 100);
-			_config.FaceDefPath = (_currentFaceDef != null ? _currentFaceDef.Path : Path.Combine(Application.StartupPath, "default.mcface"));
-			_config.Location = this.Location;
-			_config.TransparentMouseMessage = this.TransparentMouseMessage;
-
-			_config.Save();
-		}
-
-		/*
-		 * çp^[è`tH_IðB
-		 */
-		public bool SelectFaceDefine()
-		{
-			return SelectFaceDefine(Application.StartupPath);
-		}
-
-		public bool SelectFaceDefine(string defaultPath)
-		{
-			while (true) 
-			{
-				FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
-				folderBrowser.SelectedPath = defaultPath;
-				folderBrowser.Description = "çp^[t@CÌ¶Ý·étH_ðIðµÄ­¾³¢B";
-				if (folderBrowser.ShowDialog() == DialogResult.OK) 
-				{
-					if (LoadFaceDefine(folderBrowser.SelectedPath)) 
-					{
-						return true;
-					}
-				}
-				else 
-				{
-					return false;
-				}
-			}
-
-		}
-
-
-		public bool LoadFaceDefine(string path)
-		{
-			FaceDef newFaceDef = null;
-			string plistPath = Path.Combine(path, "faceDef.plist");
-
-			if (!File.Exists(plistPath))
-			{
-				System.Windows.Forms.MessageBox.Show(
-					String.Format("wè³ê½tH_Éçp^[è`XMLt@C \"faceDef.plist\" ª¶ÝµÜ¹ñB\n\ntH_:\n{0}", path),
-					"MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
-				return false;
-			}
-			
-			try 
-			{
-				newFaceDef = new MacFace.FaceDef(path);
-			} 
-			catch (System.IO.IOException ie) 
-			{
-				System.Windows.Forms.MessageBox.Show(
-					String.Format("çp^[è`XMLt@CðÇÝÞÛÉG[ª­¶µÜµ½B\n\n´ö:\n{0}",
-					ie.ToString()), "MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
-				
-				return false;
-			}
-			catch (System.Xml.XmlException xe) 
-			{
-				System.Windows.Forms.MessageBox.Show(
-					String.Format("çp^[è`XMLt@CðÇÝÉG[ª­¶µÜµ½B\n\n´ö:\n{0}",
-					xe.ToString()), "MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
-				
-				return false;
-			}
-
-			// çp^[·µÖ¦ÍXVð~ßÄ¨­
-			if (_updateTimer != null) _updateTimer.Stop();
-
-			this.FaceDef = newFaceDef;
-			RefreshPattern();
-
-			notifyIcon.Text = "MacFace - " + _currentFaceDef.Title;
-
-			// XVÄJ
-			if (_updateTimer != null) _updateTimer.Start();
-
-			return true;
-		}
-
-		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 markers = FaceDef.MarkerNone;
-			if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn;
-			if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut;
-
-			UpdatePattern(suite, pattern, markers);
-		}
-
-		private void ApplyConfiguration()
-		{
-			this.Opacity = (float)_config.Opacity / 100;
-			this.PatternSize = (float)_config.PatternSize / 100;
-			this.TransparentMouseMessage = _config.TransparentMouseMessage;
-
-			RefreshPattern();
-		}
-
 		public float PatternSize
 		{
-			get { return _patternSize; }
-			set { _patternSize = value; }
+			get { return patternSize; }
+			set { patternSize = value; }
 		}
 
 		public FaceDef FaceDef
 		{
-			get { return _currentFaceDef; }
-			set { _currentFaceDef = value; }
+			get { return curFaceDef; }
+			set { curFaceDef = value; }
 		}
 
@@ -309,30 +75,6 @@
 			Graphics g = this.Graphics;
 			g.Clear(Color.FromArgb(0, 0, 0, 0));
-			_currentFaceDef.DrawPatternImage(g, curSuite, curPattern, curMarkers, _patternSize);
+			curFaceDef.DrawPatternImage(g, curSuite, curPattern, curMarkers, patternSize);
 			this.Update();
-		}
-
-		/*
-		 * j
-[NbNCxg
-		 */
-		public void menuItemPatternSelect_Click(object sender, System.EventArgs e)
-		{
-			SelectFaceDefine(FaceDef.Path);	
-		}
-
-		public void menuItemExit_Click(object sender, System.EventArgs e)
-		{
-			_updateTimer.Stop();
-			this.Close();
-		}
-
-		private void menuItemConfigure_Click(object sender, EventArgs e)
-		{
-			ConfigurationForm configForm = new ConfigurationForm(this);
-			if (configForm.ShowDialog() == DialogResult.OK) 
-			{
-				ApplyConfiguration();
-			}
 		}
 	}
