WakaTime.Window.IsFocused C# (CSharp) Method

IsFocused() public static method

public static IsFocused ( ) : bool
return bool
        public static bool IsFocused()
        {
            return EditorWindow.focusedWindow is Window;
        }

Usage Example

示例#1
0
        public static bool CheckAPIKey()
        {
            bool   res = true;
            string key = GetApiKey();

            if (IsEnabled)
            {
                if (key == null || key.Equals(""))
                {
                    if (!Window.IsFocused())
                    {
                        if (EditorUtility.DisplayDialog("WakaTime API Key required", "You need to insert your API Key so as tu use this Plugin", "Insert API Key", "Disable Wakatime"))
                        {
                            Window.GetWindow().Show();
                            Window.GetWindow().Focus();
                        }
                        else
                        {
                            IsEnabled = false;
                        }
                    }

                    res = false;
                }
            }
            else
            {
                res = false;
            }

            return(res);
        }