Tim Hibbard

CEO for EnGraph software
posts - 629 , comments - 1633 , trackbacks - 459

My Links

News



Add to Google

Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

EnGraph Blogs

Links

Other

Roll

Code

Real world desktop WPF applications - UI Validation
Intro to this series of posts. Some of the code I use for UI validation came from Paul Stovell, who is working on a WPF Element that acts like WinForms 2.0 ErrorProvider control. Paul's control didn't quite fit my needs, so I've tweaked a few things so I can provide visual validation in a generic fashion from my base class. All of our objects implement:Public Event InvalidProperty(string PropertyName, string ErrorMessage);Public Event Validated(object sender);Public bool IsValid; Our objects also ......

Posted On Thursday, July 19, 2007 11:36 AM | Comments (1) |

MSBuild file to publish ClickOnce using AfterCompile and MSBuild Community Tasks
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="DesktopBuild" xmlns="http://schemas.micro... <!-- TO EDIT BUILD TYPE DEFINITION To edit the build type, you will need to edit this file which was generated by the Create New Build Type wizard. This file is under source control and needs to be checked out before making any changes. The file is available at - $/{TeamProjectName}/TeamBui... where you will need to replace TeamProjectName ......

Posted On Friday, June 1, 2007 2:06 PM | Comments (2) |

C# code to rebuild properties after implementing INotifyPropertyChanged
This code is meant for people that want to easily implement INotifyPropertyChanged after using the "prop" code snippet. It will take code that looks like this: public int DriverID { get { return _driverID; } set { _driverID = value; } } And return it like this: public int DriverID { get { return _driverID; } set { _driverID = value; OnPropertyChanged("DriverID"); } } It also will ignore any triple slash comments and #regions. So you can copy your entire #region --Properties-- into the class and it ......

Posted On Thursday, May 24, 2007 9:39 AM | Comments (1) |

C# code to pull data out of an IDataReader
I have a couple helper methods that I use all the time during my data access layer. I figured I might as well post them and hopefully help others out. I use the code from this article to pull my field names, that way I can build code like this:public override IEntity PopulateFromOpenIDataReader... dr) { const int ID = 0; const int NAME = 1; const int COMMENT = 2; const int ADDRESS1 = 3; const int ADDRESS2 = 4; Doctor rv = new Doctor(); rv.ID = (int)DataValidation.GetValu... ID, 0); ......

Posted On Thursday, May 3, 2007 1:06 PM | Comments (1) |

C# code to dynamically generate CoT XML
I've been working on implementing CoT XML standard for describing location based data. Here is the C# code for an .aspx page that will render XML More infomation about CoT can be found here: using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;u... System.Web.UI.WebControls.W... System.Web.UI.HtmlControls;... System.Xml;public partial class cot : System.Web.UI.Page{ ......

Posted On Friday, April 27, 2007 1:37 PM | Comments (2) |

C# Code To Extract Const Int code from database
Update: 02/27/2007 added support for raw SQL Strings When I build data access layers, I like to define a const for each column in the query like this: const int CLIENTID = 0; const int STATUS = 1; const int FIRSTNAME = 2; That way, I can pull data like this: newClient.Name.FirstName = reader.GetString(FIRSTNAME); And if something changes in the database, I know I only have to change the field that FIRSTNAME references. However, sometimes, tables can be quite large and it becomes a pain in the wrist. ......

Posted On Wednesday, February 14, 2007 12:50 PM | Comments (2) |

C# code to maintain VPN connection programatically
Windows has pretty good VPN management. It's pretty good at redialing the connection when the connection is dropped, and for the most part it works. However, sometimes it thinks it connected to the VPN when it's really not, and it doesn't validate the connection to a specific internal IP. I needed something that was a bit more robust and could disconnect and reconnect if it couldn't see a specific IP. This class takes a VPN connection name and an IP to ping and will use rasphone.exe to connect and ......

Posted On Monday, January 22, 2007 9:14 AM | Comments (18) |

How to create Team Foundation Server Group that can have tasks assigned to it
In a recent post, I talked about wanting a TFS group called ParaPlan_Stud that contained Kyle and myself that we could assign tasks to and view in our "My Work Items". Much thanks goes to Mickey Gousset, who wrote a book that you need to get, for helping me with this. Here is how we did it: Created Project Group call ParaPlan_Stud and added Kyle and myself to it. Edited Task.xml To access the Task, I had to edit the xml file that defines the task. Using the VS 2005 command prompt, I entered: witexport ......

