• This repository has been archived on 23/May/2024
  • Stars
    star
    534
  • Rank 83,095 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

eShop mobile & desktop client built with .NET MAUI

eshop-mobile-client

eshop-mobile-client is a reference .NET MAUI multi-platform client app whose imagined purpose is to serve the mobile workforce of a fictitious company that sells products. The app allows you to manage the catalog, view products, and manage the basket and the orders.

Dependencies

Though eshop-mobile-client mobile app relies on the repo eShopOnContainers for its backend but by default it uses its internal MockServices for all its functionalities. For more details refer to the Setup section.

eShopOnContainers

Architecture

The app architecture consists of two parts:

  1. A .NET MAUI mobile app for iOS, macOS, Android, and Windows.
  2. Several .NET Web API microservices are deployed as Docker containers.

.NET MAUI App

This project exercises the following platforms, frameworks, and features:

  • .NET MAUI
    • XAML
    • Behaviors
    • Bindings
    • Converters
    • Central Styles
    • Animations
    • IoC
    • Messaging Center
    • Custom Controls
    • xUnit Tests
  • Azure Mobile Services
    • C# backend
    • WebAPI
    • Entity Framework
    • Identity Server 4

Backend Services

All the backend services-related code and components are maintained as eShopOnContainers repo.

Supported platforms

The app targets four platforms:

  • iOS
  • macOS
  • Android
  • Universal Windows Platform (UWP)
    • UWP is supported only in Visual Studio for Windows, not Visual Studio for macOS

Requirements

  • Visual Studio 2022 (2022 or higher) to compile C# language features (or Visual Studio MacOS)
    • Visual Studio Community Edition is fully supported!
  • .NET MAUI add-ons for Visual Studio (available via the Visual Studio installer)

Setup

1. Ensure the .NET MAUI platform is installed

You can do that by following the steps mentioned in Installing .NET MAUI

2. Ensure .NET MAUI is updated

Visual Studio will periodically automatically check for updates. You can also manually check for updates using the Update Visual Studio options.

3. Project Setup

Restore NuGet packages for the project.

4. Ensure Android Emulator is installed

You can use any Android emulator although it is highly recommended to use an x86-based version.

Visual Studio Android Emulator

Note: The Visual Studio Android Emulator cannot run well inside a virtual machine or over Remote Desktop or VNC since it relies on virtualization and OpenGL.

To deploy and debug the application on a physical device, refer to the Debug on an Android device article.

5. Ensure Mac connection

To set up the Mac host, you must enable communication between the Xamarin extension for Visual Studio and your Mac.

Connect with a Mac

6. Use Actual Microservices

By default eshop multiplatform client uses the internal mock services to let the user explore different sets of features in the app.

But if you want to test out the app using real services, you can do that too.

For that you'll need to do the following:

  1. Deploy the backend services of eShop applications from the eShopOnContainers repo. You can deploy the application to either Local Kubernetes or AKS environments.

  2. Enable microservices endpoint in the Settings section.

Microservices Endpoint Enable

Microservices Endpoint Configure

Identity Url : http://<YOUR_IP_OR_DNS_NAME>/identity Mobile Gateway Shopping Url: http://<YOUR_IP_OR_DNS_NAME>/mobileshoppingapi

  1. Enable HTTP traffic.

Android App

You'll also need to include the <YOUR_IP_OR_DNS_NAME> in the section <domain includeSubdomains="true"><YOUR_IP_OR_DNS_NAME></domain> of the network_security_config.xml file to use HTTP traffic.

For more details refer to Managing HTTP & Cleartext Traffic on Android with Network Security Configuration

IOS App

You'll need to make sure your info.plist file contains the following configuration.

  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
  </dict>

For more details refer to Opting-Out of ATS

NOTE: Please note, in production scenario you'll the services which uses HTTPS endpoint.

7. Setup Google Maps for Android

In the eShopOnContainers\Platforms\Android\AndroidManifest.xml you must replace the value of the com.google.android.geo.API_KEY with a valid Google Maps API key.

<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_KEY_GOES_HERE" />

For more details refer to .NET MAUI Map - Get a Google Maps API key.

Screenshots

Login

Login

Catalog

Profile

Order details

Clean and Rebuild

If you see build issues when pulling updates from the repo, try cleaning and rebuilding the solution.

Troubleshooting

Licenses

This project uses some third-party assets with a license that requires attribution:

Copyright and license

  • Code and documentation copyright 2023 Microsoft Corp. Code released under the MIT license.

More Repositories

1

eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
C#
24,535
star
2

eShopOnWeb

Sample ASP.NET Core 8.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
C#
10,161
star
3

eShopOnDapr

A sample .NET distributed application based on eShopOnContainers, powered by Dapr.
C#
1,530
star
4

News

News on .NET Architecture Guidance, eShopOnContainers and all the reference apps in dotnet-architecture
1,104
star
5

eBooks

.NET Architecture e-Books
1,102
star
6

eShopModernizing

Modernizing existing .NET Framework, hypothetically legacy backoffice eShop web apps (traditional ASP.NET WebForms and MVC) with Windows Containers and Azure Cloud
JavaScript
920
star
7

eShopOnBlazor

Migration of a traditional ASP.NET Web Forms app to Blazor
JavaScript
503
star
8

HealthChecks

Experimental Health Checks for building services, such as with ASP.NET Core
C#
454
star
9

eShopOnContainersAI

eShopOnContainers with AI, ML and Bots features
JavaScript
407
star
10

PerformanceMonitor

.NET Core Application Performance Monitor
C#
236
star
11

eShopOnAzure

Azure version of the eShopOnContainers, with implementations based on Azure services.
C#
223
star
12

eShopOnUWP

Universal Windows Platform line of business application showcasing the latest Windows 10 capabilities such as Fluent Design System, Ink and Windows Hello.
C#
162
star
13

Messaging

.NET Core Application blocks for message-based communication
158
star
14

grpc-for-wcf-developers

gRPC for WCF Developers guidance samples
C#
135
star
15

MNISTTensorCNTK

C#
118
star
16

RecommendationEngine

Recommendation Engine using Azure ML Studio to recommend related movies.
C#
101
star
17

explore-docker

C#
8
star
18

.github

3
star