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 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.
Because Lunch Scheduler relies on some authentication APIs and third party services, it requires a bit of setup before you can run it.
This sample requires Visual Studio 2015, the Windows 10 SDK (build 14393 or above), and the Azure SDK.
- Get a free copy of Visual Studio 2015 Community Edition with support for building Universal Windows apps
- Get 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.
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.
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.
Lunch Scheduler uses Yelp to suggest tasty lunch spots near your current location.
To use Yelp:
- Create a free Yelp account and log in.
- Obtain API keys from the developer portal.
- 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.
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:
- Navigate to the Facebook developer panel.
- Select Add a New App and choose the Website template.
- Complete the form. Specifically, make sure to fill in the Windows Store SID field. You can obtain your SID from the Windows Developer Dashboard.
- 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 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:
- Create a free Twilio account and log in.
- Create a new trial phone number from the Phone Numbers Dashboard.
- 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.
- 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.
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.
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.
Here's how to run the service locally alongside the app:
- Right click your solution and select Properties.
- Select the Startup Project tab.
- Check the Multiple startup projects radio button.
- 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.
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:
- Right-click the LunchScheduler.Site project and select Publish.
- Select Microsoft Azure App Service as a publish target.
- In the top-right corner, either select or log in with your Azure account.
- Click New on the right.
- Fill out the Hosting form field. Don't click Create just yet.
- Select the Services tab on the left.
- Deploy the (suggested) SQL Database by selecting the green plus arrow.
- Fill in the SQL Database form and click OK.
- Click Create.
Azure will automatically create and configure your App Service and SQL Database, and deploy the service to it.
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.
- 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.
- ApiHelper.cs: Simplifies strongly-typed HTTP calls to RESTful services.
- AsyncErrorHandler.cs: Third-party NuGet package which automatically catches errors in async methods for easier debugging.
- AuthenticationHelper.cs: Handles authentication for different services, such as Facebook.
- DispatchHelper.cs: Runs a call on the UI thread with normal priority.
- SynchronizationHelper.cs: Handles sending updates to the database.
- IdpHelper.cs: Wrapper for authentication calls to identity providers (IDPs).
- NotificationHelper.cs: Wrapper for sending and receiving notifications using Azure notification hubs and Twilio.
- Friends.xaml & FriendsViewModel.cs: Lets the user add and manage their friends.
- Lunches.xaml & LunchesViewModel.cs: Lets the user view and respond to lunch invitations.
- NewLunch.xaml & NewLunchViewModel.cs: Lets the user send a new lunch invitation to their friends for a certain time and place.
- Settings.xaml & SettingsViewModel.cs: Lets the user configure their settings, including registering their phone and turning push notifications on or off.
- Shell.xaml & ShellViewModel.cs: Navigation pane (also known as hamburger menu). Commonly used app building block that allows the user to quickly navigate to different pages by selecting the different buttons in the pane.
- Welcome.xaml & WelcomeViewModel.cs: OOBE (Out Of Box Experience). Displays when the user first runs the app.