<commit_before>﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using Xamarin.Forms;

namespace JobSearchScorecard
{

	public class StartPage : ContentPage
	{
		private static bool firstTime = true;
		public List<Task> currentTasks;

		Label scoreBox;
		Label scorePeriod;

		public StartPage ()
		{
			Title = "Job Search Scorecard";
			if (firstTime) {
				firstTime = false;
				ActivityTable.BuildActivitiesDictionary ();  // build the table of potential tasks (aka Activity list) 
				//currentTasks = MockUpTasks ();  // if you wish to mock-up some completed tasks
				Debug.WriteLine ("Built Activities Dictionary with : " + Activity.UniqueCode + " unique entries");
			}
			Debug.WriteLine ("Database now has " + App.Database.GetTasks ().Count () + " rows in <Task>");
			Debug.WriteLine ("Database now has " + App.Database.GetPeriods ().Count () + " rows in <Period>");

			scoreBox = new Label () {
				Text = "TheScore",
				FontSize = 60,
				FontAttributes = FontAttributes.Bold,
				HorizontalOptions = LayoutOptions.Center
			};  // Text set in the OnAppearing override in order to grab latest total score

			scorePeriod = new Label () {
				Text = "for Unknown Period",
				FontSize = 30,
			};

			var buttonStyle = new Style (typeof(Button)) {
				Setters = {
					//new Setter { Property = Butto
					new Setter { Property = Button.BackgroundColorProperty, Value = Color.Teal, },
					new Setter { Property = Button.BorderRadiusProperty, Value = 5 },
					new Setter { Property = Button.HeightRequestProperty, Value = 50 }
				}
			};

			var btnShowSteps = new Button {
				Text = "Job Search Steps",
				Style = buttonStyle,
			};
			btnShowSteps.Clicked += async (sender, e) => {
				await this.Navigation.PushAsync(new MainStepsPage());
			};


			// Two buttons: one for starting a new period, the other for wiping-out the database
			var btnNewPeriod = new Button {
				Text = "Start New Period",
				Style = buttonStyle,
				//VerticalOptions = LayoutOptions.CenterAndExpand,
				//HorizontalOptions = LayoutOptions.StartAndExpand,
			};
			btnNewPeriod.Clicked += async(sender, e) => {
				var action = await DisplayActionSheet ("Start a new period?", "No! Cancel", "YES!");
				if (action.StartsWith ("N"))
					return;
				if (App.Database.SavePeriod () != 1) {
					throw new Exception ("Cannot create new Period!");
				}
				this.OnAppearing ();
			};

			var lblResets = new Label () {
				Text = "WARNING: The following button removes all data, all history - the equivalent of a fresh install of the app ",<commit_msg>ButtonStyle color for iOS<commit_after>﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using Xamarin.Forms;

namespace JobSearchScorecard
{

	public class StartPage : ContentPage
	{
		private static bool firstTime = true;
		public List<Task> currentTasks;

		Label scoreBox;
		Label scorePeriod;

		public StartPage ()
		{
			Title = "Job Search Scorecard";
			if (firstTime) {
				firstTime = false;
				ActivityTable.BuildActivitiesDictionary ();  // build the table of potential tasks (aka Activity list) 
				//currentTasks = MockUpTasks ();  // if you wish to mock-up some completed tasks
				Debug.WriteLine ("Built Activities Dictionary with : " + Activity.UniqueCode + " unique entries");
			}
			Debug.WriteLine ("Database now has " + App.Database.GetTasks ().Count () + " rows in <Task>");
			Debug.WriteLine ("Database now has " + App.Database.GetPeriods ().Count () + " rows in <Period>");

			scoreBox = new Label () {
				Text = "TheScore",
				FontSize = 60,
				FontAttributes = FontAttributes.Bold,
				HorizontalOptions = LayoutOptions.Center
			};  // Text set in the OnAppearing override in order to grab latest total score

			scorePeriod = new Label () {
				Text = "for Unknown Period",
				FontSize = 30,
			};

			var buttonStyle = new Style (typeof(Button)) {
				Setters = {
					new Setter { Property = Button.TextColorProperty, Value = Color.White, },
					new Setter { Property = Button.BackgroundColorProperty, Value = Color.Teal, },
					new Setter { Property = Button.BorderRadiusProperty, Value = 5 },
					new Setter { Property = Button.HeightRequestProperty, Value = 50 }
				}
			};

			var btnShowSteps = new Button {
				Text = "Job Search Steps",
				Style = buttonStyle,
			};
			btnShowSteps.Clicked += async (sender, e) => {
				await this.Navigation.PushAsync(new MainStepsPage());
			};


			// Two buttons: one for starting a new period, the other for wiping-out the database
			var btnNewPeriod = new Button {
				Text = "Start New Period",
				Style = buttonStyle,
			};
			btnNewPeriod.Clicked += async(sender, e) => {
				var action = await DisplayActionSheet ("Start a new period?", "No! Cancel", "YES!");
				if (action.StartsWith ("N"))
					return;
				if (App.Database.SavePeriod () != 1) {
					throw new Exception ("Cannot create new Period!");
				}
				this.OnAppearing ();
			};

			var lblResets = new Label () {
				Text = "WARNING: The following button removes all data, all history - the equivalent of a fresh install of the app ",
{'fraction_non_alphanumeric': 0.11188947266005059, 'fraction_numerical': 0.0031134461957579296, 'mean_word_length': 3.240924092409241, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1355856', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1438, 'n_words': 487}