Get your App Package Family Name

In this blog, i’ll show you how to get you App PackageFamilyName in Windows 10 in C# Code without Store, because it’s not available yet for Windows 10 

Before:

In Windows and Windows Phone, we used to get App PackageFamilyName from the Store by “Associating the App, and get the unique PFN of the App”

Why do i need PFN:

If you are intending to use communication between Apps, or using App Services, you’ll absolutely need the PFN to connect the App and Service you are using or whatever the scenario you are building.

Let’s Get Started:

  1. Open Visual Studio 2015 CTP, Create new project, select Windows 10 (Blank Template)
  2. Open MainPage.xaml.cs and these namespaces.
    using Windows.ApplicationModel;
    using Windows.UI.Popups;
    

    The first, because we will be using a class inside it called Package
    and the second, to show MessageDialog.

  3. Then, in Public MainPage() add this code.
    var currentPack = Package.Current;
    var pfn = currentPack.Id.FamilyName;
    new MessageDialog("PFN = " + pfn).ShowAsync();
    

    This code to show the PFN in a Message Dialog using Package Class.

  4. Now, run the demo, and the PFN should appear in a Message Dialog as shown:
    pfn

Now, you have got your App PFN, you can use it to connect to other App using App Services.
Here’s the Code Sample.
Feel free to contact me, if you face any problem.

Advertisements

Integrating Cortana | Part 1

CortanaIn this blog, you will learn How to integrate Cortana into your Windows Phone 8.1 Runtime App.
But, before you integrate Cortana, you have to know Who is Cortana?
So, let me introduce Cortana to you, or actually she will 😀

Who is Cortana?

Cortana is your Digital Personal Assistant, it was developed by Microsoft for Windows Phone 8.1, Microsoft Band and it will be available in Windows 10.
Cortana was announced for the first time at Microsoft BUILD Developer Conference April 2014 and before that she was a character in Halo video game series.

If you have a Windows Phone Device, try asking Cortana “Who are you?” and “Tell me more about yourself.” 😉

Cortana’s Core Functions

Cortana has Three Core Functions:

  1. Communicate
    It can make a call, send text message and text dictation task and so on.
  2. Reminder
    Help the user complete the task now, or help them remember for later.
  3. Find
    Finding content in large catalogs, from large lists, etc…

What can Cortana do?

If you have a Windows Phone Device, try asking Cortana the below commands between the double quotations. Continue reading

Simple OOP

OOP1What is OOP?

It refers to “Object-Oriented Programming”, OOP is a Design Philosophy/Programming Paradigm/Programming Methodology based on the concept of “objects“.

Before OOP

There was a procedure of programming was known as “Traditional/Procedural Programming“, e.g(C, Pascal, etc).

Traditional/Procedural Programming Disadvantages:

  • Difficult Maintenance
  • Slow Development

That’s why OOP came to us.

OOP Advantages

  • Re-usability
  • Fast Development
  • Organized Code allows Fast and Easy Maintenance

OOP Concepts

  • Objects and Classes
  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism

What is Object and Class?

Object:

An object can be considered a “thing” that can perform a set of related activities. And these activities define the Object’s Behavior.
e.g A hand is object, and it performs some activities like holding.

Class:

A class is a collection of objects of similar type.
Class is composed of three things: (Name, Attributes and Operations).

public class Customer
{
}
/*****************/
Customer object1 = new Customer();

This code demonstrates how to create a class which is Customer, and how to use this class by taking an Object which is object1.

 

Encapsulation

A set of elements have the same Properties and Behaviors collecting them together in one place which is Model.
Properties => Variables
Behaviors => Methods
Model => Class

That idea of encapsulation is to hide how a class does its business, while allowing other classes to make requests of it.

public class Person
{
    // Properties
    public string name;
    public string tall;
    // Method 
    public void Speak()
    {
        //Speaks
    }
}

Abstraction

Abstraction refers to the act of representing essential features without including the background details or explanations.
Classes use the concept of abstraction and are defined as a list of abstract attributes.
Storing data and functions in a single unit (class) is encapsulation.
Data cannot be accessible to the outside world and only those functions which are stored in the class can access it.

Inheritance

The ability of a new class to be created, from an existing class by extending it.
Inheritance provides reusability, like, adding additional features to an existing class without modifying it. This is achieved by deriving a new class from the existing one. The new class will have combined features of both the classes.

public class Vehicle
{
}
public class Car : vehicle
{
}

Car Class inherits from Vehicle Class, Which means that Car class will have all of the public properties and methods of Vehicle class, and also Car class can modify a specific implementation of a certain method in Vehicle class.

Polymorphism

Polymorphism is a generic term that means ‘many shapes’. More precisely Polymorphisms means the ability to request that the same operations be performed by a wide range of different types of things.

Polymorphisms is achieved by using two different techniques named method overloading and method overriding,

Method Overloading

The ability to define several methods all with the same name, but with different signatures.

public class Person
{
public void SetName(string lastName)
{
  //Implementation goes here
}
public string SetName(string firstName, string lastName)
{
  //Implementation goes here
}
}

The two methods here have the same name, but different signatures(No. of Parameters and Return type).

Method Overriding

Method overriding is a language feature that allows a subclass to override a specific implementation of a method that is already provided by one of its super-classes.


public class Person
{
    public virtual void SetName()
    {
        //Print "Person Name"
    }
}
public class Male : Person
{
    public override void SetName()
    {
        // Print "Male Name"
    }
}

To perform method overriding:

  • You have to use Inheritance
  • Method in Super-Class should have the keyword “virtual” to allow overriding

Finally, here’s a code sample demonstrating simply OOP LINK 😀

Windows Game Development With Unity3D

I just wanted to share these helpful resources to get started in Developing Windows Games and for familiar to Game Development there many helpful resources too to advance your experience. 

Beginner tutorials

Continue reading