Click here to Skip to main content
12,448,059 members (93,608 online)
Click here to Skip to main content

Stats

123.3K views
383 downloads
50 bookmarked
Posted

ToDoList Viewer - PocketPC Viewer for .dan.g's ToDoList

, 9 Aug 2004 CPOL
A read only viewer of the ToDoList XML for the PocketPC.
Setup.msi
Setup.Exe
Setup.Ini
ToDoList Viewer
bin
Release
ToDoListViewer.exe
BuildCabs
Cabs
ToDoListViewer_PPC.inf
checked.bmp
CustomerInstaller
bin
Release
Cabs
CustomerInstaller.dll
setup.ini
Setup
Release
Setup.vdproj
ToDoList.ico
ToDoListViewer.csdproj
unchecked.bmp
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

using System.Windows.Forms;
using System.Reflection;
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;

namespace CustomInstaller
{
	/// <summary>
	/// Summary description for Installer.
	/// </summary>
	[RunInstaller(true)]
	public class Installer : System.Configuration.Install.Installer
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Installer()
		{
			// This call is required by the Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitializeComponent call
		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			// 
			// Installer
			// 
			this.AfterUninstall += new System.Configuration.Install.InstallEventHandler(this.Installer_AfterUninstall);
			this.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.Installer_AfterInstall);

		}
		#endregion

		private void Installer_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e)
		{
			// get fullpath to .ini file
			string arg = Path.Combine(
				Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
				"Setup.ini");
			
			// run WinCE App Manager to install .cab file on device
			RunAppManager(arg);
		}

		private void Installer_AfterUninstall(object sender, System.Configuration.Install.InstallEventArgs e)
		{
			// run app manager in uninstall mode (without any arguments)
			RunAppManager(null);
		}

		private void RunAppManager(string arg)
		{
			// get path to the app manager
			const string RegPath = @"Software\Microsoft\Windows\" + 
					  @"CurrentVersion\App Paths\CEAppMgr.exe";
			RegistryKey key = Registry.LocalMachine.OpenSubKey(RegPath);					
			string appManager = key.GetValue("") as string;
			
			if (appManager != null)
			{
				// launch the app
				Process.Start(
					string.Format("\"{0}\"", appManager), 
					(arg == null) ? "" : string.Format("\"{0}\"", arg));
			}
			else
			{
				// could not locate app manager
				MessageBox.Show("Could not launch the WinCE Application Manager.");
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Kyle Tillman
Team Leader
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160811.3 | Last Updated 10 Aug 2004
Article Copyright 2004 by Kyle Tillman
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid