예제 #1
0
 public static void GenerateMainStatisticsPage(this MainStatistics stats, string fullPath)
 {
     try
     {
         var reportMenuTitle   = new SectionName("Main statistics");
         var statisticsSection = new StatisticsSection(stats);
         var page = new HtmlPage("Main statistics page")
         {
             PageStylePaths = new List <string>
             {
                 Output.Files.ReportStyleFile,
                 Output.Files.PrimerStyleFile
             },
             PageBodyCode = reportMenuTitle.HtmlCode + statisticsSection.HtmlCode
         };
         page.SavePage(fullPath);
     }
     catch (Exception ex)
     {
         Log.Exception(ex, "Exception while generating main statistics page");
     }
 }
예제 #2
0
        private TabControl ConstructMainTabControl()
        {
            // Main log list
            var logList = new LogList(LogCache, ApiData, LogDataProcessor, UploadProcessor, ImageProvider, LogNameProvider);

            LogCollectionsInitialized += (sender, args) => logList.DataStore = logsFiltered;

            LogDataProcessor.Processed += (sender, args) =>
            {
                bool last = args.CurrentScheduledItems == 0;

                if (last || gridRefreshCooldown.TryUse(DateTime.Now))
                {
                    Application.Instance.AsyncInvoke(() => { logList.ReloadData(); });
                }
            };
            // Player list
            var playerList = new PlayerList(LogCache, ApiData, LogDataProcessor, UploadProcessor, ImageProvider, LogNameProvider);

            FilteredLogsUpdated += (sender, args) => playerList.UpdateDataFromLogs(logsFiltered);

            // Guild list
            var guildList = new GuildList(LogCache, ApiData, LogDataProcessor, UploadProcessor, ImageProvider, LogNameProvider);

            FilteredLogsUpdated += (sender, args) => guildList.UpdateDataFromLogs(logsFiltered);

            // Statistics
            var statistics = new StatisticsSection(ImageProvider, LogNameProvider);

            FilteredLogsUpdated += (sender, args) => statistics.UpdateDataFromLogs(logsFiltered.ToList());

            // Game data collecting
            var gameDataCollecting = new GameDataCollecting(logList, LogCache, ApiData, LogDataProcessor, UploadProcessor, ImageProvider, LogNameProvider);
            var gameDataPage       = new TabPage
            {
                Text = "Game data", Content = gameDataCollecting, Visible = Settings.ShowDebugData
            };

            Settings.ShowDebugDataChanged += (sender, args) => gameDataPage.Visible = Settings.ShowDebugData;

            // Service status
            var serviceStatus = new DynamicLayout {
                Spacing = new Size(10, 10), Padding = new Padding(5)
            };

            serviceStatus.BeginHorizontal();
            {
                serviceStatus.Add(new GroupBox
                {
                    Text    = "Uploads",
                    Content = new BackgroundProcessorDetail {
                        BackgroundProcessor = UploadProcessor
                    }
                }, xscale: true);
                serviceStatus.Add(new GroupBox
                {
                    Text    = "Guild Wars 2 API",
                    Content = new BackgroundProcessorDetail {
                        BackgroundProcessor = ApiProcessor
                    }
                }, xscale: true);
                serviceStatus.Add(new GroupBox
                {
                    Text    = "Log parsing",
                    Content = new BackgroundProcessorDetail {
                        BackgroundProcessor = LogDataProcessor
                    }
                }, xscale: true);
            }
            serviceStatus.AddRow(null);
            var servicePage = new TabPage
            {
                Text = "Services", Content = serviceStatus, Visible = Settings.ShowDebugData
            };

            Settings.ShowDebugDataChanged += (sender, args) => servicePage.Visible = Settings.ShowDebugData;

            var tabs = new TabControl();

            tabs.Pages.Add(new TabPage {
                Text = "Logs", Content = logList
            });
            tabs.Pages.Add(new TabPage {
                Text = "Players", Content = playerList
            });
            tabs.Pages.Add(new TabPage {
                Text = "Guilds", Content = guildList
            });
            tabs.Pages.Add(new TabPage {
                Text = "Statistics", Content = statistics
            });
            tabs.Pages.Add(gameDataPage);
            tabs.Pages.Add(servicePage);

            // This is needed to avoid a Gtk platform issue where the tab is changed to the last one.
            Shown += (sender, args) => tabs.SelectedIndex = 1;

            return(tabs);
        }