示例#1
0
        private MainWindow(Builder builder) : base(builder.GetObject("_mainWindow").Handle)
        {
            builder.Autoconnect(this);
            _titlebar.Destroyed += _titleBar_Destroyed;

            Program.Client.AuthStateChanged += Client_StateChanged1;

            InfoBarMessage             = new Label("");
            InfoBarMessage.Halign      = Align.Center;
            InfoBar.ContentArea.Expand = false;
            InfoBar.PackStart(InfoBarMessage, true, true, 0);
            var button = new Button(Gtk.Stock.Close);

            button.Clicked += InfoBarCloseButtonClicked;
            InfoBar.PackStart(button, false, false, 0);

            this.InfoBar.Hide();
            this.InfoBar.Respond += (o, args) =>
            {
                InfoBar.Hide();
            };

            _codePage = new CodePage(this);
            _stackWidget.AddNamed(_codePage, "CodePage");
            _chatPage = new ChatPage();
            _stackWidget.AddNamed(_chatPage, "ChatPage");
            _chatsBar.SizeAllocated += _titlebar_SizeAllocated;
            _phonePage = new PhonePage(this);
            _stackWidget.AddNamed(_phonePage, "PhonePage");
            _chatsBar.SizeAllocated += _titlebar_SizeAllocated;

            /*for (int i = 0; i < 5; i++)
             * {
             *  _listBox.Add(new ChatBoxEntry() {
             *      Channel = "Channel name",
             *      LastMessage = "Last message",
             *      UnreadCount = i,
             *      Date = DateTime.Now,
             *      Icon = "TelegramApp.Data.TelegramIcon.png"
             *  });
             * }
             * _listBox.ShowAll();*/

            NavigateToAsync(PageType.Chat);
            Program.Client.Start();
        }