I am looking at this site : https://bitbucket.org/geckofx/geckofx-14.0
I don't know anything about GeckOFX, so downloading the the zip file I make references to Geckofx-core-14 and Geckofx-WinForms-14.
I use the this code...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Gecko;
using GeckoFX;
namespace GeckoFXTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//Gecko.Xpcom.Initialize("C:\\tools\\xulrunner");
GeckoWebBrowser myBrowser = new GeckoWebBrowser();
this.Controls.Add(myBrowser);
myBrowser.Dock = DockStyle.Fill;
myBrowser.Navigate("http://www.google.com");
}
}
}
But I think I am missing something, can someone tell me what I am missing? OR how to get started, I can't find docks for GeckOFX 14
Using C# WinForms 4.0 .Net
Thanks in Advance.
The line you have commented out is important:
//Gecko.Xpcom.Initialize("C:\\tools\\xulrunner");
You need to download xulrunner 14 or firefox 14 and tell geckofx where to find it, by calling Gecko.Xpcom.Initialze before creating the GeckoWebBrowser control.
Also you only need to call Xpcom.Initialize once per application so you prolly don't want to put it in your Form Constructor.
You can download xulrunner-sdk
https://bitbucket.org/geckofx/geckofx-33.0/downloads
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Gecko;
using Gecko.DOM;
using System.Net.Mail;
using System.Net.Mime;
using System.IO;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Gecko.Xpcom.Initialize(#"F:\bak\Desktop\frefox c sharp\xulrunner-33.1.1.en-US.win32.sdk\xulrunner-sdk\bin");
}
private void button4_Click(object sender, EventArgs e)
{
geckoWebBrowser1.Navigate("http://example.com");
}
}
Related
I'm trying to start my first project with Cppsharp using Visual Studio 2015, following the getting started guide.
The steps I followed were to:
Create new C# console project
Install Cppsharp using Nuget
Add references to Dlls into the project
Create C# source file based on the example in this old post
Whilst the example in the post is old, it still seems to be consistent with the getting started guide. The full program is listed below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CppSharp;
namespace CppSharpTest
{
class Program
{
class DllDemoGenerator : ILibrary
{
static void Main(string[] args)
{
ConsoleDriver.Run(new DllDemoGenerator());
}
void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = LanguageGeneratorKind.CSharp;
options.LibraryName = "DllDemo";
options.Headers.Add("DllDemo.h");
options.Libraries.Add("DllDemo.lib");
}
public void SetupPasses(Driver driver) { }
public void Preprocess(Driver driver, CppSharp.AST.Library lib) { }
public void Postprocess(CppSharp.AST.Library lib) { }
}
}
}
However, I am already facing errors See image:
CS0012 C# The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=...'
I was not able to find a way to add this reference. One solution I found proposed to target a higher .NET version (4.7.2) and I tried this, but the error still remains.
Can anyone help to overcome this problem?
Posted the same question on the Github page and was recommended to upgrade from VS2015
Installing VS2019 removed this error
I'm using CefSharp version 43.0.0 in a large WinForms application, where I pass parameters to Google Maps, i.e., Source and Destination addresses, in order to produce the familiar map and turn-by-turn directions. This works OK. However, I need to capture the much longer, more complete URL that a user would normally get by using Google Maps.
If I take the same parameters, i.e., simple Source from and Destination To address and plug it into any other browser, Google Maps returns a longer, more complete URL containing latitude and longitude address. (Notice the sample shown below).
When I pass the parameters to Google using the Chromium Web Browser (CEF) I get the map, but Not the complete URL.
Could someone suggest how I can get the desired URL when using CEF? Please bear in mind that this is a WinForms App, and not a Web App.
https://www.google.com/maps/dir/2230+Picton+Pkwy,+Akron,+OH+44312/1680+E+Waterloo+Rd,+Akron,+OH+44306/#41.0149182,-81.48249,14z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x88312b00dd84936f:0xb1901f583967068e!2m2!1d-81.467646!2d41.003081!1m5!1m1!1s0x88312bb5f325ca6b:0x48697b37d442dccf!2m2!1d-81.4676985!2d41.0246252
Here is what I have tried so far, as shown in the following code. I pass parameters from one form to the form containing the Chromium Browser.
It creates the map with directions, but doesn't return the longer, more complete URL that I would receive if I enter the same parameters manually into another browser like Firefox, Chrome, etc.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CefSharp.WinForms;
using CefSharp;
namespace myApplication
{
public partial class myDirectionFinder : Form
{
public ChromiumWebBrowser browser;
public myDirectionFinder()
{
InitializeComponent();
CefSettings settings = new CefSettings();
if (!CefSharp.Cef.IsInitialized)//Cef can only be initialized once. Using 'Cef.IsInitialized' guards against an exception.
{
CefSharp.Cef.Initialize(settings);
}
}
private void myDirectionFinder_FormClosing(object sender, FormClosingEventArgs e)
{
browser = null;
}
private void myDirectionFinder_Load(object sender, EventArgs e)
{
browser = new ChromiumWebBrowser(txtUrlPasser.Text) { Dock = DockStyle.Fill };
txtFinalAddr.Text = "";
txtFinalAddr.Text = browser.Address.ToString();
pnlBrowser.Controls.Add(browser);
}
}
}
I'm using VS2012 and ServiceStack 4.0.46. I have setup a web service which is working as expected. I now need to setup a second web service which makes calls to the first one.
In my second web service I have tried to add a ServiceStack reference to the first service. This mostly works however in the file created I get
/* Options:
Date: 2015-11-11 09:25:20
Version: 4.046
BaseUrl: http://nlc20030:8008/api
//GlobalNamespace:
//MakePartial: True
//MakeVirtual: True
//MakeDataContractsExtensible: False
//AddReturnMarker: True
//AddDescriptionAsComments: True
//AddDataContractAttributes: False
//AddIndexesToDataMembers: False
//AddGeneratedCodeAttributes: False
//AddResponseStatus: False
//AddImplicitVersion:
//InitializeCollections: True
//IncludeTypes:
//ExcludeTypes:
//AddDefaultXmlNamespace: http://schemas.servicestack.net/types
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using NLC.Library;
using Waste.Collection;
using Wards;
using Syndication.RSS;
using AbandonedVehicle;
using Search.Address;
using Waste.Collection.Asbestos;
using Waste.Collection.Asbestos.SinceDate;
using Waste.Collection.Bulky;
using Waste.Collection.Bulky.SinceApril;
using Waste.Collection.Bulky.SinceDate;
using Calendar.BinCollection;
using Calendar;
using Search.Civica.Client;
using Search.Civica;
using Dog.Fouling.Cleanse;
using Waste.Litter.Cleanse;
using Search.Confirm;
using CrossSystem;
using Dog;
using DateInfo.English;
using Encrypt;
using Flytipping;
using ;
using Dog.Fouling.Investigate;
using Waste.Litter.Investigate;
using IsValid.NINO.ECS;
using IsValid.NASS;
using IsValid.NINO;
using IsValid;
using IsValid.PostCode;
using IsValid.UPRN;
using IsValid.USRN;
using Job;
using Job.Recent;
using Light;
using LLPG;
using LLPG.Property;
using Requests;
using Noise;
using Odour;
using VictoriaForms;
using Waste.PrivateProperty;
using Encrypt.RC4.Hex;
using Encrypt.RC4;
using Search;
using Smoke;
using SOA.Call.Environment;
using SOA.Call.Environment.Operations;
using SOA.Call.Environment.Operations.System.IsError;
using SOA.Call.Environment.Operation.System.IsError.StartRecord;
using SOA.Call.Environment.Operations.System;
using SOA.Message;
using SOA;
using Search.Street;
using Waste.Collection.Tomorrow.Feed;
using Waste.Collections.Tomorrow;
It's the
using ;
line which is causing me issues
I've checked the DTO's in my original web service and there appears to be nothing that is out of order. If I delete the line above, it reappears when I save the file.
I've clearly done something wrong but am unsure how to figure out what
After some investigation I have discovered the root cause of this issue, it was, as I originally suspected, my fault. I tracked it down to one particular Service and it turned out that the get method was using the wrong class, which happened to have the same name, as the intended request DTO.
So I had
Public Class HonorificService
Inherits ServiceStack.Service
Public Function [Get](request As Honorific) As Object
When I should have had
Public Class HonorificsService
Inherits ServiceStack.Service
Public Function [Get](request As Lookups.Honorific) As Object
I am using selenium version 2.45 with internet explorer 11 and works well
but i have problem in assert function and tr and catch they aren't included!!
so how can i start maybe i did something wrong btw i start with console application and added reference (Selenium WebDriver, Selenium WebDriver Support Classes, WebDriver-backed Selenium, Selenium Remote Control.)
if there is something wrong kindly tell me how can i start from first
-my code open google and search for amazon then open amazon and search for something invalid i want make it return that there is no data find
so how can i search for text on page line "did not match"
thanks in advance.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Diagnostics;
using System.Collections;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Interactions;
class GoogleSuggest
{
static void Main(string[] args)
{
IWebDriver driver = new InternetExplorerDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
driver.Navigate().GoToUrl("http://www.google.com/");
driver.FindElement(By.Id("lst-ib")).SendKeys("amazon");
driver.FindElement(By.Id("lst-ib")).SendKeys(Keys.Enter);
driver.FindElement(By.ClassName("r")).Click();
driver.FindElement(By.Id("twotabsearchtextbox")).SendKeys("akajerhfbds bvksajhgrcbskhb");
driver.FindElement(By.Id("twotabsearchtextbox")).SendKeys(Keys.Enter);
Thread.Sleep(6000);
driver.Quit();
}
}
I did a search on Amazon for "asdvasdv" - inspecting the elements, there is one with an id of "noResultsTitle" - if Amazon is consist with this you can use
FindElement(By.CssSelector("[id*='noResults']"))
I am trying to do image manipulation in c# in windows 7 using VS 2012 express desktop. I made a console app with this code, and its giving errors about Bitmap cannot be found. Does anyone know whats wrong?
I already imported the system.drawing, but still cannot be found...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace ImageSplit
{
class Program
{
static void Main(string[] args)
{
System.Drawing.Rectangle cropRect = new Rectangle(0, 0, target.Width, target.Height);
Bitmap src = Image.FromFile(fileName) as Bitmap;
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using(Graphics g = Graphics.FromImage(target))
{
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height), cropRect, GraphicsUnit.Pixel);
}
}
}
}
Make sure you include a reference to the System.Drawing assembly in the project. Referencing/importing the namespace is not enough for the linker to find the assembly in question. This is what the error message is referring to by "Are you missing an assembly reference?"
Right-click the project, select "Add Reference..." and choose the appropriate file. This will add a reference to the assembly in the /References virtual project folder.