예제 #1
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);
        }
예제 #2
0
        public AsyncCoreConnection(Loop loop, CoreConnection coreConnection)
        {
            Loop = loop;
            CoreConnection = coreConnection;

            listnotifier = new AsyncWatcher<QVariant>((packet) => OnReceivePacket(packet));
            exceptionnotifier = new AsyncWatcher<Exception>((exception) => OnException(exception));

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

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

                coreConnection.Connect();

                coreConnection.Loop();
            });
        }
예제 #3
0
 internal QuasselClient(CoreConnection connection)
 {
     this.connection = connection;
     NetworkCollection = new NetworkCollection(this);
     BufferSyncer = new BufferSyncer(this);
 }