[Mono-list] Remoting a GTK UI

George Farris farrisg at mala.bc.ca
Tue May 31 11:14:56 EDT 2005


On Mon, 2005-05-30 at 17:18 -0400, Nigel Benns wrote: 
> If you use GLADE, you could host the file on a web/ftp server and just
> retrive it when the application starts.
> 
> > Does anyone have some example code to show how to effectively remote a
> > gtk# UI?  I'm simply not knowledgeable enough about this type of thing
> > and documentation about it is severely lacking.
> >

Not what I meant. I want to have a .NET remoting client control a
widget in a remote gtk server app.

As an example: with the small piece of code below, how do I get the
AccountNumber class to reference ui so I can control the interface and
will this actually work or will the thread hang?  I'm not a threading
guru, in fact never done any threading code so I really don't understand
all the ins and outs yet.

using Gtk;
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

class Server
{
  public static MyWindow ui;

  public static void Main ()
  {
    Application.Init();
    ui = new MyWindow();

    Console.WriteLine("running, listening on port 8080...");
    ChannelServices.RegisterChannel(new HttpChannel(8080));
RemotingConfiguration.RegisterWellKnownServiceType(typeof(AccountNumber), 
"ui", WellKnownObjectMode.Singleton);

    Application.Run(); 
  }
}

public class AccountNumber : MarshalByRefObject 
{
  public string GetAccount()
  {
    ui.ShowAll();
    string s = ui.AccountNo.Text;
    ui.HideAll();
    return s;
  }
}

-- 
George Farris   farrisg at mala.bc.ca
Malaspina University-College





More information about the Mono-list mailing list