System.Windows.Forms.HtmlElement.GetAttribute(string)

Here are the examples of the csharp api class System.Windows.Forms.HtmlElement.GetAttribute(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

12 Examples 7

1. Example

Project: lua-tilde
Source File: FindResultsPanel.cs
View license
bool GetInfoForResult(HtmlElement element, out string file, out int line, out int startChar, out int endChar)
		{
			file = element.GetAttribute("myFile");
			line = Int32.Parse(element.GetAttribute("myLine"));
			startChar = Int32.Parse(element.GetAttribute("myStartChar"));
			endChar = Int32.Parse(element.GetAttribute("myEndChar"));

			return file != "";
		}

2. Example

Project: jsBeautifier.net
Source File: JsBeautifier.cs
View license
public string getBeautifiedScript (string script)
		{
			this.ensureInitialized();

			this.jsEl.SetAttribute("value", script);
			this.webBrowser1.Document.InvokeScript("do_js_beautify");
			return (this.jsEl.GetAttribute("value"));
		}

3. Example

Project: jsBeautifier.net
Source File: JsBeautifier.cs
View license
private void initializeElements ()
		{
			HtmlElement form=this.form;

			foreach (HtmlElement e in form.GetElementsByTagName("select"))
			{
				if (e.GetAttribute("id").Equals("tabsize"))
				{
					this.indentEl = e;
					break;
				}
			}

			foreach (HtmlElement e in form.GetElementsByTagName("input"))
			{
				switch (e.GetAttribute("id"))
				{
					case "braces-on-own-line":
						this.bracesEl = e;
						break;
					case "preserve-newlines":
						this.emptyLinesEl = e;
						break;
					case "detect-packers":
						this.detectPackEl = e;
						break;
					case "keep-array-indentation":
						this.arrayIndentEl = e;
						break;
				}
			}

			foreach (HtmlElement e in form.GetElementsByTagName("textarea"))
			{
				if (e.GetAttribute("id").Equals("content"))
				{
					this.jsEl = e;
					break;
				}
			}

			foreach (HtmlElement e in form.GetElementsByTagName("button"))
			{
				if (e.GetAttribute("id").Equals("beautify"))
				{
					this.beautifyBtnEl = e;
					break;
				}
			}
		}

4. Example

Project: KeeThief
Source File: XmlUtil.cs
View license
public static string SafeAttribute(HtmlElement htmlNode, string strName)
		{
			if(htmlNode == null) { Debug.Assert(false); return string.Empty; }
			if(string.IsNullOrEmpty(strName)) { Debug.Assert(false); return string.Empty; }

			string strValue = (htmlNode.GetAttribute(strName) ?? string.Empty);

			// http://msdn.microsoft.com/en-us/library/ie/ms536429.aspx
			if((strValue.Length == 0) && strName.Equals("class", StrUtil.CaseIgnoreCmp))
				strValue = (htmlNode.GetAttribute("className") ?? string.Empty);

			return strValue;
		}

5. Example

Project: BotSuite
Source File: Browser.cs
View license
public List<HtmlElement> GetElementsByClassName(string className)
		{
			List<HtmlElement> htmlElements = new List<HtmlElement>();

			HtmlDocument htmlDocument = this._browser.Document;
			if(htmlDocument != null)
			{
				htmlElements.AddRange(
					htmlDocument.All.Cast<HtmlElement>().Where(htmlElement => htmlElement.GetAttribute("className") == className));
			}

			return htmlElements;
		}

6. Example

View license
private bool HasLoginPage()
        {
            HtmlDocument doc = WebBrowser.Document;
            HtmlElement passwordFieldElement = null;

            if (null != doc)
            {
                passwordFieldElement =
                    (
                        from element in doc.GetElementsByTagName("INPUT").Cast<HtmlElement>()
                        where
                            0 == string.Compare(element.GetAttribute("type"), "password", StringComparison.Ordinal)
                            && element.Enabled
                            && element.OffsetRectangle.Height > 0
                            && element.OffsetRectangle.Width > 0
                        select element
                        ).FirstOrDefault();
            }

            return passwordFieldElement != null;
        }

7. Example

View license
private bool HasLoginPage()
        {
            HtmlDocument doc = this.WebBrowser.Document;
            HtmlElement passwordFieldElement = null;

            if (null != doc)
            {
                passwordFieldElement =
                    (
                        from element in doc.GetElementsByTagName("INPUT").Cast<HtmlElement>()
                        where string.Equals(element.GetAttribute("type"), "password", StringComparison.OrdinalIgnoreCase)
                           && element.Enabled
                           && element.OffsetRectangle.Height > 0
                           && element.OffsetRectangle.Width > 0
                        select element
                    ).FirstOrDefault();
            }

            return passwordFieldElement != null;
        }

8. Example

View license
private string DetermineFavIconUrl(HtmlDocument htmlDocument)
        {
            var links = htmlDocument.GetElementsByTagName("link");
            var favIconLink =
                links.Cast<HtmlElement>()
                     .SingleOrDefault(x => x.GetAttribute("rel").ToLowerInvariant() == "shortcut icon");

            if (favIconLink == null || htmlDocument.Url == null)
            {
                return null;
            }
            var href = favIconLink.GetAttribute("href");

            if (htmlDocument.Url.PathAndQuery == "/")
            {
                //Szenario: http://test.test/teamcity/....
                return htmlDocument.Url.AbsoluteUri.Replace(htmlDocument.Url.PathAndQuery, href);
            }
            else
            {
                //Szenario: http://teamcity.domain.test/
                return new Uri(new Uri(htmlDocument.Url.AbsoluteUri), href).ToString();
            }
        }

9. Example

Project: HourBoostr
Source File: BrowserForm.cs
View license
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
   /n ..... /n //View Source file for more details /n }

10. Example

View license
internal static string GetAuthorizationCode(GoogleTestUser acc, string scope, string redirectUri, st/n ..... /n //View Source file for more details /n }

11. Example

Project: gac4net
Source File: Form1.cs
View license
private void parsePage()
        {
            HtmlElementCollection collection = web.Document.GetEl/n ..... /n //View Source file for more details /n }

12. Example

Project: SirenOfShame
Source File: TeamCityService.cs
View license
private void SetCookie(string rootUrl, string userName, string password)
        {
            _log./n ..... /n //View Source file for more details /n }