示例#1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //string token = settings.Token;
            //if (string.IsNullOrEmpty(token))
            //{
            //    token = acquireToken.GetToken();
            //    settings.Token = token;
            //}

            void boot()
            {
                // ----- App-Init
                KernelContainer kernelContainer = new KernelContainer();
                IKernel         kernel          = kernelContainer.Kernel;

                //Register CoCo.Core
                //Add Bootstrapper
                kernel.Register <IBootstrapper, Bootstrapper>(RegisterScope.Unique);

                //Register components
                new KernelInitializer().Initialize(kernel);

                //Activate components
                IBootstrapper bootstrapper = kernel.Get <IBootstrapper>();

                bootstrapper.ActivatingAll();
                bootstrapper.ActivatedAll();
                bootstrapper.RegisterAllMappings(kernel);

                this.bot = kernel.Get <IBot>();

                bot.Connected       += Bot_Connected;
                bot.MessageReceived += this.Bot_MessageReceived;

                bot.Connect("tarosmolos");
            };
            Task.Factory.StartNew(() => boot());

            ////using (IClient client = new Client())
            //{
            //    client.Connect("irc.chat.twitch.tv", 6697);
            //    client.Login("tarosmolos", token);
            //    //Channel channel = client.GetChannel("raupling");
            //}
        }