Skip to content

voltproject/Windows-appsample-lunch-scheduler

 
 

Repository files navigation

Lunch Scheduler app sample

A mini-app that simplifies organizing lunch with friends or co-workers. You choose a time and location, invite friends, and the app takes care of sending out notifications and collecting responses. This sample runs on the Universal Windows Platform (UWP).

The app demonstrates features you may find useful for your own projects, like push notifications, user authentication, UI controls, and Azure integration.

Lunch Scheduler home menu

Features

Lunch Scheduler highlights features like:

  • Out Of Box Experience (OOBE)
  • Authentication using a Microsoft or Facebook account
  • Basic app UI and navigation, including a navigation pane and settings page
  • Integration with third party services such as Yelp and Twilio

Lunch Scheduler is designed to run well on both Windows PC and Windows Phone.

Run the sample

Because Lunch Scheduler relies on some authentication APIs and third party services, it requires a bit of setup before you can run it.

Prepare your environment

This sample requires Visual Studio 2015, the Windows 10 SDK (build 14393 or above), and the Azure SDK.

Additionally, to receive the latest updates to Windows and the development tools, and to help shape their development, join the Windows Insider Program.

Associate Lunch Scheduler with the Store

Lunch Scheduler uses APIs that require store association. To associate the app with the Store, right click the project in Visual Studio and select Store -> Associate App with the Store. Then follow the instructions in the wizard.

Note that you don't actually need to submit the app to the Store, just associate it.

Configure 3rd party services

Lunch Scheduler integrates a number of 3rd party services that require some additional setup to function correctly.

You don't necessarily need to configure these before running the app. However, if you try and use one and it's not configured, the app might throw an exception.

Yelp

Lunch Scheduler uses Yelp to suggest tasty lunch spots near your current location.

To use Yelp:

  1. Create a free Yelp account and log in.
  2. Obtain API keys from the developer portal.
  3. Swap the Consumer Key, Consumer Secret, Token, and Token Secret into the constants in the site/controllers/LocationsController.cs file.

For more information on using the Yelp API, see the Yelp documentation.

Facebook

Using a Microsoft Account (MSA) is the easiest way users can authenticate with Lunch Scheduler. However, the app also offers the option to log in with Facebook.

To turn on Facebook authentication:

  1. Navigate to the Facebook developer panel.
  2. Select Add a New App and choose the Website template.
  3. Complete the form. Specifically, make sure to fill in the Windows Store SID field. You can obtain your SID from the Windows Developer Dashboard.
  4. Insert your App ID and App Secret into the constants in the AuthenticationHelper.cs and IdpHelper.cs files.

For more information, see the Facebook documentation.

Twilio

Twilio is a service that enables sending and receiving text messages via an API. Lunch Scheduler can optionally use Twilio to send a text notification to users when they are invited to lunch.

To enable Twilio:

  1. Create a free Twilio account and log in.
  2. Create a new trial phone number from the Phone Numbers Dashboard.
  3. Change the URL endpoint for the "message comes in" field on the numbers dashboard to the URL of your LunchScheduler service's device endpoint. For example: https://<your_url_here>.azurewebsites.net/api/device?ZUMO-API-VERSION=2.0.0.
  4. Add your Twilio phone number, SID, and key to the constants in the site/helpers/NotificationHelper.cs file.

For a more complete tutorial on getting started with Twilio using C#/.NET, check out the Twilio documentation.

Set the API endpoint

In ApiHelper.cs, set the value of the BaseUrl constant to match the url the backing service is running on. See the next step for how to run the service.

Start the service

Lunch Scheduler relies on a backing Azure App Service to handle authentication, send and receive data, communicate with REST services, and send push notifications. This sample includes code for the service written in C#/ASP.NET.

The service works best when it's running in the cloud. However, you can deploy a local copy using the Azure SDK and Debugger to try out Lunch Scheduler without deploying anything to Azure. You won't get the app's full functionality, but you can explore and check out some of the basic features.

Run locally

Here's how to run the service locally alongside the app:

  1. Right click your solution and select Properties.
  2. Select the Startup Project tab.
  3. Check the Multiple startup projects radio button.
  4. Enable both LunchScheduler.App and LunchScheduler.Site to start.

The next time you run the sample, both the Azure service and the app will launch (with debugging enabled) simultaneously.

Deploy to Azure

To fully explore Lunch Scheduler, you'll want to deploy the backing App Service to Azure.

If you don't already have an Azure account, you can get a free one-month trial. Or, if you have an MSDN subscription, an Azure subscription with free monthly Azure credits is included.

WARNING The following steps may incur a charge to your Azure subscription, depending on the deployment tiers you select. We reccomend choosing "Free" tier to minimize your development and testing costs. See the Azure pricing documentation for more information.

To deploy the Lunch Scheduler service to Azure:

  1. Right-click the LunchScheduler.Site project and select Publish.
  2. Select Microsoft Azure App Service as a publish target.
  3. In the top-right corner, either select or log in with your Azure account.
  4. Click New on the right.
  5. Fill out the Hosting form field. Don't click Create just yet.
  6. Select the Services tab on the left.
  7. Deploy the (suggested) SQL Database by selecting the green plus arrow.
  8. Fill in the SQL Database form and click OK.
  9. Click Create.

Azure will automatically create and configure your App Service and SQL Database, and deploy the service to it.

Code at a glance

Lunch Scheduler was designed with modularity in mind. If there's a specific part of the app that's interesting, you can grab that component and drop it in to your own app.

Controls

  • AddFriendDialog: Dialog that allows the user to enter the name of a person in their contacts to add as a friend.
  • PhoneSignUpDialog: Dialog that allows the user to enter their phone number to receive text notifications.
  • UserIconControl: Circular icon for displaying a user name and photo.
  • WaitDialog: Dialog that blocks the UI with a "loading" control until a long-running operation finishes.

Helpers and utilities

Views and ViewModels

See also

About

Sample app demonstrating a multi-user lunch scheduling scenario for the Universal Windows Platform.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%