Saturday, December 26, 2009

Folder creation and deletion, POPUp Window C#

Folder can be created in C# by
Directory.CreateDirectory("C:\TmpFolder");

This line will create TmpFolder in C drive.

Folder can be deleted in a same way by
Directory.DeleteDirectory("C:\TmpFolder");

This line will delete TmpFolder from C drive.

Folders can be retrieve from a specific location
Directory.GetDirectories, it returns in a string array format.

Logical drives can be retrived by the method
Environment.GetLogicalDrives, it returns all the logical drives in a string array format.

Environment.username returns the name of the user who logged in the application.

POPUp Window
___________

PopUp window is nothing, it is just the movement of height & set the location in the starting of a form.

You just need to know screen resolution by Screen.PrimaryScreen.
set the width and height of the form and its size. drop a timer and on the interval event decrease the height of the popupWindow...

Don't forget to mention ShowInTaskbar = false, ControlBox=false on form level...

An small application is created that create and delete folder and shows a pop-up window on the folder creation and deletion event.

You can download code from here

Thursday, December 24, 2009

Display caching mechanism

What is display method?

display method is a calculated value that may be calculated via different table fields and classes and on the basis of calculation display method returns a value, it may be used on report and forms.

Disadvantage:
when a display method is called on a form, usually its calling is very frequent to get the calculated value.

Solution:
display caching mechanism provides the way to reduce the calling of its function or call whenever it is necessary...
In the display caching mechanism it is necessary that the method should be on the table level.
In the init method of data source (where the method is written on the table level) on form, display method should be added there by using init datasource.cacheAddMethod & then method name.
for example. emp_ds.cacheAddMethod(methodstr(Emp,displayJobDescription))
emp_ds is datasource and displayJobDescription is the display method.

if we want to call it explicitly on the basis of some modifications of other fields, datasource_cacheCalculatedMethod is used.

a sample code can be downloaded from here.

Tuesday, December 22, 2009

how to create project and add AOT objects and groups in it.

can we create project by code and can add the AOT objects in the project & can we add groups?

Yes, we can do it easily. Find the attached xpo.

You can download a simple job from here