Archive for the ‘.NET 3.0’ Category

FTP file upload in .NET 2.0

Friday, April 17th, 2009

It is clear that the FileUpload components, which can be found on the Standard toolbar of Visual Studio 2005 allows uploading files to the remote site, but does not cover all the expectations desired or at least not mine.
So it is interesting to know how we can attack a specific server and an FTP to copy the desired file to the remote location to stay.

To do this:

Step 1: In general declarations establish that the class will use.

C#

using System.Net;

VB.NET

Imports System.Net

Step 2: Create a button in the Click event and write the following code in C# or VB.NET:

C#

private static void wc_UploadFTP(string ftpServerPath, string filename, string username, string password)
 {
WebClient ClientFtp = new WebClient() ;
ClientFtp.Credentials = new NetworkCredential(username, password);
ClientFtp.UploadFile(ftpServerPath + "/" + new FileInfo(filename).Name, "STOR", filename);
}

VB.NET


Private Shared Sub wc_UploadFTP(ByVal ftpServerPath As String, ByVal filename As String, ByVal username As String, ByVal password As String)
 Dim ClientFtp As New WebClient()
 ClientFtp.Credentials = New NetworkCredential(username, password)
 ClientFtp.UploadFile((ftpServerPath & "/") + New FileInfo(filename).Name, "STOR", filename)
End Sub

Happy Programming!!

Intro To Windows Presentation Foundation (WPF)

Wednesday, March 25th, 2009

Windows Presentation Foundation (WPF) is the user interface subsystem which is included in .NET Framework 3.0. WPF clearly distinguishes user interface and logic offers the programming model which is consistent. WPF application can arrange and execute on the web browser it executes not only in the desktop. With WPF, user interface, the drawing and vector graphics of 2D and 3D object can utilize the expression technique such as raster graphics, animation, sound and playback etc of animated picture uniformly.
a
.NET Framework 3.0 can be preinstalled in Windows, Vista even with Windows XP SP2 and Windows Server 2003 can utilize.

Features

The following are some of the features of WPF.

Graphics

The window is included, all graphics are drawn through Direct3D.

Because of this, it is possible to utilize high-level graphics with single method.

It becomes possible to leave drawing processing to GPU on the video card, by drawing through Direct3D. This CPU would be to reduce the load.

Vector graphics is supported. This allows scaling without loss.

Rendering and interaction of the 3D model are supported.

Arrangement

WPF can arrange not only usual stand alone application, XAML browser application (XBAP) as.

Stand alone application is the application which is arranged on the local computer ClickOnce and Microsoft Windows Installer (MSI) and like by the installer.

XAML browser application (XBAP) it is the application which the host is done with the web browser of Internet Explorer and the like. Function of access and WPF to the computer resource is restricted part.

Interoperability

WPF offers the interoperation function of Win32. To utilize WPF from inside the cord/code of Win321, it is possible to utilize the cord/code of Win32 from WPF.

Also the interoperation of Windows Forms is possible, (ElementHost and WindowsFormsHost class).

Multimedia

WPF offers basic 2D graphic function such as brush, pen, geometric figure and deformation.

The 3D function which is offered with WPF is the subset of Direct3D. But, user interface (UI) and the like is possible with WPF from to utilize closely to the element. UI of 3D, the document and the media etc become possible with this.

The general picture format is supported.

The animated picture of WMV, MPEG and the AVI format is supported.

Time based animation is supported. This does not depend on the performance of the system and maintains the speed of animation uniformly.

The text rendering which utilizes ClearType is supported. In addition, it supports also the function of the OpenType font.

Data Binding

WPF supports the data binding of 3 types which are shown next.

one time: The client ignores the update on the server.

one way: The client has the authority of write inhibit vis-a-vis the data.

two way: The client has reading and entry both authority.

User Interface

The basic installation control such as the button, the menu and the list box etc is offered.

As the powerful point of WPF, it is possible to separate logic and interface completely.

Related Item

Microsoft Silverlight
Adobe Integrated Runtime

External link