static void Main() { if (QuickUpdate.LocalUpdate()) { Environment.Exit(0); return; } if (Init()) { Application.Run(); } }
static bool Init() { const string adminComment = "Quick当前是以管理员身份运行。此时,您的宿主程序也必须是以管理员身份运行,这样Quick快捷菜单才能正常出现。"; var mutexStr = "__QUICK____QUICK____QUICK____QUICK____QUICK__"; bool canCreateMutex; Mutex programMutex = new Mutex(false, mutexStr, out canCreateMutex); if (canCreateMutex) { notify = QuickNotify.GetNotify(); notify.Visible = true; if (QuickConfig.ThisConfig.FirstRun) { QuickConfig.ThisConfig.FirstRun = false; QuickConfig.ThisConfig.TrySave(); string additional = IsAdministrator() ? adminComment : string.Empty; notify.ShowBalloonTip("Quick已经运行,您可以点击右键查看其选项。" + " " + adminComment); } else if (IsAdministrator()) { notify.ShowBalloonTip(adminComment); } Action silenceUpdate = () => { QuickUpdate.SilenceUpdate(); }; silenceUpdate.BeginInvoke(null, null); QuickListener.Listener.Run(); return(true); } return(false); }