コード例 #1
0
ファイル: Base.cs プロジェクト: REALTOBIZ/mono
		public static bool Init (WebBrowser control, Platform platform)
		{
			lock (initLock) {
				if (!initialized) {
				
					Platform mozPlatform;
					try {
						short version = gluezilla_init (platform, out mozPlatform);

						monoMozDir = System.IO.Path.Combine (
						System.IO.Path.Combine (
						Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData),
						".mono"), "mozilla-" + version);

					if (!System.IO.Directory.Exists (monoMozDir))
						System.IO.Directory.CreateDirectory (monoMozDir);
						
					}
					catch (DllNotFoundException) {
						Console.WriteLine ("libgluezilla not found. To have webbrowser support, you need libgluezilla installed");
						initialized = false;
						return false;
					}
					control.enginePlatform = mozPlatform;
					initialized = true;
				}
			}
			return initialized;
		}
コード例 #2
0
		public DocumentEncoder (WebBrowser control) : base (control) {		
			IntPtr docEncoderServicePtr = IntPtr.Zero;

			this.control.ServiceManager.getServiceByContractID (
							"@mozilla.org/layout/documentEncoder;1?type=text/html",
							typeof (nsIDocumentEncoder).GUID,
							out docEncoderServicePtr);
			if (docEncoderServicePtr == IntPtr.Zero)
				throw new Mono.WebBrowser.Exception (Mono.WebBrowser.Exception.ErrorCodes.DocumentEncoderService);

			try {
				docEncoder = (nsIDocumentEncoder)Marshal.GetObjectForIUnknown (docEncoderServicePtr);
			} catch (System.Exception ex) {
				throw new Mono.WebBrowser.Exception (Mono.WebBrowser.Exception.ErrorCodes.DocumentEncoderService);
			}

			if (control.platform != control.enginePlatform)
				this.docEncoder = nsDocumentEncoder.GetProxy (control, docEncoder);
		}
コード例 #3
0
		public Callback (WebBrowser owner) 
		{
			this.owner = owner;
			
		}
コード例 #4
0
ファイル: Base.cs プロジェクト: REALTOBIZ/mono
		public static bool Bind (WebBrowser control, IntPtr handle, int width, int height)
		{
			if (!isInitialized ())
				return false;

			BindingInfo info = new BindingInfo ();
			info.callback = new CallbackBinder (control.callbacks);
			IntPtr ptrCallback = Marshal.AllocHGlobal (Marshal.SizeOf (info.callback));
			Marshal.StructureToPtr (info.callback, ptrCallback, true);
			
			info.gluezilla = gluezilla_bind (ptrCallback, handle, width, height, Environment.CurrentDirectory, monoMozDir, control.platform);
			lock (initLock) {
				if (info.gluezilla == IntPtr.Zero) {
					Marshal.FreeHGlobal (ptrCallback);
					info = null;
					initialized = false;
					return false;
				}
			}
			boundControls.Add (control as IWebBrowser, info);
			return true;
		}