Posted On Wednesday, January 17, 2007 11:06 AM | Comments (1) |

C# / VB.NET function to generate pubDate from DateTime
According to the RSS specification, the pubDate element (when the item was published) must be formatted like this : Mon, 28 May 1979 19:45:32 GMT Here is a function that will accept a DateTime object and return a string formatted properly for pubDate: C# private string BuildPubDate(DateTime d) { try { string RV = ""; string day = d.Day.ToString(); if (day.Length == 1) { day = "0" + day; } string month = d.Month.ToString(); if (month == "1") { month = "January"; } else if (month == "2") { month = ......

Posted On Sunday, November 5, 2006 1:34 PM | Comments (6) |

Extending the IO.FileSystemWatcher class
The FileSystemWatcher is very useful when you need to be notified of changes made to a specific folder. You can raise an event when a new file is created, or deleted and you can also filter by file type and choose if you wish to monitor sub directories. The only problem with the object comes with large file transfers. The created event is raised as soon as the file transfer begins to your watched folder, not when the file has finished transferring. So if you need to move a file or pull data out a ......

Posted On Friday, September 8, 2006 3:10 PM | Comments (6) |

Class to consume hostip.info API
This article will show you how to gather location information from an IP using the hostip.info API. Consuming the IPLocation Class: Private Sub Button1_Click(...) Handles Button1.Click Dim LocationObject As New IPLocation("your ip") MessageBox.Show(LocationObj... MessageBox.Show(LocationObj... MessageBox.Show(LocationObj... MessageBox.Show(LocationObj... MessageBox.Show(LocationObj... End Sub The IPLocation Class: Imports System.Xml Public Class IPLocation ......

Posted On Friday, June 16, 2006 11:23 AM | Comments (0) |

Using XmlTextWriter to generate Google Earth KML from ASPX page
The following code shows the guts of an ASPX page that will return a KML file that will load in Google Earth. We use an XmlTextWriter to write an XML file to the response stream. We set the ContentType = "application/vnd.google-ear... so it will automatically open in Google Earth if the user has it installed. The page accepts 3 query strings.lat - latitude of geographic pointlon - longitude of geographic pointicon - url of icon that will plot the point If query strings are not provided, ......

Posted On Thursday, September 28, 2006 5:56 PM | Comments (3) |

VB.net code for adding GeoRSS tags to the FeedMap service
This code shows how to use an ASPX page to render RSS with embedded GeoRSS tags. It calls from the FeedMap service. I talk more about the functionality in this blog post. Imports System.Xml Partial Class FeedMap Inherits System.Web.UI.Page Dim place As String = "" Dim lat As Double = 0 Dim lon As Double = 0 Dim count As Integer = 50 Dim rssUrl As String = "" Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try place = Request.QueryString("place") Catch ......

Posted On Thursday, September 21, 2006 7:08 AM | Comments (1) |

Using Google Maps .getBounds() function
Too many Google Maps mashups force the user to enter a zip code, or select a state before displaying the data to the user. This interrupts the user experience and takes away the "browsing" capabilities that Google Maps offers. This JavaScript code will show how load data from XML using the Google Maps AJAX helper when the user moves the map and display only the points that are in the viewing range of the user. The XML file is located here. And a working example is here. <script type="text/javascript&... ......

Posted On Friday, June 9, 2006 11:48 AM | Comments (4) |

AJAX.net Demo Code
This article is from a talk I did for the Kansas City .net user group. It will show you how to use the AJAX.net library written by Michael Schwarz. Initial Setup: 1) Download dll from http://ajaxpro.info 2) Open Visual Studio and create a new web application 3) Add a reference to the AJAX.net dll 4) Modify your web.config to include: <system.web> <httpHandlers> <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandler... Ajax"/> </httpHandlers> ......

Posted On Wednesday, May 24, 2006 7:22 AM | Comments (7) |

Using ApplicationDeployment to manually update ClickOnce applications
Class to implement manual updates in ClickOnce applications. With one line of code, you can asynchronously update your applications Dim updateCO As New UpdateClickOnce("EnGraph Manager", True, True) Public Class UpdateClickOnce #Region " Variables " Dim WithEvents MyApp As Deployment.Application.Appl... Dim AppName As String = "this application" Dim UseMsgbox As Boolean = True Dim IsChecking As Boolean = False #End Region #Region " Properties " ......

Posted On Monday, February 27, 2006 1:06 PM | Comments (4) |

Powered by: