예제 #1
0
        private void DoDownloadWeblinkButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var weblink    = string.Empty;
            var cooldown   = 0;
            var letShowLog = false;

            var doDownloadWeblinkButton = this.DoDownloadWeblinkButton;
            var doGetWeblinkButton      = this.DoGetWeblinkButton;
            var doPostWeblinkButton     = this.DoPostWeblinkButton;
            var doStopWebLinkButton     = this.DoStopWebLinkButton;
            var weblinkTextBox          = this.WeblinkTextBox;
            var colldownIntegerUpDown   = this.CooldownIntegerUpDown;
            var showLogCheckBox         = this.ShowLogCheckBox;

            if ((weblinkTextBox != null) &&
                (doDownloadWeblinkButton != null) &&
                (doGetWeblinkButton != null) &&
                (doPostWeblinkButton != null) &&
                (doStopWebLinkButton != null) &&
                (showLogCheckBox != null))
            {
                doDownloadWeblinkButton.IsEnabled = false;
                doGetWeblinkButton.IsEnabled      = false;
                doPostWeblinkButton.IsEnabled     = false;
                doStopWebLinkButton.IsEnabled     = true;
                weblink = weblinkTextBox.Text;
                if (colldownIntegerUpDown?.Value != null)
                {
                    cooldown = (int)colldownIntegerUpDown.Value;
                }
                if (showLogCheckBox.IsChecked != null)
                {
                    letShowLog = showLogCheckBox.IsChecked.Value;
                }
            }

            CycleRunParameters cycleRunParameters = null;

            if (!string.IsNullOrWhiteSpace(weblink))
            {
                cycleRunParameters = new CycleRunParameters
                                     (
                    weblink,
                    cooldown,
                    this,
                    letShowLog
                                     );
            }

            if (cycleRunParameters != null)
            {
                this._breakeWeblinkExecution = false;

                var runWeblinkLoopThread = new System.Threading.Thread(this.RunDownloadWebLink);
                runWeblinkLoopThread.Start(cycleRunParameters);
            }
        }
예제 #2
0
        private void DoRunCommandButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var commandLineText = string.Empty;
            var cooldown        = 0;
            var letShowLog      = false;

            var commandTextBox        = this.CommandTextBox;
            var doRunCommandButton    = this.DoRunCommandButton;
            var doStopCommandButton   = this.DoStopCommandButton;
            var colldownIntegerUpDown = this.CooldownIntegerUpDown;
            var showLogCheckBox       = this.ShowLogCheckBox;

            if ((commandTextBox != null) &&
                (doRunCommandButton != null) &&
                (doStopCommandButton != null) &&
                (showLogCheckBox != null))
            {
                doRunCommandButton.IsEnabled  = false;
                doStopCommandButton.IsEnabled = true;
                commandLineText = commandTextBox.Text;
                if (colldownIntegerUpDown?.Value != null)
                {
                    cooldown = (int)colldownIntegerUpDown.Value;
                }
                if (showLogCheckBox.IsChecked != null)
                {
                    letShowLog = showLogCheckBox.IsChecked.Value;
                }
            }

            CycleRunParameters commandLoopParameters = null;

            var parentForm = this;

            if (!string.IsNullOrWhiteSpace(commandLineText))
            {
                commandLoopParameters = new CycleRunParameters
                                        (
                    commandLineText,
                    cooldown,
                    parentForm,
                    letShowLog);
            }

            if (commandLoopParameters != null)
            {
                this._breakeCommandExecution = false;

                var runCommandLoopThread = new System.Threading.Thread(this.RunCommandLoop);
                runCommandLoopThread.Start(commandLoopParameters);
            }
        }