Skip to main content

Posts

Showing posts from October, 2009

How to prevent users from running more than one instance of our program.

By using Mutex object you can prevent users from running more than one instance of the application. Check out this code snippet using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace SingleInstacle { publicclass Program { staticvoid Main(string[] args) { bool createdNew = false; Mutex mutex = new Mutex(true, "SingleInstance", out createdNew); if (createdNew) { Console.WriteLine("Hello world"); } else { Console.WriteLine("You can only run a single instance of this app!"); } Console.ReadLine(); } } }

Microsoft Ajax Client Template

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title>Ajax Client Side Template</title><scriptsrc="Scripts/MicrosoftAjax.debug.js"type="text/javascript"></script> <script src="Scripts/MicrosoftAjaxTemplates.debug.js" type="text/javascript"></script> <script src="Scripts/MicrosoftAjaxAdoNet.debug.js" type="text/javascript"></script> <style type="text/css"> .sys-template { display: none; } </style> <script type="text/javascript"> function LoadData() { …