Пример #1
0
        /* Handler for click event on item of tasksView.
         * Shows up dialog if TaskEdit mode is ON.
         */
        async private void tasksView_ItemClick(object sender, ItemClickEventArgs e)
        {
            Kompitu.Data.Model.Task t = (Kompitu.Data.Model.Task)e.ClickedItem;
            TaskDetails.Opacity = 0;

            await showTask(t);

            ShowTask.Begin();
        }
Пример #2
0
        private static async Task ExecuteTasks(FixedThreadPool threadPool, int numberOfTasks)
        {
            Console.WriteLine($"{numberOfTasks} tasks will be executed.");
            var random = new Random();

            for (var i = 0; i < numberOfTasks; i++)
            {
                var priority = (Priority)random.Next((int)Priority.High, (int)Priority.Low + 1);
                var taskDelayInMilliseconds = random.Next(10, 1000);
                var task = new ShowTask(taskDelayInMilliseconds);
                await threadPool.Execute(task, priority);
            }
        }