public IActionResult Index() { ApplicationListVM applicationListVM = new ApplicationListVM(); applicationListVM.Applications = _applicationRepo.GetAllApplications; return(View(applicationListVM)); }
public void LoadSettings() { AppEnvironment.LoadSettings(); var appListViewModel = ApplicationListVM.Create(AppEnvironment.Settings.Applications, minimum: 3); AppListControl.DataContext = appListViewModel; BuildLogControl.SetContext(appListViewModel); RunLogControl.SetContext(appListViewModel); }
public void SetContext(ApplicationListVM applicationList) { DataContext = applicationList; if (_dispatcherTimer != null) { _dispatcherTimer.Stop(); } // this is a very inefficient way to poll for changes, we should // bind to the OutputDataReceived directly... _dispatcherTimer = new DispatcherTimer(); _dispatcherTimer.Tick += new EventHandler((s, e) => { var colors = Tuple.Create <Brush, Brush>(Brushes.CornflowerBlue, Brushes.White); if (applicationList.ActiveApplication != null) { var app = applicationList.ActiveApplication; if (ColorDictionary.ContainsKey(app.Status)) { colors = ColorDictionary[app.Status]; } // we should check that the tab we are in is selected... bool isActive; string output = ""; if (Component == "Build") { isActive = app.IsBuilding; if (isActive) { output = app.BuildOutput; } } else if (Component == "Run") { isActive = app.IsRunnning; if (isActive) { output = app.RunOutput; } } else { throw new Exception("No component " + Component); } if (isActive) { MainTextBox.Text = output; } if ((bool)ScrollToEndCheckBox.IsChecked && isActive) { MainTextBox.ScrollToEnd(); } MainTextBox.Background = colors.Item1; MainTextBox.Foreground = colors.Item2; } }); _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); _dispatcherTimer.Start(); //application.SolutionObj.ExecutionCompleted += (s,e) => // Dispatcher.BeginInvoke(new Action(() => // { // MainTextBox.Background = Brushes.Beige; // MainTextBox.Foreground = Brushes.Black; // if(_dispatcherTimer != null) // _dispatcherTimer.Stop(); // _dispatcherTimer = null; // })); }