0
Pending Review

Add option to invert selection

shawnkhall 2 months ago 0

Every time I upgrade SC I have to fix the code again to re-add the ability to invert the selection. Please add this code to the distribution so I don't have to do it myself every time. Thank you.

=== Host.aspx

~#874
function shouldCheckSession(session, checkModeType, selected) {
    switch (checkModeType) {
        case 'All': return true;
        case 'None': return false;
        case 'Neither': return !window.isProcessTypeConnected(session, SC.types.ProcessType.Host) && !window.isProcessTypeConnected(session, SC.types.ProcessType.Guest);
        case 'Both': return window.isProcessTypeConnected(session, SC.types.ProcessType.Host) && window.isProcessTypeConnected(session, SC.types.ProcessType.Guest);
        case 'OnlyHost': return window.isProcessTypeConnected(session, SC.types.ProcessType.Host) && !window.isProcessTypeConnected(session, SC.types.ProcessType.Guest);
        case 'OnlyGuest': return !window.isProcessTypeConnected(session, SC.types.ProcessType.Host) && window.isProcessTypeConnected(session, SC.types.ProcessType.Guest);
        case 'Invert': return !selected; // add this line
    }
}

~#915
isRowChecked = window.shouldCheckSession(r._dataItem, eventArgs.commandArgument, isRowChecked);

~#937
$div({ className: 'CommandList' }, [
$h4({ _textResource: 'Command.Check.CheckText' }),
    SC.command.createCommandButtons([
        { commandName: 'Check', commandArgument: 'All' },
        { commandName: 'Check', commandArgument: 'None' }, // add comma
        { commandName: 'Check', commandArgument: 'Invert', text: 'Invert' } // add line
    ]),
]),

===

For language support it also requires adding a value to the resx:

=== Web.en-US.resx

<data name="Command.CheckInvert.Text" xml:space="preserve">

  <value>Invert</invert>

</data>

===