Ejemplo n.º 1
0
        public MainView(IThemeProvider themeProvider)
        {
            InitializeComponent();

            var messenger = new Messenger(this);

            this.viewModel = new MainViewModel(messenger);

            var scheduler = new AsyncJobScheduler(this, this.viewModel);

            this.outputView = new OutputView(themeProvider, messenger);
            this.outputView.Show(this.dockPanel, DockState.DockBottom);

            this.environmentListView = new EnvironmentListView(themeProvider, messenger);
            this.environmentListView.Show(this.dockPanel, DockState.DockLeft);

            this.solutionsView = new SolutionsView(this.outputView, themeProvider, messenger, scheduler);
            this.solutionsView.Show(this.dockPanel, DockState.Document);

            this.solutionComponentsView = new SolutionComponentsView(this.outputView, themeProvider, messenger, scheduler);
            this.solutionComponentsView.Show(this.dockPanel, DockState.Document);

            this.solutionsView.Show();


            messenger.Register <AddNewConnectionMessage>(m => this.AddAdditionalOrganization());
            messenger.Register <RemoveConnectionMessage>(m => this.RemoveAdditionalOrganization(m.Detail));
        }
        public static SolutionFormatted[] TopSolutions(this CognizantChallangeContext context, int limit = 0)
        {
            var groupedSolutions = context.Solutions.GroupBy(s => s.Author)
                                   .Select(s => new
            {
                Author = s.Key,
                Total  = s.Count()
            }).ToList();

            List <SolutionFormatted> solutionsFormatted = new();

            for (int i = 0; i < groupedSolutions.Count; i++)
            {
                SolutionsView solution = context.SolutionsViews.Where(s => s.Author == groupedSolutions[i].Author).First();
                solutionsFormatted.Add(new SolutionFormatted()
                {
                    Author   = groupedSolutions[i].Author,
                    Language = solution.Language,
                    Task     = solution.Task,
                    Solution = solution.Solution,
                    Total    = groupedSolutions[i].Total
                });
            }
            return(solutionsFormatted.OrderByDescending(s => s.Author).Take(limit > 0 && limit <= groupedSolutions.Count ? limit : groupedSolutions.Count).ToArray());
        }
Ejemplo n.º 3
0
        private void OnShowClicked(object sender, EventArgs e)
        {
            var solutionItems = View.SelectedItems;

            if (solutionItems.All(s => s.IsTimeDependent))
            {
                var view = new TimeDependentSolutionsView(View.SelectedItems);
                view.ShowDialog();
            }
            else if (!solutionItems.All(s => s.IsTimeDependent))
            {
                var view = new SolutionsView(View.SelectedItems);
                view.ShowDialog();
            }
        }
Ejemplo n.º 4
0
        private void OnCompareClicked(object sender, EventArgs e)
        {
            var view = new SolutionsView(View.SelectedItems, true);

            view.ShowDialog();
        }