コード例 #1
0
        private void InitCtrlBatchOperation(
            ToolStripMenuItem stopSelected,
            ToolStripMenuItem restartSelected,

            ToolStripMenuItem runBatchSpeedtest,
            ToolStripMenuItem stopBatchSpeedtest,
            ToolStripMenuItem clearSpeedtestResults,

            ToolStripMenuItem modifySelected)
        {
            clearSpeedtestResults.Click += RunWhenSelectionIsNotEmptyHandler(() =>
            {
                if (Misc.UI.Confirm(I18N.ConfirmClearSpeedTestResults))
                {
                    ClearSelectedServersSpeedTestResults();
                }
            });

            modifySelected.Click += RunWhenSelectionIsNotEmptyHandler(
                () => Views.WinForms.FormBatchModifyServerSetting.GetForm());

            runBatchSpeedtest.Click += RunWhenSelectionIsNotEmptyHandler(() =>
            {
                if (!Misc.UI.Confirm(I18N.TestWillTakeALongTime))
                {
                    return;
                }

                servers.RunSpeedTestOnSelectedServersBg();
            });

            stopBatchSpeedtest.Click += (s, a) =>
            {
                settings.SendLog(I18N.StoppingSpeedtest);
                settings.isSpeedtestCancelled = true;
            };

            stopSelected.Click += RunWhenSelectionIsNotEmptyHandler(() =>
            {
                if (Misc.UI.Confirm(I18N.ConfirmStopAllSelectedServers))
                {
                    servers.StopSelectedServersThen();
                }
            });

            restartSelected.Click += RunWhenSelectionIsNotEmptyHandler(() =>
            {
                if (Misc.UI.Confirm(I18N.ConfirmRestartAllSelectedServers))
                {
                    servers.RestartSelectedServersThen();
                }
            });
        }