コード例 #1
0
ファイル: Config.cs プロジェクト: vakulenchuk/windawesome
        public ProgramRule(string className = ".*", string displayName = ".*", string processName = ".*",
                           NativeMethods.WS styleContains                = (NativeMethods.WS) 0, NativeMethods.WS styleNotContains = (NativeMethods.WS) 0,
                           NativeMethods.WS_EX exStyleContains           = (NativeMethods.WS_EX) 0, NativeMethods.WS_EX exStyleNotContains = (NativeMethods.WS_EX) 0,
                           CustomMatchingFunction customMatchingFunction = null, CustomMatchingFunction customOwnedWindowMatchingFunction  = null,

                           bool isManaged = true, int tryAgainAfter = -1, int windowCreatedDelay = -1, bool redrawDesktopOnWindowCreated = false,
                           bool showMenu  = true, bool updateIcon   = false,
                           OnWindowCreatedOrShownAction onWindowCreatedAction     = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
                           OnWindowCreatedOrShownAction onHiddenWindowShownAction = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
                           OnWindowCreatedOnWorkspaceAction onWindowCreatedOnCurrentWorkspaceAction  = OnWindowCreatedOnWorkspaceAction.MoveToTop,
                           OnWindowCreatedOnWorkspaceAction onWindowCreatedOnInactiveWorkspaceAction = OnWindowCreatedOnWorkspaceAction.MoveToTop,
                           int showOnWorkspacesCount = 0, IEnumerable <Rule> rules = null)
        {
            this.className                         = new Regex(className, RegexOptions.Compiled);
            this.displayName                       = new Regex(displayName, RegexOptions.Compiled);
            this.processName                       = new Regex(processName, RegexOptions.Compiled);
            this.styleContains                     = styleContains;
            this.styleNotContains                  = styleNotContains;
            this.exStyleContains                   = exStyleContains;
            this.exStyleNotContains                = exStyleNotContains;
            this.customMatchingFunction            = customMatchingFunction ?? Utilities.IsAltTabWindow;
            this.customOwnedWindowMatchingFunction = customOwnedWindowMatchingFunction ?? DefaultOwnedWindowMatchingFunction;

            this.isManaged = isManaged;
            if (isManaged)
            {
                this.tryAgainAfter                = tryAgainAfter;
                this.windowCreatedDelay           = windowCreatedDelay;
                this.redrawDesktopOnWindowCreated = redrawDesktopOnWindowCreated;
                this.showMenu                  = showMenu;
                this.updateIcon                = updateIcon;
                this.onWindowCreatedAction     = onWindowCreatedAction;
                this.onHiddenWindowShownAction = onHiddenWindowShownAction;
                this.onWindowCreatedOnCurrentWorkspaceAction  = onWindowCreatedOnCurrentWorkspaceAction;
                this.onWindowCreatedOnInactiveWorkspaceAction = onWindowCreatedOnInactiveWorkspaceAction;

                if (showOnWorkspacesCount > 0)
                {
                    if (rules == null)
                    {
                        rules = new Rule[] { };
                    }

                    // This is slow (n ^ 2), but it doesn't matter in this case
                    this.rules = rules.Concat(
                        Enumerable.Range(1, showOnWorkspacesCount).Where(i => rules.All(r => r.workspace != i)).Select(i => new Rule(i))).
                                 ToArray();
                }
                else
                {
                    this.rules = rules == null ? new[] { new Rule() } : rules.ToArray();
                }
            }
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: ryguasu/windawesome
        public ProgramRule(string className = ".*", string displayName = ".*", string processName = ".*",
            NativeMethods.WS styleContains = (NativeMethods.WS) 0, NativeMethods.WS styleNotContains = (NativeMethods.WS) 0,
            NativeMethods.WS_EX exStyleContains = (NativeMethods.WS_EX) 0, NativeMethods.WS_EX exStyleNotContains = (NativeMethods.WS_EX) 0,
            CustomMatchingFunction customMatchingFunction = null, CustomMatchingFunction customOwnedWindowMatchingFunction = null,
            
            bool isManaged = true, int tryAgainAfter = -1, int windowCreatedDelay = -1, bool redrawDesktopOnWindowCreated = false,
            bool showMenu = true, bool updateIcon = false,
            OnWindowCreatedOrShownAction onWindowCreatedAction = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
            OnWindowCreatedOrShownAction onHiddenWindowShownAction = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
            OnWindowCreatedOnWorkspaceAction onWindowCreatedOnCurrentWorkspaceAction = OnWindowCreatedOnWorkspaceAction.MoveToTop,
            OnWindowCreatedOnWorkspaceAction onWindowCreatedOnInactiveWorkspaceAction = OnWindowCreatedOnWorkspaceAction.MoveToTop,
            int showOnWorkspacesCount = 0, IEnumerable<Rule> rules = null)
        {
            this.className = new Regex(className, RegexOptions.Compiled);
            this.displayName = new Regex(displayName, RegexOptions.Compiled);
            this.processName = new Regex(processName, RegexOptions.Compiled);
            this.styleContains = styleContains;
            this.styleNotContains = styleNotContains;
            this.exStyleContains = exStyleContains;
            this.exStyleNotContains = exStyleNotContains;
            this.customMatchingFunction = customMatchingFunction ?? Utilities.IsAltTabWindow;
            this.customOwnedWindowMatchingFunction = customOwnedWindowMatchingFunction ?? DefaultOwnedWindowMatchingFunction;

            this.isManaged = isManaged;
            if (isManaged)
            {
                this.tryAgainAfter = tryAgainAfter;
                this.windowCreatedDelay = windowCreatedDelay;
                this.redrawDesktopOnWindowCreated = redrawDesktopOnWindowCreated;
                this.showMenu = showMenu;
                this.updateIcon = updateIcon;
                this.onWindowCreatedAction = onWindowCreatedAction;
                this.onHiddenWindowShownAction = onHiddenWindowShownAction;
                this.onWindowCreatedOnCurrentWorkspaceAction = onWindowCreatedOnCurrentWorkspaceAction;
                this.onWindowCreatedOnInactiveWorkspaceAction = onWindowCreatedOnInactiveWorkspaceAction;

                if (showOnWorkspacesCount > 0)
                {
                    if (rules == null)
                    {
                        rules = new Rule[] { };
                    }

                    // This is slow (n ^ 2), but it doesn't matter in this case
                    this.rules = rules.Concat(
                        Enumerable.Range(1, showOnWorkspacesCount).Where(i => rules.All(r => r.workspace != i)).Select(i => new Rule(i))).
                        ToArray();
                }
                else
                {
                    this.rules = rules == null ? new[] { new Rule() } : rules.ToArray();
                }
            }
        }