Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskTrackerModel" /> class.
        /// </summary>
        /// <param name="taskTracker">
        /// The underlying Task Tracker.
        /// </param>
        public TaskTrackerModel(ITaskTracker taskTracker)
        {
            this.taskTracker = taskTracker;
            var addInAttribute = (AddInAttribute)taskTracker.GetType().GetCustomAttributes(typeof(AddInAttribute), false).First();

            this.InternalUrn = string.Format("urn:bugview:tasktracker:{0}", addInAttribute.Id);
            this.Id = addInAttribute.Id;
            this.Name = addInAttribute.Name;
            this.PublisherName = addInAttribute.PublisherName;
            this.PublisherWebsite = addInAttribute.PublisherWebsite;
        }
Exemplo n.º 2
0
        public ProjectModel Execute(ProjectCreateModel model, ITaskTracker tracker)
        {
            tracker.SetStatusMessage($"Creating project '{model.Title}'");
            var client = db.Clients.SingleOrDefault(x => x.Id == model.ClientId);

            var np = new Project
            {
                UrlPart  = db.GetUrlPart <Project>(model.Title),
                ClientId = model.ClientId,
                Title    = model.Title
            };

            db.Projects.Add(np);

            db.SaveChanges();

            tracker.SetStatusMessage("Beginning task...");
            tracker.SetProgress(0, 3);
            Thread.Sleep(6000);
            tracker.LogInformation("Beginning thing to do.");
            tracker.SetProgress(1);
            Thread.Sleep(8000);
            tracker.LogWarning("Couldn't do this thing but continuing anyway.");
            tracker.SetProgress(2);
            Thread.Sleep(12000);
            tracker.SetProgress(3);
            Thread.Sleep(5000);
            tracker.Complete(true);

            return(tracker.StoreResult(new ProjectModel
            {
                UrlPart = np.UrlPart,
                Title = np.Title,
                Client = mapper.Map <ClientModel>(client)
            }));
        }
Exemplo n.º 3
0
 public TaskTrackerController(ITaskTracker TaskTracker)
 {
     _TaskTracker = TaskTracker;
 }