Floating FB popout byF5debug

Settings Panel in Windows Store App – Day 13

 

imageIn this article we are going to see how to use the Settings panel effectively while developing your Windows Store application. In our previous article we have seen how to how to handle data locally while developing your Windows Store Application and the different options to store data in the application. Setting panel in the charm will be used to specify the application settings through the application usage, traditionally we will be providing a page which takes care of the application setting information through which the user interaction can be traced and preference will be added that can be accessed easily from the application.     [more]


With Windows Store Application development this is made easy with the new Setting panel that is added in the charm so while loading the application itself the respective setting for the application will be loaded in the charm. So while accessing the charm bar from any application will load the respective applications settings specifically in the list so that the user can access the settings easily. Let us see the steps on how to use the Setting charm to incorporate the application settings that should be used and access throughout the application.

Open Visual Studio 2012 IDE in administrator mode and create a new Windows Store application with C# and XAML with a valid project name as shown in the screen below.

image

Once the project is created, we can see the blank screen where we can design our requirements. Let us add the below code which need to be registered first, we need to implement a custom CommandRequest event. In the code we can see commandrequest event handler will be used which will be triggered when ever the user tries to call the Settings panel from the charm bar as shown in the code below.

C# Code:

SettingsPane.GetForCurrentView().CommandsRequested += SettingsPanel_CommandsRequested;

image


Now next step is to implement the SettingPanel_CommandsRequested method which will take the arg request where we can create the command that should be shown in the settings panel. We can add a number of commands as per our requirement and register the same with the exact command it should trigger on the click event of that particular command as shown in the code below.

C# Code:

private void SettingsPanel_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            args.Request.ApplicationCommands.Add(new SettingsCommand("commandID1", "Privacy Policy", CallPrivacy));
            args.Request.ApplicationCommands.Add(new SettingsCommand("commandID2", "About F5debug", CallAbout));
            args.Request.ApplicationCommands.Add(new SettingsCommand("commandID3", "Help", CallHelp));
        }

        private void CallPrivacy(IUICommand privacy)
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog("Privacy Added!!!");
            messageDialog.ShowAsync();
        }

        private void CallAbout(IUICommand about)
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog("About Added!!!");
            messageDialog.ShowAsync();
        }

        private void CallHelp(IUICommand help)
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog("Help Added!!!");
            messageDialog.ShowAsync();
        }

image


Now we are done with the code, as you see we have separate methods which has separate implementations which will be triggered on the click event of each of the command which we specified while settings the Arguments in the commandrequested event handler.

Complete Code:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.ApplicationSettings;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at "http://go.microsoft.com/fwlink/?LinkId=234238">http://go.microsoft.com/fwlink/?LinkId=234238

namespace SettingPanel
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            SettingsPane.GetForCurrentView().CommandsRequested += SettingsPanel_CommandsRequested;
        }

        private void SettingsPanel_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            args.Request.ApplicationCommands.Add(new SettingsCommand("commandID1", "Privacy Policy", CallPrivacy));
            args.Request.ApplicationCommands.Add(new SettingsCommand("commandID2", "About F5debug", CallAbout));
            args.Request.ApplicationCommands.Add(new SettingsCommand("commandID3", "Help", CallHelp));
        }

        private void CallPrivacy(IUICommand privacy)
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog("Privacy Added!!!");
            messageDialog.ShowAsync();
        }

        private void CallAbout(IUICommand about)
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog("About Added!!!");
            messageDialog.ShowAsync();
        }

        private void CallHelp(IUICommand help)
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog("Help Added!!!");
            messageDialog.ShowAsync();
        }

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }
    }
}

Now we are done with our code, to start seeing the expected result Build and execute the application and we can see the output as shown in the screens below.

image

image

image


Conclusion:

This article speaks more about how to incorporate the application settings effectively and lively as per the standard app development for Windows Store.

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Добавить комментарий

  Country flag

biuquote
  • Комментарий
  • Предпросмотр
Loading

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter
F5debug | SQL Azure – Manage Database using Azure Portal

Floating FB popout byF5debug

SQL Azure – Manage Database using Azure Portal

 

Introduction:

In this article we are going to see how to manage the newly created SQL Azure database using the Azure management portal.

Overview:

Managing database server and the database itself using SQL Azure is something new which we can see in the latest version provided using Silverlight. Once we create a new Storage account and a new server with new database  we need to manage that database to create tables, stored procedures etc. which made very easy with the latest version of Azure using the manage database option.

[more]

Lets see on how to use this manage option to develop a fully functioning database

Steps:

Log in to the Azure portal using the below link. You can see the screen look similar to below

http://www.microsoft.com/windowsazure/

clip_image001

Login to the portal using your Microsoft Windows Live credentials with Azure credentials to the management portal and you will see the screen as shown in the screen below

clip_image003

Now we can see the Database Menu at the bottom left, Click on that will go to the Database Subscription window as shown in the screen below

clip_image004

Clicking on the subscription name will provide the complete details of the server created and the new database created as shown in the screen below

clip_image005

Now we have a database created with a Max size of 1GB and ready to use it for the application based on the requirement. To manage the database click on Manage at the top menu tool bar as shown in the screen below

clip_image006

Clicking on the Manage button will open a new browser as shown in the screen below

clip_image007

Now accept the agreement and click on OK button will navigate to the new window as shown in the screen below

clip_image008

Enter the valid credentials and click on connect button. We will see a Error message at the bottom as shown in the screen below

clip_image009

Click on the Error button, we can see a nice animation it will open the error message as shown in the screen below

clip_image010

clip_image011

From the error message we can see that the IP address is not added to the firewall. Since this managing server is maintained in different IP we need to add this as well to the Firewall rule. To add the IP to the firewall rule do the following steps. Go to the Azure portal and add the IP as shown below

Now we can see the Firewall Rules tab with the added IP address as shown in the screen below

clip_image012

Click on that button will drop down the list of IP address added as shown in the screen below. Here we need to Click on ADD button to add the new IP address to the firewall

clip_image013

After adding the IP address we can see the IP added to the list as shown in the screen below

clip_image014

Now go back to the Manage portal and give the credentials once again and click on connect button as shown in the screen below

clip_image015

After successful authentication we will be redirected to a new portal as shown in the below screen

clip_image016

We can use this portal to do some updates like adding new table, stored procedure, Views etc along with adding data to the tables which we will see in our upcoming articles.

Conclusion:

So in this article we have seen on how to connect to the new Manage server to manage the database created newly using SQL Azure.

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Pingbacks and trackbacks (1)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter