/// <summary>
 /// </summary>
 private void TestConnection( )
 {
     if (this._initializeComplete)
     {
         var testConnectionForm = new TestConnectionForm( );
         testConnectionForm.ShowDialog(this);
     }
 }
예제 #2
0
        /// <summary>
        /// </summary>
        /// <param name="outputControlsObject"></param>
        private void PerformTestConnection(
            [CanBeNull] object outputControlsObject)
        {
            var parameters = ( BatchWithProgressbar )outputControlsObject;

            if (parameters?.ProgramsWithOutput != null)
            {
                var textBoxes = parameters.ProgramsWithOutput
                                .Where
                                (
                    methodParameters => methodParameters != null)
                                .Where
                                (
                    methodParameters =>
                    methodParameters.TextOutputControl != null)
                                .Select
                                (
                    methodParameters =>
                    methodParameters.TextOutputControl)
                                .ToList();

                if (Handler.WaitWhileTestProcessed != null)
                {
                    TestConnectionForm.SetTextboxesText
                    (
                        Handler.WaitWhileTestProcessed ?? string.Empty,
                        textBoxes
                    );
                }
            }

            if (parameters?.ProgramsWithOutput != null)
            {
                foreach (
                    var methodParameters in parameters.ProgramsWithOutput)
                {
                    var thread = new Thread
                                     (this.SetProgramOutputToControl);
                    thread.Start(methodParameters);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// </summary>
        private void TestConnection( )
        {
            var startControl = this.DoTestConnectionButton;
            var stopControl  = this.DoCloseFormButton;
            var progressBar  = this.TestingProgressBar;

            Handler.DisableStarProgressStopControls
            (
                startControl
                , stopControl
                , progressBar
            );

            this._completedTestsCount = 0;

            var networkAdaptersParameters =
                Handler.GetNetworkAdaptersParameters( );
            {
                var interfacesNumber = networkAdaptersParameters.Count;

                if (interfacesNumber <= 0)
                {
                    if (Handler.DisconnectOrInvalidConnection != null)
                    {
                        TestConnectionForm.SetTextboxesText
                        (
                            Handler.DisconnectOrInvalidConnection
                            , this.OutputsControls
                        );
                    }
                    this._completedTestsCount = 8;
                    var onExecutableFinish = this.OnExecutableFinish;
                    onExecutableFinish?.Invoke( );
                }
                else
                {
                    var networkAdapterParameters =
                        networkAdaptersParameters.FirstOrDefault( )
                        ?? new NetworkAdapterParameters( );
                    var gatewayAddress = networkAdapterParameters.Gateway;
                    var dnsAddress     = networkAdapterParameters.Dns;

                    var progressControl = this.TestingProgressBar;

                    if (progressControl != null)
                    {
                        progressControl.Value = progressControl.Minimum;

                        var testParameters = this.InitializeTestParameters
                                             (
                            progressControl
                            , gatewayAddress
                            , dnsAddress
                                             );

                        var testConnectionThread = new Thread
                                                       (this.PerformTestConnection);
                        testConnectionThread.Start(testParameters);
                    }
                }
            }
        }