private void OpenDataViewWindowMethod(Window wnd)
        {
            DataViewWindow dataWindow = new DataViewWindow();

            dataWindow.Show();
            wnd.Close();
        }
예제 #2
0
        /// <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)
        {
            DataViewWindow frmInfo = new DataViewWindow {
                Text = title
            };

            //using (var client = Program._webClient)
            using (Stream stream = Program.WebClient.OpenRead(url))
                using (StreamReader 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);
        }