public static void ShowDataViewDialog(Form owner, string title, string subtitle, string body) { using DataViewDialog dataViewDialog = new DataViewDialog { Text = title }; dataViewDialog.LabelTitle.Text = subtitle; dataViewDialog.LabelBody.Text = body; dataViewDialog.MaximumSize = new Size(dataViewDialog.MaximumSize.Width, owner.Height + 100); dataViewDialog.Size = new Size(dataViewDialog.Width, dataViewDialog.Height + 15); dataViewDialog.ShowDialog(owner); }
/// <summary> /// Shows raw text from the specified URL in a window box /// </summary> /// <param name="owner">Text to display in title</param> /// <param name="title">Text to display in title</param> /// <param name="url">URL to fetch string data from</param> public static void ShowDataWindow(Form owner, string title, string url) { var frmInfo = new DataViewDialog { Text = title }; //using (var client = Program._webClient) using (var stream = Program.WebClient.OpenRead(url)) using (var reader = new StreamReader(stream ?? throw new InvalidOperationException("Unable to read data"))) frmInfo.labelData.Text = reader.ReadToEnd(); frmInfo.MaximumSize = new Size(frmInfo.MaximumSize.Width, owner.Height - 100); frmInfo.ShowDialog(owner); }