コード例 #1
0
        protected override void OnRender(Vector2 size)
        {
            List <ConsoleException> issues = Console.HintModule.Issues;

            if (issues.Count > 0)
            {
                ConsoleException issue   = issues[0];
                bool             handled = false;
                string           text    = string.Empty;

                for (int x = 0; x < m_Handlers.Count; x++)
                {
                    IssueHandler handler = m_Handlers[x];
                    handled = handler(issue, out text);
                    if (handled)
                    {
                        break;
                    }
                }
                if (!handled)
                {
                    text = issue.ToString();
                }
                m_IssueContent.text = text;

                GUI.Label(m_IssueRect, m_IssueContent);
            }
        }
        private ServiceFacade()
        {
            DBHelper dbHelper = new DBHelper("dbHelper");

            this.userHandler     = new UserHandler(dbHelper);
            this.topicHandler    = new TopicHandler(dbHelper);
            this.issueHandler    = new IssueHandler(dbHelper);
            this.solutionHandler = new SolutionHandler(dbHelper);
            this.pictureHandler  = new PictureHandler(dbHelper);
            //this.itemHandler = new ItemHandler(dbHelper);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Quilt4/Quilt4Net
        static void Main(string[] args)
        {
            var console = new ClientConsole();

            //Note: Using the singleton version
            //var configuration = Singleton.Configuration.Instance;
            //var client = Singleton.Quilt4NetClient.Instance;
            //var sessionHandler = Singleton.Session.Instance;
            //var issueHandler = Singleton.Issue.Instance;

            //Note: Using the created instance version
            var configuration = new Configuration();
            var client = new Quilt4NetClient(configuration);
            var sessionHandler = new SessionHandler(client);
            var issueHandler = new IssueHandler(sessionHandler);

            //Note: Config in code
            //configuration.Enabled = true; //Turn the entire quilt4Net feature on or off.
            //configuration.ProjectApiKey = "9XG02ZE0BR1OI75IVX446B59M13RKBR_"; //TODO: Replace with your own ProjectApiKey.
            //configuration.ApplicationName = "MyOverrideApplication"; //Overrides the name of the assembly
            //configuration.ApplicationVersion = "MyOverrideVersion"; //Overrides the version of the assembly
            //configuration.UseBuildTime = false; //If true, separate 'versions' for each build of the assembly will be logged, even though the version number have not changed.
            //configuration.Session.Environment = "Test"; //Use dev, test, production or any other verb you like to filter on.
            //configuration.Target.Location = "http://localhost:29660"; //Address to the target service.
            //configuration.Target.Timeout = new TimeSpan(0, 0, 60);

            console.WriteLine("Connecting to quilt4 server " + configuration.Target.Location, OutputLevel.Information);

            sessionHandler.SessionRegistrationStartedEvent += Session_SessionRegistrationStartedEvent;
            sessionHandler.SessionRegistrationCompletedEvent += SessionSessionRegistrationCompletedEvent;
            sessionHandler.SessionEndStartedEvent += Session_SessionEndStartedEvent;
            sessionHandler.SessionEndCompletedEvent += Session_SessionEndCompletedEvent;
            issueHandler.IssueRegistrationStartedEvent += Issue_IssueRegistrationStartedEvent;
            issueHandler.IssueRegistrationCompletedEvent += Issue_IssueRegistrationCompletedEvent;
            client.WebApiClient.AuthorizationChangedEvent += WebApiClient_AuthorizationChangedEvent;
            client.WebApiClient.WebApiRequestEvent += WebApiClientWebApiRequestEvent;
            client.WebApiClient.WebApiResponseEvent += WebApiClient_WebApiResponseEvent;            

            _rootCommand = new RootCommand(console);
            _rootCommand.RegisterCommand(new UserCommands(client));
            _rootCommand.RegisterCommand(new ProjectCommands(client));
            _rootCommand.RegisterCommand(new InvitationCommands(client));
            _rootCommand.RegisterCommand(new SessionCommands(sessionHandler));
            _rootCommand.RegisterCommand(new IssueCommands(issueHandler));
            _rootCommand.RegisterCommand(new SettingCommands(client));
            _rootCommand.RegisterCommand(new ServiceCommands(client));
            _rootCommand.RegisterCommand(new WebCommands(issueHandler, client.WebApiClient));
            new CommandEngine(_rootCommand).Run(args);

            sessionHandler.Dispose();
        }
コード例 #4
0
 public static IssueHandler CreateHandler <T>(IssueHandler <T> handler) where T : Exception
 {
     return((Exception e, out string text) =>
     {
         T casted = e as T;
         if (casted == null)
         {
             text = null;
             return false;
         }
         else
         {
             handler(casted, out text);
             return true;
         }
     });
 }
コード例 #5
0
        async Task MainAsync()
        {
            Console.WriteLine("Starting...");

            var token = Config.Instance.Discord.ClientToken;
            var bot   = new MyDiscordBot(token);

            bot.AddCommandHandler("ping", new PingHandler());
            bot.AddCommandHandler("doge", new DogPicHandler());
            bot.AddCommandHandler("voice", new VoiceChannelDataHandler(bot.Client));
            bot.AddStateChangeHandler(new VoiceStateChangeHandler(bot.Client));

            var issueHandler = new IssueHandler();

            bot.AddCommandHandler(issueHandler.Prefix, issueHandler);

            Console.WriteLine("Running bot...");

            await bot.Run().ConfigureAwait(false);
        }
コード例 #6
0
 public bool CreateIssue(Classes.Issue issue) => IssueHandler.CreateIssue(connection, issue);
コード例 #7
0
 public ICollection <YouTrackSharp.Issues.Issue> GetIssues(string query) => IssueHandler.GetIssues(connection, query);
コード例 #8
0
 // Issue
 public YouTrackSharp.Issues.Issue GetIssue(string issueId) => IssueHandler.GetIssue(connection, issueId);