示例#1
0
        public ChatViewManager(QuasselClient client, ChatView debug)
            : base()
        {
            Client = client;

            if (debug == null) {
                throw new ArgumentException("debug");
            }

            Client.BufferSyncer.ActiveChanged += (obj) => {
                //Application.Refresh();
            };

            Client.BufferSyncer.Synced += delegate(Buffer[] buffers) {
                foreach (var buffer in buffers) {
                    Get(buffer.Id);
                }
            };

            Client.BufferSyncer.Message += (buffer, message) => {
                Get(buffer.Id).Add(new IrcMessageChatViewEntry(message));
            };

            DebugChatView = debug;
            DebugChatView.Add(new CenterChatViewEntry("Debug console"));
        }
示例#2
0
文件: StatusBar.cs 项目: txdv/qutter
        public StatusBarTemplate(QuasselClient client)
        {
            Client = client;

            Client.BufferSyncer.Synced += (obj) => {
                Invalid = true;
            };

            var timer = new UVTimer();
            timer.Tick += () => Invalid = true;
            timer.Start(TimeSpan.Zero, TimeSpan.FromSeconds(1));
        }
示例#3
0
文件: Main.cs 项目: txdv/qutter
        public static void Main(string[] args)
        {
            string configfile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/.config/quassel-irc.org/quasselclient.conf";
            var settings = new Settings(configfile);

            QuasselTypes.Init();

            var acc = settings.Accounts[settings.AutoConnectAccount];
            var coreConnection = new CoreConnection(acc.HostName, acc.Port, acc.User, acc.Password, false);

            Application.Init();

            var qc = new QuasselClient(coreConnection);

            ThemeManager = new ThemeManger();

            MainWindow = ThemeManager.Default.CreateMainWindow(qc);

            AsyncWatcher<QVariant> listnotifier = new AsyncWatcher<QVariant>((packet) => qc.Handle(packet));
            AsyncWatcher<Exception> excenotifier = new AsyncWatcher<Exception>((exce) => qc.Handle(exce));

            var nt = new Thread((obj) => {
                coreConnection.ReceivePacket += (packet) => {
                    listnotifier.Send(packet);
                };

                coreConnection.Exception += (exception) => {
                    excenotifier.Send(exception);
                };

                coreConnection.Connect();

                coreConnection.Loop();
            });

            nt.Start();

            Application.End += (() => {
                nt.Abort();
            });

            Application.Run(MainWindow);
        }
示例#4
0
文件: MainWindow.cs 项目: txdv/qutter
        public MainWindowTemplate(QuasselClient client, StatusBarTemplate bar, EntryTemplate entry)
        {
            Client = client;
            StatusBar = bar;
            Entry = entry;

            ChatViewManager = new ChatViewManager(client, new ChatView());

            SetPrefix("[syncing]");

            Entry.Enter += delegate {
                if (Entry.Text.Length == 0) {
                    return;
                }

                string text = Entry.Text.TrimEnd(new char [] { ' ', '\t' });

                if (text.StartsWith("/exit")) {
                    Application.Exit = true;
                } else if (text.StartsWith("/r")) {
                    Client.RequestBacklog(Client.BufferSyncer.Active.BufferInfo.Id);
                    return;
                }

                Client.BufferSyncer.Active.Send(text);

                Entry.AddHistory(text);

                Entry.Text = "";
                Entry.Position = 0;
            };

            Client.BufferSyncer.Synced += (list) => {
                SetPrefix(Client.BufferSyncer.Active);
            };

            Client.BufferSyncer.ActiveChanged += SetPrefix;

            this.Add(ChatViewManager, Box.Setting.Fill);
            this.Add(StatusBar, Box.Setting.Size);
            this.Add(Entry, Box.Setting.Size);
        }
示例#5
0
文件: MainWindow.cs 项目: txdv/qutter
        public MainWindowTemplate(QuasselClient client)
            : this(client,
				   new StatusBarTemplate(client) { Height = 1 },
				   new EntryTemplate() { Height = 1 })
        {
        }
示例#6
0
文件: Mono.cs 项目: txdv/qutter
 public MainWindowTemplate CreateMainWindow(QuasselClient client)
 {
     return new MainWindowTemplate(client);
 }
示例#7
0
文件: Network.cs 项目: txdv/qutter
 public NetworkCollection(QuasselClient client)
 {
     Client = client;
 }
示例#8
0
文件: Default.cs 项目: txdv/qutter
 public StatusBar(QuasselClient client)
     : base(client)
 {
 }
示例#9
0
文件: Default.cs 项目: txdv/qutter
 public MainWindow(QuasselClient client)
     : base(client, new StatusBar(client) { Height = 1 }, new EntryTemplate() { Height = 1 })
 {
 }