Esempio n. 1
0
        /// <summary>
        /// <para>Construct a DCOP client handler to process DCOP messages.</para>
        /// </summary>
        ///
        /// <param name="dpy">
        /// <para>The display to attach to the DCOP connection's message
        /// processor.</para>
        /// </param>
        ///
        /// <param name="registerName">
        /// <para>The name of the application to register with DCOP, or
        /// <see langword="null"/> to register anonymously.</para>
        /// </param>
        ///
        /// <param name="addPID">
        /// <para>Set to <see langword="true"/> to add the process ID to
        /// the registered name.</para>
        /// </param>
        ///
        /// <exception cref="T:Xsharp.Dcop.DcopException">
        /// <para>Raised if the connection to the DCOP server could not be
        /// established.</para>
        /// </exception>

        public DcopClient(Display dpy, String registerName, bool addPID)
            : base(dpy, "DCOP", "KDE", "2.0", 2, 0, GetDcopServer(dpy))
        {
            // Construct the full registration name for the DCOP client.
            if (registerName == null)
            {
                registerName = "anonymous";
            }
                        #if CONFIG_EXTENDED_DIAGNOSTICS
            if (addPID)
            {
                int pid = Process.GetCurrentProcess().Id;
                if (pid != -1 && pid != 0)
                {
                    registerName += "-" + pid.ToString();
                }
            }
                        #endif

            replyId = 0;
            key     = new byte[4];

            // Register the name with the DCOP server.
            appId = registerAs(registerName);

            mainClient = this;
        }
Esempio n. 2
0
 protected void DiscoverClient()
 {
     if (DcopClient.MainClient == null)
     {
         if (Application.Primary != null)
         {
             DcopClient.MainClient = new DcopClient(Application.Primary.Display, null);
         }
     }
     this.client = DcopClient.MainClient;
 }
	private void BrowseDcop(DcopClient client)
	{
		String[] apps = client.registeredApplications();
		treeView.BeginUpdate();
		treeView.ImageIndex = 0;
		treeView.SelectedImageIndex = -1;
		treeView.ImageList = GetImageList();
		foreach(String app in apps)
		{
			BrowseApp(client, app);
		}
		treeView.EndUpdate();
	}
	public static void Main(String[] args)
	{
		String url = "http://dotgnu.org/";
		if(args.Length != 0 && args[0].StartsWith("http://"))
		{
			url = args[0];
		}
		Application app = new Application("DcopSample", args);
		DcopClient dc = new DcopClient(app.Display, null);
		DcopRef dr = new DcopRef();
		dr.DiscoverApplication("konqueror", true, true);
		dr.Obj = "KonquerorIface";
		dr.Initialise();
		dr.Call("DCOPRef openBrowserWindow(QString url)", url);
	}
	private void BrowseApp(DcopClient client, String appName)
	{
		if(appName.StartsWith("anonymous")) return;
		
		string appDisplayName = appName;
		if(appName.LastIndexOf("-") != -1)
		{
			appDisplayName = appName.Substring(0, appName.LastIndexOf("-"));
		}
		TreeNode node = treeView.Nodes.Add(appDisplayName);
		node.ImageIndex = -1;
		
		DcopRef appRef = new DcopRef(); 
		appRef.DiscoverApplication(appName, false, false);
		foreach(String obj in appRef.objects())
		{
			BrowseObject(appRef, obj, node);
		}
	}
	/// <summary>
	/// <para>Construct a DCOP client handler to process DCOP messages.</para>
	/// </summary>
	///
	/// <param name="dpy">
	/// <para>The display to attach to the DCOP connection's message
	/// processor.</para>
	/// </param>
	///
	/// <param name="registerName">
	/// <para>The name of the application to register with DCOP, or
	/// <see langword="null"/> to register anonymously.</para>
	/// </param>
	///
	/// <param name="addPID">
	/// <para>Set to <see langword="true"/> to add the process ID to
	/// the registered name.</para>
	/// </param>
	///
	/// <exception cref="T:Xsharp.Dcop.DcopException">
	/// <para>Raised if the connection to the DCOP server could not be
	/// established.</para>
	/// </exception>

	public DcopClient(Display dpy, String registerName, bool addPID)
			: base(dpy, "DCOP", "KDE", "2.0", 2, 0, GetDcopServer(dpy))
			{
				// Construct the full registration name for the DCOP client.
				if(registerName == null)
				{
					registerName = "anonymous";
				}
			#if CONFIG_EXTENDED_DIAGNOSTICS
				if(addPID)
				{
					int pid = Process.GetCurrentProcess().Id;
					if(pid != -1 && pid != 0)
					{
						registerName += "-" + pid.ToString();
					}
				}
			#endif

				replyId = 0;
				key = new byte[4];

				// Register the name with the DCOP server.
				appId = registerAs(registerName);

				mainClient = this;

			}
Esempio n. 7
0
	protected void DiscoverClient()
	{
		if(DcopClient.MainClient == null)
		{
			if(Application.Primary != null)
			DcopClient.MainClient = new DcopClient(Application.Primary.Display, null);
		}
		this.client = DcopClient.MainClient;
	}