Enabling And Disabling The Frame Rate Counter In UWP

Prerequisties
 
         Visual Studio 2015 with Update 3.
 
Introduction about Frame Rate   
  • Frame Rate Counter is a set of numeric Values which is displayed under the title bar. It is very simple to create the frame rate counter on the UWP App using Visual Studio 2015.
  • The app is running on the Debug Mode but when this runs on the Release Mode it is not visible to display on the screen. 
  • This is the default behavior app which is used to execute a program.  
  • When someone installs the app from the store it will not display unless you specifically ask it to display all the time.
  • Frame Rate Counter is used to Enable and Disable in Universal Windows Platform using Microsoft Visual Studio 2015.
 Let's start with  the following steps to create a UWP project given below.
 
Step 1  

Creating a UWP project using Visual Studio 2015. Open Visual Studio 2015 and Click "File----->select New----->select Project" to create a UWP app.
 
 
 
Step 2  

Then New Project will open and an installed template will be there by clicking on (Visual C#--->Windows--->Universal)-------->select Blank App(Universal Windows) and type the app name in the Namebox and click OK button.
 
 
 
Step 3  

Then select the Target Version and Minimum Version which is used to set a Platform Version for Universal Windows Application and Click the OK button.
 
 
Step 4  

The UWP Project will open and now we will go to solution explorer and select MainPage.xaml for the designer window in the App.xaml.cs.
 
 
 
Step 5  

Now add the code in App.xaml.cs for the Frame Rate Counter in the Debug Mode as class file and Open the file and go to OnLaunched event where we will find the Code given below, and enable this.DebugSettings.EnableFrameRateCounter = true;
 
 
 
Here it is the clear code given below,
  1. if (System.Diagnostics.Debugger.IsAttached)     
  2. {     
  3.    this.DebugSettings.EnableFrameRateCounter = true;     
  4. }     
Step 6  

Then we can run this project using Local Machine to run these applications on the Frame Rate Counter.
 
 
 
Output is,
 
 
Step 7

If you want  to remove the Frame Rate Counter you can change the property as "False" in the given code and disable this.DebugSettings.EnableFrameRateCounter = false;
 
 
 
Here is the clear code given below,
  1. if (System.Diagnostics.Debugger.IsAttached)    
  2. {    
  3.     this.DebugSettings.EnableFrameRateCounter = false;    
  4. }  
Step 8  

Then we can run this project using Local Machine to run these application on the Frame Rate Counter.
 
 
 
Output is,



Conclusion  

We have successfully created the project for enabling and disabling Frame Rate Counter in Universal Windows Platform using Microsoft Visual Studio 2015. Feel free to comment with some suggestions and I hope you enjoyed reading this article.Thank you.


Similar Articles