void OnButtonDefault(object sender, EventArgs args) { runResult.Clear(); runResult.AddDefaultItems(); Analytics.TrackEventSetup(Analytics.EVENT_SETUP_DEFAULT); }
void OnButtonSwitchSpeedDistanceTapped(object sender, EventArgs args) { // check if feature is purchased, show app-store if not purchased if (AppStore.Instance.IsAppStoreShown(layout)) { return; } // detach old mode from display listView.ItemsSource = null; // switch to new mode if (mode == ResultMode.Speed) { mode = ResultMode.Distance; CreatePickerDistanceStart(); CreatePickerDistanceEnd(); imgSwitchSpeedDistance.Source = Localization.btn_setup_switch_distance; } else if (mode == ResultMode.Distance) { mode = ResultMode.Speed; CreatePickerSpeedStart(); CreatePickerSpeedEnd(); imgSwitchSpeedDistance.Source = Localization.btn_setup_switch_speed; } else { SetDebugText("invalid mode"); } // hide picker, display buttons instead pickerStart.IsVisible = false; pickerEnd.IsVisible = false; btnPickerStart.IsVisible = true; btnPickerEnd.IsVisible = true; // disable add, remove SetButtonAddActive(false); SetButtonRemoveActive(false); // load new mode from settings CreateRunResult(); // display new mode listView.ItemsSource = runResult.Items; Analytics.TrackEventSetup(Analytics.EVENT_SETUP_SWITCH_SPEED_DISTANCE); }
void OnButtonRemove(object sender, EventArgs args) { // check if feature is purchased, show app-store if not purchased if (AppStore.Instance.IsAppStoreShown(layout)) { return; } if (listView.SelectedItem != null) { runResult.Remove((ResultItem)listView.SelectedItem); } Analytics.TrackEventSetup(Analytics.EVENT_SETUP_REMOVE); }
void OnButtonAdd(object sender, EventArgs args) { // check if feature is purchased, show app-store if not purchased if (AppStore.Instance.IsAppStoreShown(layout)) { return; } if (pickerStart.SelectedIndex == -1) { return; } if (pickerEnd.SelectedIndex == -1) { return; } if (runResult.Count >= ITEM_COUNT_MAX) { return; } string start = pickerStart.Items[pickerStart.SelectedIndex]; string end = pickerEnd.Items[pickerEnd.SelectedIndex]; start = RemoveUnit(start); end = RemoveUnit(end); if (IsItemValid(start, end)) { // replace item if zero-to-zero mode if (mode == ResultMode.ZeroToZero) { runResult.Clear(); } ResultItem item = runResult.Add(start, end); listView.ItemsSource = runResult.Items; listView.ScrollTo(item, ScrollToPosition.MakeVisible, true); } else { SetDebugText("invalid item"); } Analytics.TrackEventSetup(Analytics.EVENT_SETUP_ADD); }