예제 #1
0
        public BotForm(Builder builder, IntPtr handle) : base(handle)
        {
            //revealer = new Widget (builder.GetObject ("revealer1").Handle);

            CssProvider provider = new CssProvider();

            provider.LoadFromPath("test.css");
            ApplyCss(this, provider, uint.MaxValue);
            builder.Autoconnect(this);
            //DeleteEvent += OnDeleteEvent;
            //Destroyed += new EventHandler (OnDestroy);


            Console.SetOut(new ControlWriter(textview1, scrolledwindow1));


            List <IPlugin> plugins = new List <IPlugin> ();
            var            ps      = Serializer.plugins.Values;

            foreach (IPlugin plugin in ps)
            {
                plugins.Add(plugin);
            }
            Console.WriteLine("Connected to repository: {0}/{1}", MainWindow.manager.repo.Owner.Login, MainWindow.manager.repo.Name);
            bot = new OECBot(plugins, MainWindow.manager.repo);
            bot.setUpdateDelegate(UpdateCount);
            bot.setFinishDelegate(UpdateLastDate);
            statusLabel.UseMarkup = true;
            statusLabel.Markup    = "<span foreground=\"red\">Off</span>";
            timeLabel.Text        = bot.checkTime.ToString("yyyy-MM-dd HH:mm");

            startButton.Clicked += Start_Clicked;
            stopButton.Clicked  += Stop_Clicked;
            clearButton.Clicked += Clear_Clicked;
            forceButton.Clicked += Force_Clicked;
            //ShowAll ();
        }
예제 #2
0
파일: Demo.cs 프로젝트: OECBot/OECUpdater
        public async static Task BeginGitHubSession(GitHubClient client)
        {
            try
            {
                s = await Session.CreateOauthSession();

                rm  = new RepositoryManager(s, await s.client.Repository.Get("Gazing", "OECTest"));
                bot = new OECBot(getPlugins(), rm.repo);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.WriteLine(s.ToString());
            Console.WriteLine("GitHub session started...");

            while (1 == 1)
            {
                Console.WriteLine("Type a command!");
                Console.WriteLine(menu);
                Console.WriteLine("Command: ");
                String cmd = Console.ReadLine();
                while (!commands.ContainsKey(cmd))
                {
                    Console.WriteLine("Type a correct command...");
                    Console.WriteLine(menu);
                    Console.WriteLine("Command: ");
                    cmd = Console.ReadLine();
                }
                if (cmd == "8")
                {
                    break;
                }
                await commands[cmd]();
            }
        }