コード例 #1
0
        public LoginWindow(GTKClientCtrl ctrl) : base("Chat XYZ Login")
        {
            this.ctrl = ctrl;
            SetDefaultSize(300, 300);
            SetPosition(WindowPosition.Center);
            DeleteEvent += CloseWindow;

            VBox  vbox  = new VBox(false, 2);
            Table table = new Table(4, 4, false);

            table.Attach(new Label("Chat XYZ"), 0, 4, 0, 1);
            table.Attach(new Label("Username"), 0, 2, 1, 2);
            table.Attach(username = new Entry(), 2, 4, 1, 2);

            table.Attach(new Label("Password"), 0, 2, 2, 3);
            table.Attach(password = new Entry(), 2, 4, 2, 3);
            password.Visibility   = false;

            table.Attach(cancel = new Button("Clear"), 0, 2, 3, 4);
            table.Attach(login  = new Button("Login"), 2, 4, 3, 4);

            login.Clicked  += loginButtonPressed;
            cancel.Clicked += cancelButtonPressed;

            vbox.PackEnd(table, true, true, 0);


            Add(vbox);
        }
コード例 #2
0
ファイル: StartGTKClient.cs プロジェクト: haja-fgabriel/mpp
        public static void Main(string[] args)
        {
            Application.Init();
            IChatServices server = new ChatServerProxy("127.0.0.1", 55555);
            GTKClientCtrl ctrl   = new GTKClientCtrl(server);
            Window        w      = new LoginWindow(ctrl);

            // Window w = new ChatWindow();
            w.ShowAll();
            Application.Run();
        }
コード例 #3
0
ファイル: GTKChatWindow.cs プロジェクト: haja-fgabriel/mpp
        public ChatWindow(GTKClientCtrl ctrl, String title) : base(title)
        {
            this.ctrl = ctrl;

            friendsStore = new ListStore(typeof(string));

            messageStore = new ListStore(typeof(string));

            IList <String> onlineFriends = ctrl.getLoggedFriends();

            foreach (var friend in onlineFriends)
            {
                friendsStore.AppendValues(friend);
            }
            //friendsStore.AppendValues("friend1 ");
            //friendsStore.AppendValues("friend2 ");
            SetDefaultSize(500, 500);
            SetPosition(WindowPosition.Center);

            VBox  vbox  = new VBox(false, 1);
            Table table = new Table(10, 7, false);
            //lista pentru mesaje
            ScrolledWindow sw = new ScrolledWindow();

            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            sw.Add(messagesList = new TreeView(messageStore));
            table.Attach(sw, 0, 4, 0, 7);
            CellRendererText rendererText = new CellRendererText();
            TreeViewColumn   column       = new TreeViewColumn("Messages", rendererText, "text", 0);

            messagesList.AppendColumn(column);
            messagesList.HeadersVisible = true;

            //lista pentru prieteni
            ScrolledWindow sw2 = new ScrolledWindow();

            sw2.ShadowType = ShadowType.EtchedIn;
            sw2.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            sw2.Add(friendsList = new TreeView(friendsStore));
            table.Attach(sw2, 5, 7, 1, 7);

            rendererText = new CellRendererText();
            column       = new TreeViewColumn("Online Friends", rendererText, "text", 0);
            friendsList.AppendColumn(column);
            //pentru mesaj
            table.Attach(new Label("Mesaj"), 0, 2, 7, 8);
            table.Attach(textMesaj = new Entry(), 3, 7, 7, 8);

            //pentru butoane
            table.Attach(logout  = new Button("Logout"), 0, 3, 8, 9);
            table.Attach(trimite = new Button("Trimite mesaj"), 5, 7, 8, 9);

            trimite.Clicked += trimiteButtonPressed;
            logout.Clicked  += logoutButtonPressed;
            DeleteEvent     += closeWindow;

            vbox.PackEnd(table, true, true, 0);


            Add(vbox);

            ctrl.updateEvent += userUpdate;
        }