public BackgroundClientWithWcf()
        {
            WorkerReportsProgress = true;
            WorkerSupportsCancellation = true;

            //wstępna inicjalizacja potrzebnych danych
            _client = new Client();
            FormMessageStacks = new Queue<FormEventStack>();
            BackgroundMessageStacks = new Queue<BackgroundEventStack>();
        }
Beispiel #2
0
        private void ButtonConnectionTestClick(object sender, EventArgs e)
        {
            buttonSave.Enabled = false;
            buttonCancel.Enabled = false;
            buttonConnectionTest.Enabled = false;
            ControlBox = false;

            var client = new Client();
            client.Open();

            try
            {
                client.Channel.IsServerRunning();
                MessageForm.ShowInformationMessage("Połączenie jest poprawne");
            }
            catch (Exception ex)
            {
                var basicError = "Wystąpił błąd połączenia.\r\n" +
                                 "Serwer nie odpowiada.\r\n\r\n" +
                                 "Szczegóły błędu:\r\n" +
                                 ex.Message;

                if (ex.InnerException == null)
                {
                    MessageForm.ShowErrorMessage(basicError);
                }
                else
                {
                    MessageForm.ShowErrorMessage(basicError + "\r\n" + ex.InnerException.Message);
                }
            }

            buttonSave.Enabled = true;
            buttonCancel.Enabled = true;
            buttonConnectionTest.Enabled = true;
            ControlBox = true;
        }