.NET MAUI provides 4 techniques for local storage options for storing data in locally on a device, depending on the nature, structure, and size of the data. The most used following 4 ways to store the local data on mobile devices.
Preferences
Local File Storage
Local Database
Secure Storage.
In this article, will share about the .Net MAUI Preference storage technique. Preferences is stores data in key-value pairs and can be easily managed via the Preferences class from Microsoft.Maui.Storage namespace and if you do Uninstall the app will also remove all local preferences, but if you are close and open the application still local preference can able to retrieve the old data.
The Preferences class stores preferences in the native local storage, more specifically
For Android, in the SharedPreferences.
For iOS, in the NSUserDefaults.
For UWP, in the ApplicationDataContainer.
On each platform, preferences are key/value pairs. The value can be of one of the primitive .NET types. Before understanding how preferences work, it is important to list the methods exposed by the Preferences class
Create a new MAUI Application
You can open visual studio 2022 from your Windows or Mac machine. You must follow the below 3 steps to create a new MAUI application
Step 1: Select Create a new project
Step 2: Search the MAUI project template or choose Project Type > MAUI from the drop-down.
Step 3: Provide the configuration Details as a project name, Location, and Solutions name.
Save Preferences
Save/ Set Preference will store simple value, preference having different key and value, preference key always string type, the value of preference must be one of the following types
Boolean
Double
Int32
Single
Int64
String
DateTime
Preferences are set by calling the Preferences. Set method, providing the key and value
Preferences.Set(“KEY”,” Value”).
Get/ Default Preferences
In this example already saved the two-preference value, in the below statement will the get the value from existing preference or if preference value is not there automatic or return the default value.
The following code confirmed already saved preference key is available or not
Clear Preferences
Clear and remove will use for dropping the preference key and value, suppose if you are doing any log out or switching to a different user this will help to clear all the preference key and value.
Preferences.Clear();
Suppose if you want to remove a particular key preference in the mobile, you can use remove preference as like below
Preferences.Remove(“Name”);
Summary
The Preferences class is intended to store small pieces of information represented by primitive .NET types. If you need to locally save and retrieve more complex and structured data, a good option is to use a local database like SQL lite and you can refer below screen output for the preference sample application.
Screen 1: Show the first screen and display the default Date Time preference value in the label
Screen 2: After clicking on Register store the user name and the latest time in the preference
Screen 3: Display the existing preference value, if the user clicks on the logout option, the preference value becomes clear.
Microsoft Azure is a cloud service that is constantly expanding to help your organization meet business challenges. You can build, and manage to deploy applications using the following Azure management options.
Azure Portal
Azure PowerShell and CLI
Azure Cloud Shell
Azure Mobile app
I have received many messages from users,” Want to learn Azure. But do not have an Azure subscription. Are there any tools? Simulators? etc” in this article, will elaborate and share how you can learn Azure without paying Subscriptions.
You can activate free Azure benefits with the following different options,
Azure Free Subscription
Microsoft Learn Azure Sandbox subscription.
Visual Studio subscription benefits (Formerly MSDN Subscriptions)
Azure free Subscription
The Azure free account includes access to a number of Azure products that are free for 12 months, ₹13, 300 credit to spend for the first 30 days of SignUp and access to more than 25 products that are always free.
You can learn from here more about the Azure free account.
Microsoft Learn Azure Sandbox subscription Microsoft Learn is an online learning platform where you can gain practical knowledge about Azure by completing a bunch of courses and hands-on labs. Unlike the other learning platforms, it provides a free sandbox (dedicated subscription) that you can use to complete the courses
Visual Studio subscription benefits [MCT, MVP, FTE, MPN, NFR] Visual Studio subscribers can use Microsoft Azure at no extra charge. With your monthly Azure DevTest individual credit, Azure is your personal sandbox for dev and test. You can create virtual machines, cloud services, and other Azure resources. Credit amounts vary based on subscription level.
Microsoft no longer offers Visual Studio Professional Annual subscriptions and Visual Studio Enterprise Annual subscriptions in Cloud Subscriptions. There will be no change to existing customers' experience and ability to renew, increase, decrease, or cancel their subscriptions.
If someone in your organization purchases, subscriptions for your organization, contact your Visual Studio subscription administrator and request a subscription that provides the monthly credit that you need.
You can sign in in your visual studio benefits https://my.visualstudio.com/benefits. and see the Azure credit . You can find below the table for Azure credit eligibility.
Visual Studio Enterprise Standard
$150 monthly credit
Visual Studio Enterprise with GitHub Enterprise
$150 monthly credit
Visual Studio Enterprise monthly
NA
Visual Studio Professional Standard
$150 monthly credit
Visual Studio Professional with GitHub Enterprise
$150 monthly credit
Visual Studio Professional monthly
Not Available
Visual Studio Test Pro
50 monthly credit
MSDN Platforms
100 monthly credit
Visual Studio Enterprise – Not For ReSale[NFR]
$150 monthly credit
Visual Studio Enterprise – FTE
$150 monthly credit
Visual Studio Enterprise - Microsoft Partner Network
$150 monthly credit
Visual Studio Professional - Microsoft Partner Network
NA
Visual Studio Enterprise – Imagine (Standard)
NA
Visual Studio Enterprise – Imagine (Premium)
NA
Visual Studio Enterprise – BizSpark
$150 monthly credit
Visual Studio Enterprise – MCT Software & Services
100 monthly credit
Visual Studio Enterprise – MCT Software & Services Developer
$150 monthly credit
This article provides an understanding of VerticalStacklayout and HorzontalStackLayout using .NET Multi-platform APP UI (MAUI), which is a cross-platform framework for creating native mobile and desktop apps with C# and XAML
A StackLayout organizes child views in a vertically oriented or horizontally one-dimensional stack, but the Microsoft team introduced VerticalStacklayout and HorzontalStackLayout same as stack layout with improved a lot more performance and avoided unnecessary layout calculations being performed. this article will show a quick demo of VerticalStacklayout and HorzontalStackLayout.
Environment Setup
I have shared a details explanation of the MAUI Development environment setup and getting started with the first MAUI application in my previous article. Microsoft MAUI team continuously releases changes, so make sure you have updated the latest visual studio 2022 preview version.
Create a new MAUI Application
You can open visual studio 2022 from your windows machine. You must follow the below 3 steps to create a new MAUI application
Step 1: Select Create a new project
Step 2: Search the MAUI project template or choose Project Type > MAUI from the dropdown.
Step 3: Provide the configuration Details as a project name, Location, and Solutions name.
The generated templates contain one project with Android, IOS, Windows, Mac and Tizen.
HorizontalStackLayout
The Xamarin forms already have StackLayout organizes child views in a one-dimensional stack, either horizontally or vertically. The HorizontalStackLayout organizes child views in a one-dimensional horizontal stack and is a more performant alternative to a StackLayout.
In this example, we have a design registration screen with 3 important sections label control, an entry box, and an error label.
Add the HorizontalStacklayout instead of Stacklayout with orientation.
Many of them asked questions like, How to align a label and entry box horizontally same line label at the start and Entry at the end? You could set VerticalOptions of that two control to Start/Centre, then the control would align horizontally .
Label, Entry, and Error label add same as Xamarin Forms Design
Once you did the design, the output looks like below
VerticalStacklayout
The VerticalStackLayout organizes child views in a one-dimensional vertical stack and is a more performant alternative to a StackLayout with a vertical. Position and size of views is based on the HeightRequest, WidthRequest, HorizontalOptions and Vertical Options. The following example we used VerticalStackLayout for designs the screen. VerticalStackLayout used for displaying your control one by one.
The LayoutOptions is set via the HorizontalOptions or VerticalOptions properties on any View. They can be set to any of the following options: Start, Center, End, Fill, StartAndExpand, CenterAndExpand, EndAndExpand, FillAndExpand and you can add the following code as per below
The layout looks like the below with 3 controls
Nested VerticalStackLayout/HorizontalStackLayout
A VerticalStackLayou and HorizontalStackLayout can be used as a parent layout that contains nested child of both objects, and other child layouts.
You can see the below example XAML for nested layout, the more the nested layouts will impact your performance., if you are trying to add multiple levels, you can try choosing the correct layout control.
In this example, the parent VerticalStackLayout contains nested HorizontalStackLayout objects and adds the control set.
Summary
In this article, you have seen the demo .NET MAUI VerticalStackLayout and HorizontalStackLayout Layout and how different from stack layout using Visual Studio 2022, Thanks for reading, will share more Dotnet MAUI related articles in the upcoming days.
The Microsoft certification is become more trend because of a lot of job openings for whose completed certification, same time most employees searching the internet “Free Azure dumps”,” Free Training “and free certification Voucher, I will share great information for who’s looking to do certification and some company learning team still not may aware this info, still they are asking to submit the bill for refund the certification expenses reimbursement.
Microsoft provides the Microsoft Enterprise Skills Initiative (ESI) for free. The ESI program includes multiple courses, a Certificate practice exam, free certification voucher for developers, administrators, or engineers, with one-time retakes.
How to know your Company's eligibility for ESI Benefits
Microsoft does not mention in public about criteria for approval. If your employer has a nontrivial Azure subscription with Microsoft and bulks MSDN business with Microsoft, your company may qualify. Most major companies fit into this so you can log on to the ESI website with your company email id. Some companies won’t allow you to log in to your personal computer so log in with your company computer.
SignUp Enterprise Skill Initiative
You can follow the below steps for the Signup Enterprise skill initiative
Step 1: Redirect to https://esi.microsoft.com/, if you have a company laptop use the same because some company not allowed to login into personal computers.
Step 2: Provide your company email id. For example, some company has multiple email id like employeeid@domain.com or employeename@domain.com, so you have tried with your base email id or try one by one.
Step3: Next steps, it will redirect to the Microsoft default login page to provide login details, or if already logged in, automatically redirect to the home page.
Suppose if your company is eligible for enterprise skill, not initiated, you will get the following error message.
Profile Setting
After the login is successful and if you are logging in for the first time, then you will see a profile settings menu where it will ask you which role you are interested to train yourself, your language, and your country.
ESI user benefits
The ESI program's main intention is to share the knowledge and give the support for complete certification with good learning and try to avoid third-party fake promises for dumps and training. Let’s understand the benefits of the below steps
Microsoft Learning
Microsoft Learning Live Training
Microsoft certificate practice training
Microsoft certification practice exam simulation with 247 questions
Microsoft Free Exam Voucher
After login, you will be able to see the below screen.
Free Virtual Live Training
The ESI program provides all the Azure developer, Azure Admin, DevOps, Security, and Office 365 courses, The course is available for beginners to experts. My company has ESI benefits and most of my certification is done through the ESI program.
The courses are delivered over Microsoft Teams and conduct labs on Azure. The tutors are Microsoft's internal trainers. I will give a 5-star rating for all the training, it will be more useful.
Free Exam Practice test
MeasureUp is the leading provider of Microsoft certification practice tests and assessments for professionals. Written by subject matter experts, the practice tests cover all objectives of the exam in-depth, so you'll be ready for anything. In fact, so you'll pass your certification exam after successfully passing its MeasureUp Practice Test, The cost is around 99$.
The Great news, is the above practice exam is also free for you, you can follow the below steps for the free practice test.
Step 3: Select your exam and click on the practice test.
Step 4: The practice test simulation will start with around 245 questions. The question will get shuffled and shown the question at a time of 45. As per my experience, if you cleared the practice test, 100% will pass the main exam as well. The practice exam will show answers and clear explanations as well.
Free Exam Voucher
Microsoft certification cost is around $99 USD. The Microsoft ESI program offers a 100% discount voucher to apply at checkout on the Pearson Vue site for the exam. You can follow the below steps to schedule an exam with a free voucher code.
Step 2: Search and select the exam for which you want to schedule the exam
Step 3: After selecting, you will get the following screen, select your country and click on the Schedule exam button.
Personal Microsoft Account Link to ESI Account
You will be asked to sign in or create a new personal email account. If you have an existing registered personal Microsoft account, use it to sign in. If you do not currently have a personal Microsoft account, create a new account with your personal information and your personal email address or your @gmail.com, @hotmail.com email address. Follow the screen prompts and complete the required fields until you are told that you successfully created your account.
The following screen shows the link to the ESI account if you don’t have the link account tab ignore it for now, if you have already click on the linked account and provide your Company ESI account email ID and provide the login details.
If you have already linked your accounts, you will see the option to claim a 100% by your employee discount, if it's not visible provide the company email id and check the eligibility, after verifying eligibility you will be able to see the like below screen.
You click on the Claim button, then proceed the all the steps for the scheduled date and accept all agreements, then submit the scheduled exam. The payment will display zero, so it won’t ask for any credit card information.
Video Demo
Summary
Hope you all understand the process and it is useful for you. I have explained the same info on all the sessions in Malaysia, Germany, and India, everyone enjoyed and utilized the process, I don’t know which country and the company you are from, please try it yourself, Hope your company is eligible for ESI benefits and you can also utilize, learn and save money 😊
.Net MAUI is a cross-platform framework for creating native mobile and desktop apps with c# and XAML. You can refer to my previous article for getting started with the Dotnet MAUI application. Building iOS application in Windows machine Using Visual Studio 2022, Will do following two approaches for debugging and build the iOS application.
Remote Host (Required Mac)
Xamarin Hot Restart (Without Mac)
In this article, I will show Pair to Mac M1 Chip from windows machine for MAUI iOS app using Visual Studio 2022 preview. I am going to show a POC app with Visual Studio2022 preview, you can also use the same steps in Visual Studio 2019 or 2022++ version.
Mac M1 Chip Setup
Mac Setup is ready here with the following configuration, Upgraded macOS Monterey 12.0.1 version in the Apple M1 Pro Macbook.
The Mac system installed Xcode 13.3 ++ and Visual Studio for mac. You have to open Xcode manually after installing so that it can add any additional components.
You must follow the below steps to enable Remote Host.
Select the “System preferences “
Click on the Sharing pane.
You must configure remote login and follow the below configuration
Remote login Set as “ON”
Configured to allow access for all users.
If prompted, configure the macOS firewall.
You must connect your Mac with the same Wi-Fi network or wired network.
You can click on the Computer icon to connect mac machine or select Tools > iOS > Pair to Mac.
If it is on the same network as the windows machine, the Mac should now be discoverable by Visual studio, if the Mac is still not discoverable, try manually adding a Mac.
Provide Mac name or Mac IP address which is in the remote Login preference on the Macbook.
At the prompt, enter your username and password for that machine after the IP address is entered in the above screen.
Pair to Mac uses these credentials to create a new SSH connection to the Mac, Remote Host will take care of automatically checking the connection and verifying the Mac machine setup, if any mismatch you will get the error popup and ask you resolve and retry.
When Visual Studio is connected to a Mac, that Mac's item in the Pair to Mac dialog displays an icon indicating that it is currently connected
You will be able to see the below screen automatically. All iOS simulators are loaded after the mac connected successfully and also able to see the computer icon indicated with a green icon.
If you have any issue verify in iOS setting a windows machine, On Visual Studio > Tools > options > Select the iOS setting.
Verify the XCode path, make sure Xcode installed in the application folder from Mac machine
Remote Simulation should be on, otherwise, Simulator won’t be displayed on windows machine
Remote iOS Simulator shows up as a black screen
Completely unable to use the iOS Simulator for Windows 10, only happening when using an M1-based Mac. When using an Intel-based Mac, we can successfully use the iOS simulator.
A fix for this issue has been Microsoft implemented and is being prepared for release. Microsoft will update to all once it becomes available for download.
There is a workaround to force the simulator to load on the Mac M1, which works, but is certainly not a great solution and isn’t viable for many.
You can go to Tools->Options->Xamarin->iOS Settings and uncheck ‘Remote Simulator to Windows’.
The MAUI application is ready to show on the iOS simulator from Mac M1 chip.
Summary
This article showed steps how to use Pair to Mac M1 chip to connect Visual Studio 2022 preview to a Mac build host, enabling Visual Studio 2022 preview developers to build iOS applications with MAUI
.Net MAUI is a cross-platform framework for creating native mobile and desktop app with c# and Xaml. In my previous article, we did warn welcome to Dotnet MAUI and shared information about the History of Xamarin.
MAUI as everybody already knows is a name for a new upgrade solution as a Multi-platform APP UI framework for building native cross-platform apps with .Net for android, iOS, macOS, and Windows. I am going to show how to create, build and debug the First MAUI application using Visual Studio 2022.
MAUI and other third-party framework teams started working on support for upgrading the app and old NuGet package to MAUI. MAUI will also provide you support for building the apps in different modern patterns and frameworks MVVM, MVU and RxUI.
.NET MAUI IDE
Microsoft provided 3 fantastic IDE Tools to create and develop apps with .NET MAUI and the happy news is MAUI is an open source.
Visual Studio
Visual Studio for Mac
Visual Studio Code
Visual Studio 2022
On Windows or Mac machines you can use Visual Studio Code or Visual Studio/ VS for Mac for development. You will need the visual studio 2022 17.1.0 preview version. Microsoft released Visual studio 2022 version 17.0 in Nov month, but MUAI is still in preview so you can start to install visual studio 2022 17.1.0 preview version to create your first MUAI application.
After installation success, Open the Visual Studio IDE
In this sample demo application, I am going to show Android, iOS, and Windows app using MAUI, so Get started with “Create New Project”
On the new Project template, select project type as an” MAUI” and you will all the MAUI preview template, if you are not finding the MAUI template means, you have not installed the latest preview version so make sure you have installed the latest preview version 17.1 ++.
In the Configure your new project window, name your project, choose your project location where you need to save, and click the Create button
MAUI Solutions Structure
After clicking on Create, MAUI solutions default template loaded with all the related MAUI NuGet packages. There is a single project with different platform folders and resources.
MainPage.XAML
The main page, whichever design, will support all other platforms as well, and also Main Page XAML build action modified in MAUI app.
Main Page.Xaml build action modified with MAUIXAML, make sure Xaml Build action is correct.
Right click on the XAML page >>Properties>>BuildAction of XAML Page to MauiXaml.
.NET Generic Host
The Worker Service templates, create a .NET Generic Host, HostBuilder. The Generic Host can be used with other types of .NET applications, such as Console apps.
Maui Program class enables apps to be initialized from a single location, and provides the ability to configure fonts, services, and third-party libraries.
iOS, Android, windows, and all the platform entry point calls a CreateMauiApp method of the static MauiProgram class that creates and returns a MauiApp, while lunch the application
Application Class
The App class derives from the Application class
Resources
The resources are a good improvement in MAUI. The AppIcon, image and font folder will be available under the MAUI project and it is just a single SVG, Looks like Maui will just automatically take care of generating all the different icon sizes for different devices.
Run IOS App
Building MAUI iOS applications requires access to Apple's build tools, which only run on a Mac. Because of this, Visual Studio 2022 must connect to a network-accessible Mac to build iOS applications.
You must install the Xcode 13.1++ version on the Mac machine before connecting Visual Studio 2022 to the Windows machine.
Windows Configuration
Connect same wifi network
Download and install Visual Studio 2022 with MAUI
Mac Configuration
Connect same wifi network
Install Xcode 13.1 ++
On Network preference > switch on Remote login
Pair to Mac machine from windows
Program.cs
Program class file is the main entry file on IOS app and executes the main method of the application, here you can define your custom app delegate file and other configuration files
Appdelegate.cs
Each platform will call MauiProgram static class for initialize. On iOS will call as below
You can select iOS simulator and device and click Run icon for executing the application
The out as like below
Run Android App
The android application, MainApplication.cs will execute first, it will call the MauiProgram static class initially as like below
You can select android simulator or device as below, press F5 to run the application
The output like below
Run Windows App
The Windows application executes App.xaml.cs file first, it will call the MauiProgram static class initially as like below
Select the device and run the Application
Demo Video
I have shared a recorded demo video with two versions, English and Tamil. It will help you to understand more about creating, building, and debuging the First MAUI application.
English Demo Video
Tamil Demo Video
Hope this article is very useful for you, If you have any questions/ feedback/ issues, please write in the comment box