public BackgroundUpdater(WatcherView view, WatcherViewModel viewModel, WatcherController controller)
        {
            this.viewModel = viewModel;

            worker = new BackgroundWorker();
            worker.DoWork += worker_DoWork;

            UpdateStarted += view.StartUpdating;
            UpdateCompleted += view.FinishUpdating;
            Update += controller.UpdateBuilds;
        }
Пример #2
0
        public WatcherView(WatcherViewModel viewModel, WatcherController controller)
        {
            this.viewModel = viewModel;
            this.controller = controller;

            InitializeComponent();
            controller.Initialize();
            UpdateBuildGridView();

            projectGridView.DataSource = viewModel.Projects;
            projectGridView.Columns["Builds"].Visible = false;

            UpdateIntervalBox.Text = string.Format("Update Interval: {0}s", viewModel.UpdateInterval / 1000.0);
        }
Пример #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var config = ConfigurationManager.AppSettings;

            var saveRepositroy = new SaveStateRepository(config["SaveFile"]);
            var tcRepository = new TeamCityRepository(config["TeamCityHost"], config["TeamCityUser"], config["TeamCityPassword"]);
            var viewModel = new WatcherViewModel(Convert.ToInt32(config["UpdateInterval"]));
            var controller = new WatcherController(viewModel, tcRepository, saveRepositroy);
            var view = new WatcherView(viewModel, controller);
            var updater = new BackgroundUpdater(view, viewModel, controller);
            updater.Start();

            Application.Run(view);
        }
 public WatcherController(WatcherViewModel vm, TeamCityRepository tcRepo, SaveStateRepository saveRepo)
 {
     viewModel = vm;
     tcRepository = tcRepo;
     saveRepository = saveRepo;
 }