本文整理汇总了C#中WebControl类的典型用法代码示例。如果您正苦于以下问题:C# WebControl类的具体用法?C# WebControl怎么用?C# WebControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebControl类属于命名空间,在下文中一共展示了WebControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebViewer
public WebViewer(FileInfo file)
{
InitializeComponent();
File = file;
Text = Path.GetFileNameWithoutExtension(File.FullName);
_childBrowser = new WebControl();
_childBrowser.WebView = new WebView();
_childBrowser.WebView.FileDialog += OnProcessFileDialog;
_childBrowser.WebView.BeforeDownload += OnWebViewBeforeDownload;
_childBrowser.WebView.DownloadUpdated += OnWebViewDownloadUpdated;
_childBrowser.WebView.DownloadCompleted += OnWebViewDownloadCompleted;
_childBrowser.WebView.DownloadCanceled += OnWebViewDownloadCanceled;
_childBrowser.WebView.CustomUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Essential Objects Chrome/41.0.2272.16 Safari/537.36";
Controls.Add(_childBrowser);
_browser = new WebControl();
_browser.WebView = new WebView();
_browser.Dock = DockStyle.Fill;
_browser.WebView.LoadCompleted += OnMainWebViewLoadComplete;
_browser.WebView.NewWindow += OnMainWebViewNewWindow;
_browser.WebView.BeforeDownload += OnWebViewBeforeDownload;
_browser.WebView.CustomUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Essential Objects Chrome/41.0.2272.16 Safari/537.36";
Controls.Add(_browser);
_browser.BringToFront();
}
示例2: WebViewer
public WebViewer()
: base(WindowType.Toplevel)
{
xml = new XML (null, "MainWindow.glade", "mainBox", null);
xml.Autoconnect (this);
Gdk.Pixbuf pix = new Gdk.Pixbuf (null, "webnotes-16.png");
//Window settings
Title = "WebNotes";
WindowPosition = WindowPosition.Center;
Icon = pix;
Resize (650,600);
//Trayicon stuff
trayIcon = new TrayIcon ("WebNotes");
EventBox ebox = new EventBox ();
ebox.ButtonPressEvent += ButtonPressed;
Image image = new Image (pix);
ebox.Add (image);
trayIcon.Add (ebox);
trayIcon.ShowAll ();
//Gecko webcontrol
wc = new WebControl ();
wc.LoadUrl ("http://localhost:8000");
geckoBox.Add (wc);
optionMenu.Changed += OptionChanged;
BuildMenu ();
int firstPage = list.IndexOf ("WikiHome");
if (firstPage != -1)
optionMenu.SetHistory ((uint)firstPage);
Add (mainBox);
}
示例3: OnLoad
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
var item = Sitecore.Context.Database.GetItem(Path);
if (item == null)
return;
NameValueCollection parameters = new NameValueCollection();
foreach (Field field in item.Fields)
{
parameters.Add(field.Name, field.Value);
}
IRenderingType renderType = null;
if (item.TemplateID == SitecoreIds.GlassBehindRazorId)
renderType = new BehindRazorRenderingType();
else if (item.TemplateID == SitecoreIds.GlassDynamicRazorId)
renderType = new DynamicRazorRenderingType();
else if (item.TemplateID == SitecoreIds.GlassTypedRazorId)
renderType = new TypedRazorRenderingType();
_control = renderType.GetControl(parameters, false) as WebControl;
_control.DataSource = this.DataSource;
this.Controls.Add(_control);
base.OnLoad(e);
}
示例4: copyAuctionCategories
public static void copyAuctionCategories(WebControl wc)
{
string jsLib = getMyJavascript();
try
{
//Создание таблицы categories, если таковой еще нет
MySqlConnection con = new MySqlConnection(connectionString);
string dbCommand = "CREATE TABLE IF NOT EXISTS categories (browserValue VARCHAR(15) PRIMARY KEY, categoryName VARCHAR(50));";
MySqlCommand comm = new MySqlCommand(dbCommand, con);
con.Open();
comm.ExecuteNonQuery();
con.Close();
//Функции javascript
JSValue categoryData = wc.ExecuteJavascriptWithResult(jsLib);
JSValue[] records;
records = (JSValue[])categoryData;
JSValue[] catName = (JSValue[])records[0];
JSValue[] browVal = (JSValue[])records[1];
addCategoryData(catName, browVal);
}
catch(Exception exception)
{
MessageBox.Show(exception.Message);
}
}
示例5: ControlLoaded
void ControlLoaded(object sender, RoutedEventArgs e)
{
control.Loaded -= ControlLoaded;
var session = WebCore.CreateWebSession(baseDirectory, new WebPreferences(true)
{
CustomCSS = @"body { font-family: Segoe UI, sans-serif; font-size:0.8em;}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background-color: white; }
::-webkit-scrollbar-thumb { background-color: #B9B9B9; }
::-webkit-scrollbar-thumb:hover { background-color: #000000; }"
});
wb = new WebControl
{
WebSession = session,
UseLayoutRounding = true,
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
};
wb.Loaded += WbLoaded;
AwesomiumResourceHandler.Host = this;
WebCore.ResourceInterceptor = AwesomiumResourceHandler.ResourceInterceptor;
wb.ShowCreatedWebView += AwesomiumResourceHandler.ShowCreatedWebView;
wb.LoadHTML(Html);
control.Content = wb;
}
示例6: login
public static void login (WebControl webControl1)
{
try
{
dynamic document = (JSObject)webControl1.ExecuteJavascriptWithResult("document");
if (document == null)
throw new Exception("document has null value");
dynamic element = document.getElementById("userEmail");
if (element == null)
throw new Exception("email has null value");
element.value = "[email protected]";
element = document.getElementById("userPassword");
element.value = "ee34nf3o";
element = document.getElementsByTagName("input");
for (int i = 0; i < element.length; i++)
{
if (element[i].getAttribute("src") == "images/go_btn.png") ;
{
element[i].click();
break;
}
}
Thread.Sleep(2000);
webControl1.Source = new Uri("http://w1.dwar.ru/area_auction.php");
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
示例7: ControlLoaded
void ControlLoaded(object sender, RoutedEventArgs e)
{
control.Loaded -= ControlLoaded;
var session = WebCore.CreateWebSession(baseDirectory, new WebPreferences(true)
{
WebGL = true,
EnableGPUAcceleration = true,
SmoothScrolling = true,
CustomCSS = @"body { font-family: Segoe UI, sans-serif; font-size:0.8em;}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background-color: white; }
::-webkit-scrollbar-thumb { background-color: #B9B9B9; }
::-webkit-scrollbar-thumb:hover { background-color: #000000; }"
});
markpadDataSource = new MarkpadDataSource();
session.AddDataSource("markpad", markpadDataSource);
wb = new WebControl
{
WebSession = session,
UseLayoutRounding = true,
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Source = new Uri("asset://markpad/MarkpadPreviewRender.html"),
};
wb.Loaded += WbLoaded;
AwesomiumResourceHandler.Host = this;
WebCore.ResourceInterceptor = AwesomiumResourceHandler.ResourceInterceptor;
wb.ShowCreatedWebView += AwesomiumResourceHandler.ShowCreatedWebView;
LoadHtml(Html);
control.Content = wb;
}
示例8: WebViewSimpleLifeCycleManager
public WebViewSimpleLifeCycleManager(WebControl First, WebControl Second)
{
_First=First;
_Second = Second;
_First.Visibility = Visibility.Hidden;
_Second.Visibility = Visibility.Hidden;
}
示例9: addNewTab
private void addNewTab()
{
//Lets generate a random ID for the tab. It should be good for about 10000 tabs a session.
Random random = new Random();
int randomNumber = random.Next(0, 10000);
CloseableTabItem item = new CloseableTabItem();
item.Header = "New Tab";
item.SetBrowserTabId(randomNumber);
WebControl ctrl = new WebControl();
item.Content = ctrl;
ctrl.Width = item.Width;
ctrl.Height = item.Height;
ctrl.LoadURL("http://google.com");
tabs[randomNumber] = item;
browserTabs.Items.Add(item);
ctrl.PageContentsReceived +=
new Awesomium.Core.PageContentsReceivedEventHandler(Browser_PageContentsReceived);
ctrl.BeginLoading +=
new Awesomium.Core.BeginLoadingEventHandler(Browser_BeginLoading);
item.CloseTab +=
new RoutedEventHandler(CloseTab_Click);
browserTabs.SelectedItem = item;
}
示例10: SetControlCss
/// <summary>
/// Sets the specified control CSS class.
/// </summary>
private void SetControlCss(WebControl ctrl, string cssClass)
{
if (!string.IsNullOrEmpty(cssClass))
{
ctrl.ControlStyle.Reset();
ctrl.CssClass = cssClass;
}
}
示例11: AutoComplit
private void AutoComplit(ref JObject joContextKey, string methodUrl, WebControl control)
{
JObject jo = new JObject();
jo["contextKey"] = joContextKey;
jo["methodUrl"] = VirtualPathUtility.ToAbsolute(methodUrl);
jo["minLength"] = 1;
control.Attributes.Add("AC_Options", JsonConvert.SerializeObject(jo, Formatting.None));
}
示例12: CommandManager
public CommandManager (WebControl control)
{
if (control == null)
throw new ArgumentNullException ("The Command Manager must be bound to a WebControl instance.", "control");
webControl = control;
webControl.TitleChange += new EventHandler (webControl_ECMAStatus);
}
示例13: GetParameters
///<summary>
/// Provides a NameValueCollection of Parameters listed in the
/// Webcontrol and Sublayout Data Template.
/// Takes the Parameter string Field and Separates it out as such.
///
/// Title=Some Title
/// Subtitle=Some SubTitle
/// Something=Else
///
/// Takes this, splits it out for each line, then adds to the collection.
/// The above creates:
/// {'Title'=>'Some Title','Subtitle'=>'Some SubTitle','Something'=>'Else'}
///
/// This overload assumes that the Parameters are separated by line and
/// the key/value pairs are delimited by an equal sign (=).
///</summary>
///<param name = "control">The WebControl object, usually 'this' will work.</param>
///<returns>NameValueCollection of Parameters. Returns Empty Collection if nothing.</returns>
public static NameValueCollection GetParameters(WebControl control)
{
List<char> delimiters = new List<char>();
delimiters.Add('\r');
delimiters.Add('\n');
return GetParameters(control, delimiters.ToArray(), '=');
}
示例14: resize
public static void resize(WebControl webControl, float x, float y)
{
webControl.Location = new Point((int)(webControl.Location.X * x),
(int)(webControl.Location.Y * y));
webControl.Size = new Size((int)(webControl.Size.Width * x),
(int)(webControl.Size.Height * y));
ResizeJavascript(webControl, x, y);
}
示例15: Load_Click
private void Load_Click(object sender, RoutedEventArgs e)
{
var control = new WebControl()
{
WebView = new WebView()
};
BrowserHost.Children.Add(control);
}