Showing posts with label visual studio. Show all posts
Showing posts with label visual studio. Show all posts
Delpin Susai Raj Tuesday, 3 July 2018

Getting Started With Visual Studio Mobile Center In Xamarin iOS

In this blog, you will learn how to Create a Crash Report Using Visual Studio Mobile Center in Xamarin iOS, using Xamarin Studio.




Introduction

Xamarin is a platform to develop cross-platform and multi-platform apps (for example, Windows phone, Android, iOS). In Xamarin platform, the code sharing concept is used. In Xamarin Studio, Visual Studio is also available.

Visual Studio Mobile Center is mission control for your mobile apps
Bring your apps written in any language to Visual Studio Mobile Center’s cloud and lifecycle services and you’ll get faster release cycles, higher-quality apps, and the time and data to focus on what users want.Learn More 


Prerequisites


  • Xamarin Studio.
  • Xcode.
  • Mobile Center Account


The steps given below are required to be followed in order to Create a Crash Report Using Visual Studio Mobile Center in Xamarin iOS, using Xamarin Studio.


Go to This link https://mobile.azure.com and log in with your credential


Step 1

After Login mobile center.Create a New App in Mobile Center site.

Add New—> Add New app.



Step 2

In this step Give your app Name(Ex:XamainiosCrashreport) and Description.

OS           :iOS
Platform :Xamarin

Afterwards, click Add New App.




Step 3

In this step go to Manage App and general information copy your app secret key.



Step 4

Go To Xamarin Studio.
Click New Solution—> select iOS—>select App--> Choose single View App. Afterwards, click Next.




Step 5

In this step, configure your app. Give the app name (Ex:sample), Organization Identifier. Afterwards, click Next.



Step 6

In this step, give your project name (Ex: Sample) and solution name (Ex: Sample). Give the path of your project. Afterwards, click Create.



Step 7

Subsequently, go to the solution. In the solution, get all the files and sources in your project. Now, select Main.storyboard and double click to open Main.storyboard page.



Step 8

After opening the Main.storyboard, you can design this page, as per your desire.



Step 9

In this step design your app.using storyboard and Toolbox.

  1. Button(btnCrash)




Step 10

In this step add Two Package in your project.


  1. Mobile Center
  2. Mobile Center Crashes


Go to Solution Explorer—>Package—>Add Package.

Now Choose Mobile Center,Mobile Center Crashes and select Version. Afterwards, click Add Package.



Step 11

In this step, go to the ViewController.cs page. write the code given below.

ViewController.cs

using System;

using UIKit;

using Microsoft.Azure.Mobile;
using Microsoft.Azure.Mobile.Crashes;
namespace XamariniOSCrashReport
{
 public partial class ViewController : UIViewController
 {
  public const string MOBILE_CENTER_ID= "8f7b790d-cafc-4555-ad29-5a784375ac89";
  protected ViewController(IntPtr handle) : base(handle)
  {
   // Note: this .ctor should not contain any initialization logic.
  }

  public override void ViewDidLoad()
  {
   base.ViewDidLoad();
   MobileCenter.Start(MOBILE_CENTER_ID, typeof(Crashes));
   // Perform any additional setup after loading the view, typically from a nib.
  }

  partial void BtnClick_TouchUpInside(UIButton sender)
  {
   throw new NotImplementedException("Not Implement Exception");
  }

  public override void DidReceiveMemoryWarning()
  {
   base.DidReceiveMemoryWarning();
   // Release any cached data, images, etc that aren't in use.
  }
 }
}





Step 12

Now, go to Run option , choose Debug and the list of iPhone and iPad simulators, which are available. You can choose any one simulator and run it.



Output

After a few seconds, the app will start running on your iPhone simulator.You will see your app working successfully.



You can click button App will be Crash.



Now you can Go to the Mobile Center your app crash tab,The Crash Report will writen Successfully.



Summary

This was the process of how to Create a Crash Report Using Visual Studio Mobile Center in Xamarin iOS , using Xamarin Studio.

Delpin Susai Raj Wednesday, 16 May 2018

Xamarin.Forms - ListView with Pull to Refresh

In this blog, you will learn how to use ListView with Pull to Refresh in Xamarin.Forms



Introduction

Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files are the most easily done tasks using native file APIs on each platform. Alternatively, embedded resources are also a simpler solution to distribute the data files with an app.

Pull to Refresh

Xamarin Forms ListView control has the ability to allow the user to pull down from the top of the ListView to trigger a refresh command. When the user triggers a PullToRefresh the Command will be invoked the Refreshed event.


Prerequisites
  • Visual Studio 2017(Windows or Mac)
Setting up a Xamarin.Forms Project

Start by creating a new Xamarin.Forms project. You’ll learn more by going through the steps yourself.
Choose the  Cross-platform App project under Visual C#-->Cross-platform in the New Project dialog.



Now Select the Blank App and Choose Portable Class Library(PCL).



Subsequently, go to the solution. In there, you get all the files and sources of your project (PCL). Now, select XAML page and double-click to open the MainPage.Xaml page.
You now have a basic Xamarin.Forms app. Click the Play button to try it out.



Setting up the User Interface

In this step create a simple ListView.



Now, write the following code.

MainPage.xaml

Now, add a list item to ListView. and write the following code.



MainPage.xaml.cs

Click the Play button to try it out.




Implement Pull to Refresh

In this step, you need to implement the Pull to Refresh in MainPage.Xaml.

IsPullToRefreshEnabled="True"




Now, write the following code.

MainPage.xaml


In this step add the RefreshCommand to ListView

Command RefreshCommand = new Command();




Now, write the code given below.

MainPage.xaml.cs

Full Code - MainPage.Xaml.cs



MainPage.Xaml.cs



Click the Play button to try it out.



I hope you have understood how to use ListView with Pull to Refresh in Xamarin.forms.

Thanks for reading. Please share comments and feedback.

Delpin Susai Raj Friday, 11 May 2018

Xamarin.Forms - Custom Popup

In this blog, you will learn how to create a custom popup in xamarin.forms

Introduction




Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files are the most easily done tasks using native file APIs on each platform. Alternatively, embedded resources are also a simpler solution to distribute the data files with an app.

Prerequisites
  • Visual Studio 2017(Windows or Mac)
Setting up a Xamarin.Forms Project

Start by creating a new Xamarin.Forms project. You’ll learn more by going through the steps yourself.
Choose the  Cross-platform App project under Visual C#-->Cross-platform in the New Project dialog.



Now Select the Blank App and Choose Portable Class Library(PCL).



You now have a basic Xamarin.Forms app. Click the Play button to try it out.



Setting up the User Interface.

Go to MainPage.Xaml and write the following code.



MainPage.Xaml



In this step, Create a custom popup using contentview.

Write the following code for popup



Popup - Loading

Now, wirte the button click event to show popup.

MainPage.Xaml.cs



Popup - Login



   
Popup - ListView







Popup - ImageView





Full Code - MainPage.Xaml



Full Code - MainPage.Xaml.cs




Click the Play button to try it out.



I hope you have understood how to create a custom popup in xamarin.forms.

Thanks for reading. Please share comments and feedback.