private void LogInBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.loginInput.Text)) { XtraMessageBox.Show( "The login and password field is required, please enter login", "Warning", MessageBoxButtons.OK); } else if (string.IsNullOrEmpty(this.passwordInput.Text)) { XtraMessageBox.Show( "The login and password field is required, please enter password", "Warning", MessageBoxButtons.OK); } else { // var base64HeaderValue = Convert.ToBase64String( // System.Text.Encoding.UTF8.GetBytes($@"{this.loginInput.Text}:{this.passwordInput.Text}")); var base64HeaderValue = Convert.ToBase64String( System.Text.Encoding.UTF8.GetBytes("[email protected]:poster86")); var uri = @"http://openeventor.ru/api/get_events"; // Create a request for the URL. var request = WebRequest.Create(uri); // If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials; EventorDto result = new EventorDto(); request.Headers["Authorization"] = base64HeaderValue; using (var response = request.GetResponse()) { var status = ((HttpWebResponse)response).StatusDescription; // Get the stream containing content returned by the server. // The using block ensures the stream is automatically closed. using (Stream dataStream = response.GetResponseStream()) { // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader(dataStream ?? throw new InvalidOperationException()); // Read the content. string responseFromServer = reader.ReadToEnd(); // the content response. result = JsonConvert.DeserializeObject <EventorDto>(responseFromServer); } } CustomFlyoutDialog.ShowForm(this, null, new XtraUserControl1(result)); } }
public static DialogResult ShowForm(Form owner, FlyoutAction actions, Control userControlToShowControl) { CustomFlyoutDialog customFlyoutDialog = new CustomFlyoutDialog(owner, actions, userControlToShowControl); return(customFlyoutDialog.ShowDialog()); }