static void Main() { Util.Utils.ReleaseMemory(true); using (Mutex mutex = new Mutex(false, "Global\\TYWordCopyApplication_" + Application.StartupPath.GetHashCode())) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!mutex.WaitOne(0, false)) { Process[] oldProcesses = Process.GetProcessesByName("TYWordCopyApplication"); if (oldProcesses.Length > 0) { Process oldProcess = oldProcesses[0]; } MessageBox.Show(I18N.GetString("程序以运行")); return; } Directory.SetCurrentDirectory(Application.StartupPath); TYWordCopyAppController controller = new TYWordCopyAppController(); MenuViewController viewController = new MenuViewController(controller); controller.Start(); Application.Run(); } }
public DataConvert(TYWordCopyAppController controller) { _controller = controller; controller.ClipboardChanged += ConvertData; //controller.FocusChanged += ConvertData; controller.Errored += controller_Errored; }
public ClipboardMonitor(TYWordCopyAppController controller) { TYWordCopyAppController _controller = controller; controller.DataConverted += resetClipboardData; nextClipboardViewer = (IntPtr)SetClipboardViewer((int)this.Handle); }
public MenuViewController(TYWordCopyAppController controller) { this._controller = controller; LoadMenu(); _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = Icon.FromHandle(Resources.icon16.GetHicon()); Configuration config = new Configuration(); string text = config.app_name + " " + Configuration.Version; _notifyIcon.Text = text.Substring(0, Math.Min(63, text.Length)); _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu; controller.Errored += controller_Errored; }