예제 #1
0
        /// <summary>
        ///     Potvrdí zadaná nastavení a vypne okno.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnPotvrdit_Click(object sender, EventArgs e)
        {
            try
            {
                UvodKlienta.Port = int.Parse(TxtPort.Text);

                if (RadioSv.Checked)
                {
                    UvodKlienta.Tema   = MaterialSkinManager.Themes.LIGHT;
                    UvodKlienta.Vzhled = new ColorScheme(Primary.LightBlue400, Primary.LightBlue900,
                                                         Primary.Cyan100, Accent.LightBlue400, TextShade.WHITE);
                }
                else if (RadioTm.Checked)
                {
                    UvodKlienta.Tema   = MaterialSkinManager.Themes.DARK;
                    UvodKlienta.Vzhled = new ColorScheme(Primary.LightBlue400, Primary.LightBlue900,
                                                         Primary.Cyan100, Accent.LightBlue400, TextShade.WHITE);
                }

                Close();
            }
            catch
            {
                MessageBox.Show("Byla zadána neplatná hodnota portu!", "Chyba!");
                TxtPort.Focus();
                TxtPort.SelectAll();
            }
        }
예제 #2
0
        private void Connect_Btn_Click(object sender, RoutedEventArgs e)
        {
            if (client_Socket.Connected)
            {
                MessageBox.Show("이미 연결되어 있습니다", "경고", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            int Client_Port;

            if (!int.TryParse(TxtPort.Text, out Client_Port))
            {
                MessageBox.Show("포트번호를 다시 입력해 주십시오", "경고", MessageBoxButton.OK, MessageBoxImage.Warning);
                TxtPort.Focus();
                TxtPort.SelectAll();
                return;
            }

            try
            {
                client_Socket.Connect(Txt_IPadRess.Text, Client_Port);
            }
            catch
            {
                MessageBox.Show("연결에 실패하였습니다", "에러", MessageBoxButton.OK, MessageBoxImage.Error);
                Txt_history.Text += string.Format("\n서버와 연결실패");
                return;
            }

            Txt_history.Text += string.Format("\n서버와 연결되었습니다");
            Client_AsyncObject obj = new Client_AsyncObject(4096);

            obj.Working_socket = client_Socket;
            client_Socket.BeginReceive(obj.Buffer, 0, obj.BufferSize, 0, DataReceived, obj);
        }
예제 #3
0
        private void Recetor(byte[] B, int inLen)
        {
            string Msg = Encoding.Default.GetString(B, 0, inLen); //解讀完整訊息
            string St  = Msg.Substring(0, 1);                     //取出命令碼 (第一個字)
            string Str = Msg.Substring(1);                        //取出命令碼之後的訊息

            switch (St)                                           //依命令碼執行功能
            {
            case "L":                                             //接收線上名單
                listBox1.Items.Clear();
                string[] M = Str.Split(',');                      //拆解名單成陣列
                for (int i = 0; i < M.Length; i++)
                {
                    listBox1.Items.Add(M[i]);
                }     //逐一加入名單
                break;

            case "9":     //接收離開玩家
                TxtSever.AppendText("(系統) :" + Str + " 已離開伺服器! \r\n");
                listBox1.Items.Remove(Str);
                break;

            case "3": TxtSever.AppendText("(私密)" + Str + "\r\n"); break; //私密訊息

            case "D": TxtSever.AppendText("(公開)" + Str + "\r\n"); break; //聊天室

            case "M": TxtPort.AppendText(Str + "\r\n"); break;           //猜題未答對
            }
        } //接收ServerC回傳
예제 #4
0
        private bool ValidateInput()
        {
            int port;

            if (!string.IsNullOrEmpty(TxtPort.Text) && !int.TryParse(TxtPort.Text, NumberStyles.Integer, _usCulture, out port))
            {
                TxtPort.Focus();

                _presentation.ShowMessage(new MessageBoxInfo
                {
                    Button  = MessageBoxButton.OK,
                    Caption = "Error",
                    Icon    = MessageBoxIcon.Error,
                    Text    = "Please enter a valid port number."
                });

                return(false);
            }

            return(true);
        }
예제 #5
0
        void ReleaseDesignerOutlets()
        {
            if (TxtPrivateKey != null)
            {
                TxtPrivateKey.Dispose();
                TxtPrivateKey = null;
            }

            if (TxtCertificate != null)
            {
                TxtCertificate.Dispose();
                TxtCertificate = null;
            }

            if (BtnAcquireToken != null)
            {
                BtnAcquireToken.Dispose();
                BtnAcquireToken = null;
            }

            if (BtnBrowseTokenFile != null)
            {
                BtnBrowseTokenFile.Dispose();
                BtnBrowseTokenFile = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnSelectCertificate != null)
            {
                BtnSelectCertificate.Dispose();
                BtnSelectCertificate = null;
            }

            if (BtnSelectPrivateKey != null)
            {
                BtnSelectPrivateKey.Dispose();
                BtnSelectPrivateKey = null;
            }

            if (CbSaml != null)
            {
                CbSaml.Dispose();
                CbSaml = null;
            }

            if (CbSsl != null)
            {
                CbSsl.Dispose();
                CbSsl = null;
            }

            if (LblCertificate != null)
            {
                LblCertificate.Dispose();
                LblCertificate = null;
            }

            if (LblPrivateKey != null)
            {
                LblPrivateKey.Dispose();
                LblPrivateKey = null;
            }

            if (LblServerUrl != null)
            {
                LblServerUrl.Dispose();
                LblServerUrl = null;
            }

            if (LblSnp != null)
            {
                LblSnp.Dispose();
                LblSnp = null;
            }

            if (LblStsUrl != null)
            {
                LblStsUrl.Dispose();
                LblStsUrl = null;
            }

            if (PnlJwt != null)
            {
                PnlJwt.Dispose();
                PnlJwt = null;
            }

            if (PnlSaml != null)
            {
                PnlSaml.Dispose();
                PnlSaml = null;
            }

            if (RdoTypeGroup != null)
            {
                RdoTypeGroup.Dispose();
                RdoTypeGroup = null;
            }

            if (TxtAccessTokenString != null)
            {
                TxtAccessTokenString.Dispose();
                TxtAccessTokenString = null;
            }

            if (TxtDomain != null)
            {
                TxtDomain.Dispose();
                TxtDomain = null;
            }

            if (TxtIDTokenString != null)
            {
                TxtIDTokenString.Dispose();
                TxtIDTokenString = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }

            if (TxtPort != null)
            {
                TxtPort.Dispose();
                TxtPort = null;
            }

            if (TxtRefreshTokenString != null)
            {
                TxtRefreshTokenString.Dispose();
                TxtRefreshTokenString = null;
            }

            if (TxtSamlToken != null)
            {
                TxtSamlToken.Dispose();
                TxtSamlToken = null;
            }

            if (TxtServer != null)
            {
                TxtServer.Dispose();
                TxtServer = null;
            }

            if (TxtSpn != null)
            {
                TxtSpn.Dispose();
                TxtSpn = null;
            }

            if (TxtStsUrl != null)
            {
                TxtStsUrl.Dispose();
                TxtStsUrl = null;
            }

            if (TxtTenant != null)
            {
                TxtTenant.Dispose();
                TxtTenant = null;
            }

            if (TxtTokenFile != null)
            {
                TxtTokenFile.Dispose();
                TxtTokenFile = null;
            }

            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }
        }
예제 #6
0
        void ReleaseDesignerOutlets()
        {
            if (BtnAdd != null)
            {
                BtnAdd.Dispose();
                BtnAdd = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (CbSaml != null)
            {
                CbSaml.Dispose();
                CbSaml = null;
            }

            if (CbSsl != null)
            {
                CbSsl.Dispose();
                CbSsl = null;
            }

            if (LblStsEndpoint != null)
            {
                LblStsEndpoint.Dispose();
                LblStsEndpoint = null;
            }

            if (LblUrl != null)
            {
                LblUrl.Dispose();
                LblUrl = null;
            }

            if (TxtPort != null)
            {
                TxtPort.Dispose();
                TxtPort = null;
            }

            if (TxtServer != null)
            {
                TxtServer.Dispose();
                TxtServer = null;
            }

            if (TxtStsEndpoint != null)
            {
                TxtStsEndpoint.Dispose();
                TxtStsEndpoint = null;
            }

            if (TxtTenant != null)
            {
                TxtTenant.Dispose();
                TxtTenant = null;
            }

            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }
        }