Giter Site home page Giter Site logo

csuffyy / windows-appsample-customers-orders-database Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/windows-appsample-customers-orders-database

0.0 0.0 0.0 2.01 MB

This code demonstrates a working customer order database hosted on Azure, implemented in C# and XAML, and ready to form the basis of your Windows Store enterprise app.

License: MIT License

C# 100.00%

windows-appsample-customers-orders-database's Introduction

Customers Orders Database sample

A UWP (Universal Windows Platform) sample app showcasing features useful to enterprise developers, like Azure Active Directory (AAD) authentication, UI controls (including a data grid), Sqlite and SQL Azure database integration, Entity Framework, and cloud API services. The sample is based around creating and managing customer accounts, orders, and products for the fictitious company Contoso.

Download and try it now from the Microsoft Store. Visual Studio not required.

ContosoApp screenshot 1

What's new

  • Local database connection using Sqlite.
  • Use of the repository pattern for easier testing and swapping between data sources with minimal code changes.
  • Splash screen and logo branding.
  • Diagnostic and feedback data collection control.
  • Code quality improvements.

Features

This sample highlights:

  • The master/details UI pattern
  • An editable DataGrid with input validation
  • Form layouts
  • Authenticating and obtaining user info using Azure Active Directory (AAD)
  • Using the repository pattern to connect to Sqlite or SQL Azure databases
  • Connecting to an external web API built with ASP.NET Core 2.0

Run the sample

This sample is designed to connect to an instance of Azure Active Directory for authentication and an external service for data. To get you started right away, we've provided some demo data and a test service you can connect to. However, in order to debug and explore the full functionality of the app, you'll need to deploy your own instance to Azure.

Note: This sample collects diagnostic data, like what pages you visit in the app and how long you spend looking at them. We use this information to make our code samples better. No information is stored that can personally identify you. To opt out, use the settings page in the app or comment out the source code. You can also review Microsoft's privacy policy.

Quick start

Prepare your environment

This sample requires Visual Studio 2017, the Windows 10 Software Development Kit (SDK), and the .NET Core 2.0 SDK.

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

Note If you are using Visual Studio 2015, a previous version of this sample which doesn't require Visual Studio 2017 is available in the git commit history for this repo.

Run

Set your startup project as Contoso.App, the architecture to x86, and press F5 to run.

Complete setup

To fully explore the sample, you'll need to connect to your own Azure Active Directory and data source. Values you need to fill are in Constants.cs.

  • Client Id: Set the AccountClientId field to your Azure account client Id.
  • API endpoint: Set the value of the BaseUrl constant to match the url the backing service is running on.
  • Set a database connection string: Set the connection string to one of your own local or remote databases.
  • Associate this sample with the Store: Authentication requires 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.

You can then either start the service running locally, or deploy it to Azure.

  • To run locally, right-click the solution, choose Properties, and choose to start both Contoso.App and Contoso.Service at the same time.
  • To deploy to Azure, right-click Contoso.Service, choose Publish, and then follow the steps in the wizard.

Code at a glance

If you're only interested in specific tasks and don't want to browse or run the entire sample, check out some of these files:

Design patterns

Master/details

This sample demonstrates several flavors of the master/details pattern (side-by-side and stacked). The Customers list screen displays a customer list and a details overlay that lets the user view and edit a subset of customer data. The user can double-click to go to the full customer details screen, which shows additional data (such as the list of invoices associated with selected customer).

The Orders list screen displays a list of orders. It uses visual state triggers to selectively display an additional details panel when the screen is large enough. To see the full details of an order or to edit it, the user double-clicks or selects "Edit" to go to the Order details screen. The Order details screen shows all the info for the order and enables editing. The user can search for additional products to add to the invoice.

Form layouts

The two details screens show how to use headings, labels, and whitespace to organize controls into a form layout. Some controls used include:

Telerik RadDataGrid with data validation

This sample includes a Data Grid from Telerik's newly open-sourced UI for UWP controls library. You can find the source for these controls on GitHub, as well as a package on NuGet. For help getting started, consult the Telerik documentation.

Adaptive layouts

This sample demonstrates how to use visual states to adapt the UI for screen sizes varying from a 5 inch phone to a large desktop display. It also supports Continuum for Phones, so you can use the app running on your Windows 10 phone on your Windows 10 PC. The app supports all versions of Windows 10, but new features are available on the latest versions. For example, the labels on command bar buttons are shown to the right of the icon on Windows 10, version 1607, but they are below the icon on previous versions of Windows 10.

Known issues

  • Data validation for non-US international phone numbers is not working correctly; the numbers will always show as invalid. This issue will be fixed in a future release.

See also

windows-appsample-customers-orders-database's People

Contributors

awkoren avatar jwmsft avatar karlerickson avatar cabauman avatar laurenhughes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.