WPF Search Tool


In my previous article http://www.c-sharpcorner.com/UploadFile/Mahadesh/8330/  I had start with developed a simple windows tool for Search . I thought of extending the tool and this time I would be using WPF .

Lets start off .

Created a new WPF Project.

Created a DataModel as shown below :

Created a DataModel WPF

Scripts for the Table Creation:

WinSearchEngine_Dictionary Table :

USE [ProjectsData]
GO

/****** Object: Table [dbo].[WinSearchEngine_Dictionary] Script Date: 07/30/2011 19:46:26 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[WinSearchEngine_Dictionary](
[id] [int] IDENTITY(1,1) NOT NULL,
CategoryId int CONSTRAINT fk_MainCategory_cid FOREIGN KEY REFERENCES MainCategory(CategoryId),
[topic] [varchar](200) NULL,
[site_adress] [varchar](200) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

MainCategory Table:

create table MainCategory(
CategoryId int IDENTITY(1,1) not null primary key,
[MainCategory] [varchar](200) NULL)

User Interface:

The UI of the search tool has been modified . I have added another field called MainCategory which tells us in which Category do I want to create a new entry. Let me give a Demo how it works :

Let me hit a F5.

Search Tab:

Search Tab WPF

Add Category Tab:

In this tab I can simple add a new Category – which would later help me Filter links better . Add a Category say Multi Threading and Hit the Button.

Add Category Tab WPF

Category gets added .

Category gets added WPF

Add Item :

In this tab I can go and check the Category Combo box and find that the added Category pops up .

Add Item WPF

Simply go ahead and add a new entry .

Add Item WPF

Entry is added to database .

Entry is added to database WPF

Search Tab :

In this tab I can check on the Search Category Combo and choose the Main category.

Search Tab WPF

Depending on the Main category , the sub titles would pop up in the Search Combo Box .

Search Combo Box WPF

Select the Sub Topic and click on Search . Note that the Url comes up as a Hyperlink Button now so just go ahead and click on it . The page should open up now .

Search Combo Box WPF

Great . Happy Coding .

Conclusion :

In this article we have just extended the Windows Tool we created earlier . I would want to add some other features to it . Guys let me know the ideas which come up.