private bool TestEverything(IQuickWindow quickWindow) { // 返回引擎是否已经初始化 QuickEverything.Everything_Reset(); QuickEverything.Everything_SetMax(1); QuickEverything.Everything_SetOffset(0); QuickEverything.Everything_SetSearchW("*"); bool success = false; bool startServer = false; int times = 0; do { success = QuickEverything.Everything_QueryW(true); if (success) { quickWindow.UnlockWindow(); int count = QuickEverything.Everything_GetNumResults(); return(count > 0 ? true : false); } else { quickWindow.LockWindow(); if (!startServer) { StartService(); startServer = true; } Thread.Sleep(COUNT_DOWN_TIMEOUT); times++; if (times > MAX_TRYING_TIMES) { return(false); } } } while (!success); Debug.Assert(false, "应该在success的时候就返回了"); return(false); }