示例#1
0
        public TelegramTerminalClientWindow(TelegramWrapper telegram)
        {
            _telegram = telegram;
            //this.Loaded += TelegramTerminalClientWindow_LoadedAsync;
            //this.Ready += TelegramTerminalClientWindow_Ready;
            //this.Added += TelegramTerminalClientWindow_Added;
            //this.DrawContent += TelegramTerminalClientWindow_DrawContent;
            //this.Enter += TelegramTerminalClientWindow_Enter;
            //this.Initialized += TelegramTerminalClientWindow_Initialized;
            //this.LayoutComplete += TelegramTerminalClientWindow_LayoutComplete;
            //this.LayoutStarted += TelegramTerminalClientWindow_LayoutStarted;
            //this.Leave += TelegramTerminalClientWindow_Leave;
            //this.Removed += TelegramTerminalClientWindow_Removed;
            //this.Unloaded += TelegramTerminalClientWindow_Unloaded;

            var top = Application.Top;

            _colorScheme = new ColorScheme();

            this.Title = "Telegram Client";
            this.X     = 0;
            this.Y     = 1; // Leave one row for the toplevel menu

            // By using Dim.Fill(), it will automatically resize without manual intervention
            this.Width  = Dim.Fill();
            this.Height = Dim.Fill(1);


            SetupLayoutAsync(3);

            top.Add(this);
        }
示例#2
0
        static async Task Main(string[] args)
        {
            using IHost host = CreateHostBuilder(args).Build();

            var telegram = new TelegramWrapper(_options);
            await telegram.ConnectAsync();

            Application.Init();
            // Application code should start here.

            //await host.RunAsync();
            //Application.Run(new TelegramTerminalClientWindow());
            //Application.Top.Add(new TelegramTerminalClientWindow());
            var top    = Application.Top;
            var window = new TelegramTerminalClientWindow(telegram);

            top.Add(window);
            Application.Run();
            //Application.Run<TelegramTerminalClientWindow>();
            //Application.Run();
            //StartClient();
            //Console.WriteLine("Press any key to exit");
            //Console.ReadLine();
        }