static void perform(int action, Keys key) { if (!Working) { return; } if (ExcludedKeys.Contains(key)) { return; } var fore = Win32ApiWrapper.GetForegroundWindow(); if (!MainWindows.Any(w => w.SameOrBelongTo(fore))) { return; } WorkingNotice?.BeginInvoke(fore, null, null); for (var i = AllWindows.Count - 1; i >= 0; i--) { var item = AllWindows[i]; var w = item.Key; if (w.SameOrBelongTo(fore)) { continue; } var r = Win32ApiWrapper.PostMessage(w, action, (int)key, 0); if (r == 0) { AllWindows.Remove(item); WindowLost?.BeginInvoke(w, null, null); } } }
//管理対象のウィンドウのUIオブジェクトを削除 public void RemoveWindow(IAdvMessageWindow window) { string windowName = window.gameObject.name; if (!AllWindows.ContainsKey(windowName)) { return; } AllWindows.Remove(window.gameObject.name); }