Example #1
0
        public async Task <bool> ValidateFormDetailsAndSave()
        {
            if (App.SelectedItem != null &&
                !string.IsNullOrWhiteSpace(App.SelectedItem.Title) &&
                !string.IsNullOrWhiteSpace(App.SelectedItem.Description) &&
                !string.IsNullOrWhiteSpace(App.SelectedItem.ImageUrl))
            {
                // save to database or model
                if (IsProcessBusy)
                {
                    return(false);
                }

                IsProcessBusy = true;

                await AzureDatabase.SaveWalkEntry(App.SelectedItem, isAdding);

                IsProcessBusy = false;
            }
            else
            {
                IsProcessBusy = false;
                return(false);
            }

            IsProcessBusy = false;
            return(true);
        }
Example #2
0
		public LoginPageViewModel (IMyNavigationService navigationService)
		{
			this.navigationService = navigationService;

			LoggedIn = App.LoggedIn;

			GoToSignupPage = new Command (() => {
				this.navigationService.NavigateTo(ViewModelLocator.SignupPageKey);
			});

			Login = new Command ( async () => {
//				var database = new ECOdatabase();
				var database = new AzureDatabase ();

//				database1.GetUsers();

				int rowcount = await database.ValidateUser (Username, Password);
				if (rowcount == 0) {
					App.LoggedIn = false;
				} else {
					App.LoggedIn = true;
					//Navigate to homepage without back key
					this.navigationService.NavigateToModal (ViewModelLocator.HomePageKey);
				}

			});

		}
Example #3
0
        // Checks to see if we have provided a Title and Description
        // Checks to see if we have provided a Title and Description
        public async Task <bool> ValidateFormDetailsAndSave()
        {
            if (App.SelectedItem != null &&
                !string.IsNullOrEmpty(App.SelectedItem.Title) &&
                !string.IsNullOrEmpty(App.SelectedItem.Description) &&
                !string.IsNullOrEmpty(App.SelectedItem.ImageUrl))
            {
                // Check our IsProcessBusy property to see if we are already processing
                if (IsProcessBusy)
                {
                    return(false);
                }

                // If we aren't processing, we need to set our IsProcessBusy property to true
                IsProcessBusy = true;

                // Save our Walk Entry details to our Microsoft Azure Database
                await AzureDatabase.SaveWalkEntryFirebase(App.SelectedItem, isAdding);

                IsProcessBusy = false;
            }
            else
            {
                // Initialise our IsProcessBusy property to false
                IsProcessBusy = false;
                return(false);
            }
            // Initialise our IsProcessBusy property to false
            IsProcessBusy = false;
            return(true);
        }
Example #4
0
        // Instance method to add and retrieve our  Walk Trail items
        public async Task GetWalkTrailItems()
        {
            // Check our IsProcessBusy property to see if we are already processing
            if (IsProcessBusy)
            {
                return;
            }

            // If we aren't processing, we need to set our IsProcessBusy property to true
            IsProcessBusy = true;

            // Populate our WalkListModel List Collection with items from our Microsoft Azure Web Service
            WalksListModel = new ObservableCollection <WalkDataModel>(await AzureDatabase.GetWalkEntries());

            // Set our IsProcessBusy property value back to false when finished
            IsProcessBusy = false;
        }
Example #5
0
        public async Task GetWalkTrailItems()
        {
            if (IsProcessBusy)
            {
                return;
            }

            IsProcessBusy = true;

            /* hard coded data
             * WalksListModel = new ObservableCollection<WalkDataModel>
             * {
             *      new WalkDataModel
             *      {
             *              Id = 1,
             *              Title = "10 Mile Brook Trail, Margaret River",
             *              Description = "The 10 Mile Brook Trail starts in the Rotary Park near old Kate, a preserved steam engine at the northen edge of Margaret River.",
             *              Latitude = -33.9727604,
             *              Longitude = 115.0861599,
             *              Distance = 7.5,
             *              Difficulty = "Medium",
             *              ImageUrl = "http://trailswa.com.au/media/cache/media/images/trails/_mid/FullSizeRender1_600_480_c1.jpg"
             *      },
             *      new WalkDataModel
             *      {
             *              Id = 2,
             *              Title = "Ancient Empire Walk, Valley of the Ancients",
             *              Description = "The Ancient Empire is a 450 metre walk trail that takes you around and through some of the giant tingle trees including the most popular of the gnarled  veterans, known as Grandma Tingle",
             *              Latitude = -34.9749188,
             *              Longitude = 117.3560796,
             *              Distance = 450,
             *              Difficulty = "Hard",
             *              ImageUrl = "http://trailswa.com.au/media/cache/media/images/trails/_mid/Ancient_Empire_534_480_c1.jpg"
             *      }
             * };
             */
            WalksListModel = new ObservableCollection <WalkDataModel>(await AzureDatabase.GetWalkEntries());

            await Task.Delay(3000);             // temp timer for demoing

            IsProcessBusy = false;
        }
