예제 #1
0
        void OnButtonDefault(object sender, EventArgs args)
        {
            runResult.Clear();
            runResult.AddDefaultItems();

            Analytics.TrackEventSetup(Analytics.EVENT_SETUP_DEFAULT);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }