How to programmatically hide the keyboard

I have a textbox with a button inside. When the user presses the Action, a progress bas is displayed, the screen goes dark, and some magic happens. My problem is that since the action doesn’t result in the textbox losing focus, the on-screen keyboard is not hidden, and keeps covering half the screen. Just set focus to the main page: this.Focus(); this will focus a control that doesn’t use the keyboard and thus hide the keyboard. Unfortunately there is no API to the keyboard to hide it.

Read More

Blogger C# API

using System;using System.Text;using Google.GData.Client;using System.Net;using System.Xml;using System.Text.RegularExpressions;namespace BloggerDevSample{ class ConsoleSample { /** Lists the user’s blogs. */ static void ListUserBlogs(Service service) { Console.WriteLine(“\nRetrieving a list of blogs”); FeedQuery query = new FeedQuery(); // Retrieving a list of blogs query.Uri = new Uri(“https://www.blogger.com/feeds/default/blogs”); AtomFeed feed = null; feed = service.Query(query); foreach (AtomEntry entry in feed.Entries) { Console.WriteLine(” Blog title: ” + entry.Title.Text); } } /** Lists the user’s blogs and returns the URI for posting new entries * to the blog which the user selected. */ static Uri SelectUserBlog(Service service) {…

Read More

How to add a new Blogger post with labels from C#

First download and install Google API from here:https://code.google.com/p/google-gdata/downloads/list Add a reference to “Google Data API Core Library”,and use the following function: public static bool AddPost(string title, string bodyHTML, string[] labels) {     Service service = new Service(“blogger”, “<program name>”);     service.Credentials = new GDataCredentials(“<username>”, “<password>”);     AtomEntry newPost = new AtomEntry();     newPost.Title.Text = title;     newPost.Content = new AtomContent();     newPost.Content.Content = bodyHTML;     newPost.Content.Type = “html”;     foreach (string label in labels)     {         AtomCategory cat = new AtomCategory();         cat.Scheme = new Uri(“https://www.blogger.com/atom/ns#”);         cat.Term =…

Read More

Transparent Live Tile For Windows Phone 8.1

Windows Phone 8.1 Dev Preview Windows Phone 8.1 developer preview is totally awesome. So what is one of the most important things app devs can do right away, without much fuss, to make their apps look great with Windows Phone 8.1? Revisit your app’s Live Tile images. Why? In 8.1, Start screen is mesmerizing with the parallax effect and Live Tile with background overlay. Dev preview users are going crazy with new Start experience, and I am sure, with public release, end users are going to love to have background…

Read More

How to create and show an Icon on the Lock Screen in Windows Phone

This article demonstrates how to create / show a lock screen icon that will identify your Windows Phone 8 app on the lock screen. Here are a few quick steps you can follow: Step1. Create a new Windows Phone 8 application project in Visual Studio. Step2. Add a PNG image to your project, that will be displayed on the lock screen. Image requirements: Size: 38 x 38 Type: PNG Colors: The image must contain only white pixels, optionally  with some level of transparency Add a sample icon that meets the…

Read More

Live Tiles in Windows Phone 8: Part 1 Tile Templates

Live tiles are one of the signature features of Windows Phone and are used to represent your app on the start screen of the phone and give the user quick access to your app. Live tiles also enable apps to show notifications to the user on the home screen and starting with Windows Phone 8 – on the lock screen. While, the Primary (or default) tile appears on the phone’s start screen only when a user pins your application, secondary tiles are created programmatically by the application and multiple such…

Read More

Creating Custom Live Tiles for Windows Phone

Using Live Tiles in Windows Phone applications give new fresh way of communication with users. We can provide various information via Live Tiles to the user using text or images. This post will explain how to create custom live tiles with custom formatted text on the secondary tile using Flip template which is default Tile template. You can find more general info about Tiles on Tiles for Windows Phone MSDN page. Introduction When working with Live Tiles you provide default Tile images for Flip Template using WMAppManifest.xml file from Assets/Tiles folder:…

Read More

Windows Phone 8 : Background Agents – Periodic Agent

If you are a desktop or web developer, you are used to being able to decide when and where your code runs. On the phone you do not have that luxury, so you have to let the operating system dictate exactly when you run your application or some background operations. But how does the operating system handle background operations? Normally when you build a typical phone application, you submit a .xap file with all the code your application requires to launch the application’s user interface. Your application can be launched,…

Read More

Creare App per Windows Phone 8

Oggi è stato pubblicato il libro di Enrico Rossini Creare App per Windows Phone 8 Concetti di base. Nel mercato degli smartphone è arrivato da qualche tempo il nuovo sistema operativo di Microsoft, Windows Phone, che rappresenta un taglio netto con il passato: nuova architettura, nuova user experience, nuova grafica e anche nuovi strumenti di sviluppo. Con questo libro, partendo dalle basi fino ad arrivare agli aspetti più avanzati, scopriamo tutte le caratteristiche della piattaforma e quali sono gli strumenti che abbiamo a disposizione per creare applicazioni originali e innovative.…

Read More

Display list of files from Server folder in ASP.Net GridView

In this article I will explain how we can save and retrieve files from Windows Folder and Directory and display them in ASP.Net GridView control with download and delete option.   HTML Markup Below is the HTML Markup of the page, where I have an ASP.Net control FileUpload to upload files, a Buttoncontrol to trigger file uploads and an ASP.Net GridViewcontrol to display the files from folder. <asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”false” EmptyDataText=”No files uploaded”> <Columns> <asp:BoundField DataField=”Text” HeaderText=”File Name” /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID=”lnkDownload” Text=”Download” CommandArgument='<%# Eval(“Value”) %>’ runat=”server” OnClick=”DownloadFile”></asp:LinkButton>…

Read More

How to create simple Background Agent in Windows Phone

This article provides a minimal example on how to create Background Agents (Tasks) in Windows Phone. There is a more comprehensive example on Dev Center How to implement background agents for Windows Phone.   Introduction Windows Phone apps are made dormant when running in the background or when the phone is locked (to conserve device memory and battery life). If your application needs to perform processing when it is (may be) in the background you can use a background agent to run activities according to some schedule. Background agents are…

Read More

Checking the Internet connection type on Windows Phone

All Windows Phone applications that use Internet data should always check if there is a valid Internet connection; if there is no connection, a proper message should be displayed to the user. The correct way to check if you have an Internet connection (WIFI, Ethernet, or none) is by checking the property: NetworkInterface.NetworkInterfaceType Unfortunately checking this property is a synchronous operation, so calling it in the UI thread can block the UI for many seconds. If your application relies on a specific server you might be tempted to simply check…

Read More

Checking network availability in Windows Phone

Many applications utilize network connection for various purposes like feeds, sending & receiving data to/from server, etc. The following article explains how one can detect if the network connection is available or not. Network API Information NetworkInterface Class helps in providing network information to the developers. It helps detect if the network is on/off, address etc. NetworkInterface::GetIsNetworkAvailable is used to check if the network connection is available.The network connection is considered to be available if interface is not in loopback or is marked as “up”. Namespace: System.Net.NetworkInformation Example Code to…

Read More

Enabling quick resume for Windows Phone apps

This article explains how to quickly resume the Windows Phone 8 application which is put in the background.   Introduction Whenever your app loses focus (is put in the background), an instance of the app is saved. This instance is used to resume the app if the user tasks to it from a deep link or returns to it by selecting the back button on the foreground app. However if the user relaunches the app by selecting its icon on the start screen, by default the stored instance is removed…

Read More

Make the application loosely coupled

In this series of tutorials, we build an entire Contact Management application from start to finish. The Contact Manager application enables you to store contact information – names, phone numbers and email addresses – for a list of people. We build the application over multiple iterations. With each iteration, we gradually improve the application. The goal of this multiple iteration approach is to enable you to understand the reason for each change. Iteration #1 – Create the application. In the first iteration, we create the Contact Manager in the simplest…

Read More

Add form validation ASP.NET MVC

Building a Contact Management ASP.NET MVC Application (C#) In this series of tutorials, we build an entire Contact Management application from start to finish. The Contact Manager application enables you to store contact information – names, phone numbers and email addresses – for a list of people. We build the application over multiple iterations. With each iteration, we gradually improve the application. The goal of this multiple iteration approach is to enable you to understand the reason for each change. Iteration #1 – Create the application. In the first iteration,…

Read More

Dynamic Pivot Linq C#

I have the following collection / table Category Type Detail CostAuto Hybrid AC 80Auto Hybrid Sunroof 100Auto Standard AC 120Motorcycle Standard Radio 60 Is there a way with linq to get this to pivot to look like this? Category Type AC Radio Sunroof Auto Hybrid 80 0 100 Auto Standard 120 0 0Motorcycle Standard 0 60 0 use the let keyword to generate a key for use with the group by clause like so: var query = from item in list let key = new { Category = item.Category, Type…

Read More

Pro ASP.NET MVC 5

The ASP.NET MVC 5 Framework is the latest evolution of Microsoft’s ASP.NET web platform. It provides a high-productivity programming model that promotes cleaner code architecture, test-driven development, and powerful extensibility, combined with all the benefits of ASP.NET. ASP.NET MVC 5 contains a number of advances over previous versions, including the ability to define routes using C# attributes and the ability to override filters. The user experience of building MVC applications has also been substantially improved. The new, more tightly integrated, Visual Studio 2013 IDE has been created specifically with MVC…

Read More

DVLUP

DVLUP HELPS DEVELOPERS BECOME MORE SUCCESSFUL HAVE FUN. EARN REWARDS. BUILD NEW IDEAS. By joining DVLUP, you’ll get exclusive access to App Challenges, news, events, partner opportunities and more. Earn points to redeem for Rewards, including promotional placements for your Apps. And if exclusive access and glory aren’t enough, we’ve got more badges than the lost & found at a police convention. Let’s get playing.   DVLUP Has Leveled Up

Read More

Windows Phone 8 Battery API

The Battery API makes a nice addition to the WP8 SDK. I can see in the near future that some applications will display the battery metrics on a Live Tile or in the application that hides the System Tray. The Battery API is pretty easy to use: Get the Battery instance with Battery.GetDefault() Bind to the event RemainingChargePercentChanged. The battery properties are: RemainingChargePercent: gets a value that indicates the percentage of the charge remaining on the phone’s battery RemainingDischargeTime: gets a value that estimates how much time is left until…

Read More

Privacy policy generator for websites and apps

This post mainly answers the question how and why you should add a privacy policy to your Windows Phone app. If you want to read a more general overview of privacy policies in mobile apps then you can read that here If you want to skip all that and just use our generator to help you make a privacy policy for your Windows Phone app then follow me Since we’ve launched our mobile apps privacy policy generator last week I’ve been wondering how good the documentation was out there regarding…

Read More

Add Rows to a DataTable

To add new records into a dataset, a new data row must be created and added to the DataRow collection (Rows) of a DataTable in the dataset. The following procedures show how to create a new row and insert it into a DataTable. Examples are provided for both typed and untyped datasets. I created this Dataset (view picture). dsOperation dt = new dsOperation(); DataRow opRow = dt.Tables[“Operations”].NewRow(); opRow[“Group”] = “FirstGroup”; opRow[“SubGroup”] = “SecondGroup”; opRow[“Debit”] = 0; opRow[“Credit”] = 10; dt.Tables[0].Rows.Add(opRow);

Read More

Getting error “The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine”

While I was trying to connect to an Access Database from Visual Studio 2010 on my Windows 7 x64 server, I got the following error message, SOLUTION After a detailed research on the above error message, I was able to identify that the 64-bit framework dlls weren’t able to 32-bit versions of the ‘Microsoft.ACE.OLEDB.12.0‘ provider modules. Since I was running Visual Studio on a 64-bit machine, IIS 7 is not (by default) serving 32-bit applications. However, I noticed that the database engine operated on 32-bit. I followed these steps to…

Read More

Accessing SMTP Mail Settings defined in Web.Config File Programmatically

I needed to read my SMTP email settings defined under system.net section in my web.config file. In order to use eNewsLetter and other SiteAdmin CMS modules that sending email notifications; you can setup your web.config to defind SMTP services settings. Below is one example of SMTP email setting defined in web.config file:(Under <configuration> Section)     <system.net>        <mailSettings>            <smtp deliveryMethod=”Network” from=”testuser@domail.com”>                <network defaultCredentials=”true” host=”localhost” port=”25″ userName=”kaushal” password=”testPassword”/>            </smtp>        </mailSettings>    </system.net> To Access, this SMTP Mail Setting Programatically, you need to import below namespaces: using System.Configuration;using System.Web.Configuration;using System.Net.Configuration; The .NET Framework provides…

Read More