void SuperbarPresenterOnStatusChange(ServerModel model)
        {
            if (model.Percent > -1)
            {
                StartBuildTimer();
            }
            else
            {
                SetPercentage(-1);
            }

            if (!firstPoll) return;

            foreach (var job in model.Jobs)
            {
                jumpList.UserTasks.Add(new JumpListLink
                                           {
                                               Title = job.Name,
                                               Path = job.Url.ToString()
                                           });
            }

            jumpList.RefreshTaskbarList();

            firstPoll = false;
        }
        /// <summary>
        /// Lists the jobs on the Hudson server.
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            if (string.IsNullOrEmpty(JobName))
            {
                var model = new ServerModel();

                model.Update(HudsonServer);

                return View(model);
            }

            return Monitor(JobName);
        }
        /// <summary>
        /// Binds the specified build.
        /// </summary>
        /// <param name="model">The model.</param>
        public void Bind(ServerModel model)
        {           
            Jobs.ItemsSource = model.Jobs;

            Jobs.Items.Refresh();
        }
 public void SetUp()
 {
     model = new ServerModel();
 }
        /// <summary>
        /// Trays the presenter on status change.
        /// </summary>
        /// <param name="model">The model.</param>
        void TrayPresenterOnStatusChange(ServerModel model)
        {
            notifyIcon.Icon = new IconFinder().Find(model.BuildStatus);
            notifyIcon.Text = model.Title;

            if (firstUpdate)
            {
                firstUpdate = false;

                InitializeNotificationIcon(model.Jobs);

                return;
            }

            switch (model.BuildStatus)
            {
                case BuildStatus.Building:
                    notifyIcon.ShowBalloonTip(2000, model.Title, model.Text, ToolTipIcon.Info);
                    break;

                case BuildStatus.Failed:
                    notifyIcon.ShowBalloonTip(2000, model.Title, model.Text, ToolTipIcon.Error);
                    break;

                case BuildStatus.Passed:
                    notifyIcon.ShowBalloonTip(2000, model.Title, model.Text, ToolTipIcon.Info);
                    break;

                default:
                    break;
            }

            
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BasePresenter"/> class.
        /// </summary>
        protected BasePresenter()
        {
            timer = new Timer { Interval = 1000 };
            timer.Elapsed += Elapsed;

            Model = new ServerModel();

            // Load poll every x seconds setting
            MaximumPoll = Settings.Default.MaximumPoll;

            // Poll straight away
            CurrentPoll = MaximumPoll;

            timer.Start();
        }