Türkçe   |   English
Calendar
ArticleCategories
Article Archive
Most Read Articles
Links
Blogroll
Files

Palantir - Remote Desktop Manager
Publish Date 02.09.2007
Categories C#
Views 2536
Summary
Palantir is an application that allows users to manage remote desktop connections in one window. It also allows users to save existing connections for later use.

The remote desktop connections are managed with Microsoft RDP Client control. This control has all of the properties such as Server, UserName, Domain etc. in order to set up a remote desktop connection. In addition to these properties, sharing printers, disk drives or color depth of the remote desktop can be managed via RDP Client control. Palantir enables users to create a remote desktop connection and save connection settings for later use. Users can also choose to start a remote desktop connection automatically when the application starts.
 

The settings can be saved into a file and restored from a setting file. Users can also connect to a computer via console. The application has a class named Machine that stores a remote desktop connection's properties. All of the remote connections created by user is stored in application's .settings file. This setting file has a property setting named MyMachine and it's type is string. This property is converted into Hashtable while getting the settings. Palantir's solution consists of four projects which are GUI, Helper, BusinessObjects and a setup project.

The remote desktop connections are retrieved by the function below.

public List<Machine> GetRemoteDesktops()        
{            
    List<Machine> lstMachine = new List<Machine>();            
    if (Settings.Default.MyMachine != "")            
    {                
        Hashtable ht = (Hashtable)BinarySerializer.BinaryTo(Settings.Default.MyMachine);                
        foreach (DictionaryEntry de in ht)                    
        {                    
            Machine insMachine = (Machine)de.Value;                     
            lstMachine.Add(insMachine);                
        }            
    }              
    lstMachine.Sort(delegate(Machine m1, Machine m2) { return m1.RemoteDesktopConnectionName.CompareTo(m2.RemoteDesktopConnectionName); });            
    return lstMachine;        
}

As seen in the code, this function deserializes the setting named MyMachine into a hashtable and inserts each dictionary entry in the hashtable into a list and returns the list. A remote desktop connection is saved and edited by the function below.

public bool SaveRemoteDesktop(Machine parMachine, bool openedForEdit)        
{            
    if (Settings.Default.MyMachine == "")            
    {                
        Hashtable ht = new Hashtable();                
        Settings.Default.MyMachine = BinarySerializer.ToBinary(ht);                
        Settings.Default.Save();            
    }            
    Hashtable ht1 = (Hashtable)BinarySerializer.BinaryTo(Settings.Default.MyMachine);            
    if (!parMachine.SavePassword)            
    {                
        parMachine.Password = "";            
    }              
    if (!openedForEdit)            
    {                
        foreach (DictionaryEntry de in ht1)                
        {                    
            if (((Machine)de.Value).RemoteDesktopConnectionName == parMachine.RemoteDesktopConnectionName)                    
            {                        
                MessageBox.Show("There is already a
remote connection with the same name.");                        
                return false;                    
            }                
        }            
    }              
    ht1[parMachine.RemoteDesktopConnectionName] = parMachine;            
    Settings.Default.MyMachine = BinarySerializer.ToBinary(ht1);            
    Settings.Default.Save();            
    return true;        
}

If there's no currently saved remote desktop connection, we create a new hashtable and then serialize and save the settings file. After that we deserialize the settings parameter into a hashtable and after checking if there's another connection with the same name, we save the remote desktop connection with the function's parameter Machine object. The methods below set the RDP Client control's settings and connect to the remote desktop which is passed as parameter.

private void SetRdpClientProperties(Machine parMachine)        
{            
    rdpc.Server = parMachine.MachineName;            
    rdpc.UserName = parMachine.UserName;            
    rdpc.Domain = parMachine.DomainName;            
    if (parMachine.Password != "")            
    {                 
        rdpc.AdvancedSettings5.ClearTextPassword = parMachine.Password;            
    }            
    rdpc.AdvancedSettings5.RedirectDrives = parMachine.ShareDiskDrives;            
    rdpc.AdvancedSettings5.RedirectPrinters = parMachine.SharePrinters;            
    rdpc.ColorDepth = (int)parMachine.ColorDepth;            
    rdpc.Dock = DockStyle.Fill;          
}
public void Connect(Machine parMachine)        
{            
    SetRdpClientProperties(parMachine);            
    rdpc.Connect();        
}          
public void ConnectViaConsole(Machine parMachine)        
{            
    rdpc.AdvancedSettings5.ConnectToServerConsole = true;            
    SetRdpClientProperties(parMachine);              
    rdpc.Connect();        
}
CodeProject

04.12.2009 - David Tan
I have been using your program. I really have to say I love it very much. But I ran into a problem recently that i forgot the password of my saved settings. How could i reset the password?

07.09.2009 - james
i can't run your program honestly but your program is interested.. tnx

30.07.2009 - ramin AVK
merheba sizinle tanismama cok memnun oldum benim ismim ramin irandanim ama AZERI TURKum bende bilgisayar muhendisligi okuyorum ve bu sene yuksek lisans icin turkiyeye gelecem sizinle tanisdigima cok memnun oldum lutfen bana E-mail addressinizi gonderin

09.07.2009 - Bymik
thx for this Remote Desktop, very goooood aplikation. IT with 15 servers and 250 PC

08.01.2009 - Rakesh
Improve grafics

06.01.2009 - /Register.asmx
/Register.asmx
/Register.asmx

02.12.2008 - nirav pandya
i could not run your program

02.12.2008 - nirav pandya
I could not find AxMSTSCLib.AxMsRdpClient4 latest dll in your, you are not provide latest dll in your project posted in code project. please send me latest dll , i need urgently, thanks

30.04.2008 - isaac rainsford
nice program! who made the interop and axinterop dll? are they opensourcE?
Add Comment
First Name Last Name
Web Site
E-Mail
Comment
Security Picture

Photos
Me in MSDN Forums
-   Answered the question How can i get it in the Visual C# General forum
-   Answered the question How to add the VAT to the ammount in the Visual Basic General forum
-   Contributed a proposed answer to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Replied to the question How can i get it in the Visual C# General forum
-   Replied to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Answered the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Contributed a proposed answer to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Answered the question Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Contributed a helpful post (total votes:1) to the forums thread Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Replied to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
Entries
News
Articles