using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using FastReport.Forms;
using FastReport.Utils;
namespace FastReport.Cloud.StorageClient.Box
{
///
/// Represents form of the web browser.
///
public partial class WebBrowserForm : BaseForm
{
#region Fields
private string url;
private string authCode;
#endregion // Fields
#region Properties
///
/// Gets obtained authorization code.
///
public string AuthCode
{
get { return authCode; }
}
#endregion // Properties
#region Constructros
///
public WebBrowserForm(string url)
{
InitializeComponent();
this.url = url;
authCode = "";
UIUtils.CheckRTL(this);
}
#endregion // Constructros
#region Events Handlers
private void WebBrowserForm_Shown(object sender, EventArgs e)
{
wbBrowser.Navigate(url);
}
private void wbBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (wbBrowser.Url.ToString().Contains("code="))
{
Console.WriteLine(wbBrowser.Url.ToString());
authCode = Regex.Split(Regex.Split(wbBrowser.Url.ToString(), "code=")[1], "<")[0];
Close();
}
}
#endregion // Events Handlers
}
}