async Task ExecuteSaveCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var newItem = new TripLogEntry
                {
                    Title     = Title,
                    Latitude  = Latitude,
                    Longitude = Longitude,
                    Date      = Date,
                    Rating    = Rating,
                    Notes     = Notes
                };

                await _tripLogService.AddEntryAsync(newItem);

                await NavService.GoBack();
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task executeSaveCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            var newItem = new TripLogEntry
            {
                Title     = this.Title,
                Latitude  = this.Latitude,
                Longitude = this.Longitude,
                Date      = this.Date,
                Rating    = this.Rating,
                Notes     = this.Notes
            };

            try
            {
                await _tripLogService.AddEntryAsync(newItem);

                await NavService.GoBack();
            }
            finally {
                IsBusy = false;
            }
        }
Beispiel #3
0
        async Task ExecuteSaveCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var newItem = new PlugEVMeEntry
                {
                    Title     = Title,
                    Latitude  = Latitude,
                    Longitude = Longitude,
                    Date      = Date,
                    Rating    = Rating,
                    Notes     = Notes
                };

                await Task.Delay(3000);

                await NavService.GoBack();
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #4
0
        async Task ExecuteDeleteCommand(bool answer)
        {
            if (answer)
            {
                if (IsBusy)
                {
                    return;
                }

                IsBusy = true;
                try
                {
                    await _cateringService.RemoveEntryAsync(Entry);

                    await NavService.GoBack();

                    await NavService.ClearBackStack();
                }

                finally
                {
                    IsBusy = false;
                }
            }
        }
Beispiel #5
0
        async Task ExecuteSaveCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var newItem = new TripLogEntry
                {
                    Title     = Title,
                    Latitude  = Latitude,
                    Longitude = Longitude,
                    Date      = Date,
                    Rating    = Rating,
                    Notes     = Notes
                };

                // TODO: Persist Entry in a later chapter.

                // TODO: Remove this in Chapter 6
                await Task.Delay(3000);

                await NavService.GoBack();
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #6
0
        private async Task Save()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                /**/
                var newItem = new TripLogEntry
                {
                    Title     = Title,
                    Latitude  = Latitude,
                    Longitude = Longitude,
                    Date      = Date,
                    Rating    = Rating,
                    Notes     = Notes
                };

                // TODO: Persist entry

                await Task.Delay(3000);

                await NavService.GoBack();
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #7
0
        async Task ExecuteSaveCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var newItem = new TripLogEntry
                {
                    Title     = Title,
                    Latitude  = Latitude,
                    Longitude = Longitude,
                    Date      = Date,
                    Rating    = Rating,
                    Notes     = Notes
                };

                //Azure Data Access: Add new entry to Azure database
                await _tripLogDataService.AddEntryAsync(newItem);

                //Navigation Service : Go back to the main page
                await NavService.GoBack();
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task executeSaveCommand()
        {
            var newItem = new TripLogEntry
            {
                Title     = this.Title,
                Latitute  = this.Latitude,
                Longitude = this.Longitute,
                Date      = this.Date,
                Rating    = this.Rating,
                Notes     = this.Notes
            };
            //TODO: Implement logic to persist newItem

            await NavService.GoBack();
        }
Beispiel #9
0
        async Task ExecuteSaveCommand()
        {
            var newItem = new TripLogEntry
            {
                Title     = Title,
                Latitude  = Latitude,
                Longitude = Longitude,
                Date      = Date,
                Rating    = Rating,
                Notes     = Notes
            };

            // TODO: Persist Entry in a later chapter.
            await NavService.GoBack();
        }
Beispiel #10
0
        private async Task ExecuteSaveCommand()
        {
            var newEntry = new TripLogEntry
            {
                _id       = 0,
                Title     = EntryTitle,
                Latitude  = EntryLatitude,
                Longitude = EntryLongitude,
                Date      = EntryDate,
                Rating    = EntryRating,
                Notes     = EntryNotes
            };

            DataService.Instance.SaveItem(newEntry);
            await NavService.GoBack();
        }
Beispiel #11
0
        /// <summary>
        /// Saves the new asset or updates the old one.
        /// </summary>
        /// <returns></returns>
        protected override async Task OnSubmit()
        {
            //Creates a new Dto with the new data.
            var asset = new AssetDto
            {
                AssetName                = AssetName.Value,
                Broken                   = IsBroken,
                PurchaseDate             = PurchaseDate.Value,
                CountryOfDepartment      = CountryOfDepartment.Value,
                Department               = Department.Value,
                EmailAddressOfDepartment = EmailAddressOfDepartment.Value,
                Id = assetId
            };

            try
            {
                //Send the request to save/update the asset.
                AssetDto result;
                if (IsEditing)
                {
                    result = await Http.UpdateItemAsync("asset", asset);
                }
                else
                {
                    result = await Http.AddItemAsync("asset", asset);
                }

                //Navigates back if result was successful
                if (result != null)
                {
                    await NavService.GoBack();
                }
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Deletes an asset and navigates back to the Assets Page
        /// </summary>
        /// <returns></returns>
        async Task DeleteAsset()
        {
            if (!IsEditing)
            {
                return;
            }

            try
            {
                if (await Dialog.ShowConfirmationAsync(Resources.Remove, Resources.RemoveAssetMessage))
                {
                    var result = await Http.DeleteItemAsync <AssetDto>("asset", assetId.ToString());

                    if (result != null)
                    {
                        await NavService.GoBack();
                    }
                }
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
        }