Example #6
0
		public SignupPageViewModel (IMyNavigationService navigationService)
		{
			this.navigationService = navigationService;

			CreateAccount = new Command (() => {
				if(SignupValidate()){
					// create account
//					User newUser = new User(Username, Password, Mobile, Email);

//					var database = new ECOdatabase();
//					database.InsertItemToUser(newUser);

					var database = new AzureDatabase();

					database.InsertUser(Username, Password, Mobile, Email);

					this.navigationService.NavigateToModal(ViewModelLocator.HomePageKey);
				}
			});
			Azure.MobileService.GetTable<User> ();
		}
Example #7
0
        // Instance method to add and retrieve our  Walk Trail items
        public async Task GetWalkTrailItems()
        {
            // Check our IsProcessBusy property to see if we are already processing
            if (IsProcessBusy)
            {
                return;
            }

            // If we aren't processing, we need to set our IsProcessBusy property to true
            IsProcessBusy = true;

            // Populate our WalkListModel List Collection with items from our
            // Microsoft Azure Web Service
            WalksListModel = new ObservableCollection <WalkDataModel>(await AzureDatabase.GetWalkEntriesFirebase());
            WalksListModel.Add(new WalkDataModel
            {
                Id          = 1,
                Title       = "10 Mile Brook Trail, Margaret River",
                Description = "The 10 Mile Brook Trail starts in the Rotary Park near Old Kate, a preserved steam engine at the northern edge of Margaret River. ",
                Latitude    = -33.9727604,
                Longitude   = 115.0861599,
                Distance    = 7.5,
                Difficulty  = "Medium",
                ImageUrl    = "http://trailswa.com.au/media/cache/media/images/trails/_mid/FullSizeRender1_600_480_c1.jpg"
            });
            WalksListModel.Add(new WalkDataModel
            {
                Id          = 2,
                Title       = "Ancient Empire Walk, Valley of the Giants",
                Description = "The Ancient Empire is a 450 metre walk trail that takes you around and through some of the giant tingle trees including the most popular of the gnarled veterans, known as Grandma Tingle.",
                Latitude    = -34.9749188,
                Longitude   = 117.3560796,
                Distance    = 450,
                Difficulty  = "Hard",
                ImageUrl    = "http://trailswa.com.au/media/cache/media/images/trails/_mid/Ancient_Empire_534_480_c1.jpg"
            });
            ;
            //// Specify our List Collection to store the items being read
            //WalksListModel = new ObservableCollection<WalkDataModel> {

            //// Populate our collection with some dummy data that will be used to populate our ListView
            //new WalkDataModel
            //{
            //    Id = 1,
            //    Title = "10 Mile Brook Trail, Margaret River",
            //    Description = "The 10 Mile Brook Trail starts in the Rotary Park near Old Kate, a preserved steam engine at the northern edge of Margaret River. ",
            //    Latitude = -33.9727604,
            //    Longitude = 115.0861599,
            //    Distance = 7.5,
            //    Difficulty = "Medium",
            //    ImageUrl = "http://trailswa.com.au/media/cache/media/images/trails/_mid/FullSizeRender1_600_480_c1.jpg"
            //},
            //new WalkDataModel
            //{
            //    Id = 2,
            //    Title = "Ancient Empire Walk, Valley of the Giants",
            //    Description = "The Ancient Empire is a 450 metre walk trail that takes you around and through some of the giant tingle trees including the most popular of the gnarled veterans, known as Grandma Tingle.",
            //    Latitude = -34.9749188,
            //    Longitude = 117.3560796,
            //    Distance = 450,
            //    Difficulty = "Hard",
            //    ImageUrl = "http://trailswa.com.au/media/cache/media/images/trails/_mid/Ancient_Empire_534_480_c1.jpg"
            //}};

            // Add a temporary timer, so that we can see our progress indicator working
            await Task.Delay(3000);

            // Set our IsProcessBusy property value back to false when finished
            IsProcessBusy = false;
        }