Exemplo n.º 1
0
        private async Task TriggerAlert(PlaceTypeItem item, bool action)
        {
            Debug.WriteLine($"Triggered Alter for {item.Name}, {action}");
            int id = await LocationDetails.AddHistoryItem(item, action);

            string notifTitle;
            string notifText;

            if (action)
            {
                notifTitle = $"{Constants.actionEnter} {Constants.placeTypeName}: {item.NameReadable}";
                notifText  = $"Reminder to {item.OnEnterReminder}";
            }
            else
            {
                notifTitle = $"{Constants.actionExit} {Constants.placeTypeName}: {item.NameReadable}";
                notifText  = $"Reminder to {item.OnExitReminder}";
            }

            locationDependencyService.UpdateNotification(notifTitle, notifText, id);
        }
Exemplo n.º 2
0
        async void OnAddHistoryButtonClicked(object sender, EventArgs e)
        {
            Button         aButton        = sender as Button;
            CoordinateItem coordinateItem = aButton.BindingContext as CoordinateItem;

            string action;

            if (coordinateItem.OnEnter)
            {
                if (coordinateItem.OnExit)
                {
                    action = await DisplayActionSheet("Adding manual history activity, select the movement type.", "Cancel", null, Constants.actionEnter, Constants.actionExit);
                }
                else
                {
                    action = await DisplayActionSheet("Adding manual history activity, select the movement type.", "Cancel", null, Constants.actionEnter);
                }
            }
            else if (coordinateItem.OnExit)
            {
                action = await DisplayActionSheet("Adding manual history activity, select the movement type.", "Cancel", null, Constants.actionExit);
            }
            else
            {
                throw new System.ArgumentException("All coordinate Items must have an on enter and/or an on exit reminder.", "coordinateItem.OnEnter, coordinateItem.OnExit");
            }

            if (action == null || action.Equals("Cancel"))
            {
                return;
            }

            LocationDetails.AddHistoryItem(coordinateItem, action);

            //await DisplayAlert("History Item added", $"A history item for {coordinateItem.Name} was created.", "OK");
        }