Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C#

Palantir - Remote Desktop Manager

Rate me:
Please Sign up or sign in to vote.
4.90/5 (93 votes)
6 Aug 2007CPOL2 min read 489.5K   65.6K   315  
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.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using BusinessObjects;

namespace Palantir
{
    public partial class uctRemoteConnectionSettings : UserControl
    {
        public uctRemoteConnectionSettings()
        {
            InitializeComponent();
            cmbColorDepth.DataSource = Enum.GetValues(typeof(Machine.Colors));
        }

        public Machine GetMachineSettings()
        {
            Machine insMachine = new Machine();
            if (ValidateMachineSettings())
            {
                insMachine.AutoConnect = chkAutoConnect.Checked;
                insMachine.ColorDepth = (Machine.Colors)cmbColorDepth.SelectedItem;
                insMachine.DomainName = txtDomainName.Text;
                insMachine.MachineName = txtMachineName.Text;
                insMachine.SavePassword = chkSavePassword.Checked;
                insMachine.Password = txtPassword.Text;
                insMachine.ShareDiskDrives = chkShareDiskDrives.Checked;
                insMachine.SharePrinters = chkSharePrinters.Checked;
                insMachine.UserName = txtUserName.Text;
                return insMachine;
            }
            return null;
        }

        public void SetMachineSettings(Machine parMachine)
        {

            chkAutoConnect.Checked = parMachine.AutoConnect;
            cmbColorDepth.SelectedItem = parMachine.ColorDepth;
            txtDomainName.Text = parMachine.DomainName;
            txtMachineName.Text = parMachine.MachineName;
            txtPassword.Text = parMachine.Password;
            chkSavePassword.Checked = parMachine.SavePassword;
            chkShareDiskDrives.Checked = parMachine.ShareDiskDrives;
            chkSharePrinters.Checked = parMachine.SharePrinters;
            txtUserName.Text = parMachine.UserName;
        }

        public bool ValidateMachineSettings()
        {
            string errorMessage = "";
            if (txtMachineName.Text == "")
            {
                errorMessage += "Please fill in the Machine Name.";
                
            }
            if (txtUserName.Text == "")
            {      
                errorMessage += "\r\n Please fill in the User Name.";
                
            }
            if (errorMessage != "")
            {
                MessageBox.Show(errorMessage);
                return false;
            }
            return true;

        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Turkey Turkey
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions