public TaskFileBrowser(Task_Remote_DataManager remote_dataManager, Task taskToSave)
        {
            _remote_DataManager = remote_dataManager;
            InitializeComponent();

            buttonGetList_Click(null, null);

            if (taskToSave == null) // Open Mode
            {
                buttonNewTask.Enabled       = false;
                textBoxNewTaskName.Enabled  = false;
                textBoxDescription.ReadOnly = true;
            }
            else // save mode
            {
                saveMode = true;
                textBoxNewTaskName.Text = taskToSave.FileName;
                textBoxDescription.Text = taskToSave.TaskDescription;
                buttonOpen.Enabled      = false;
                _selectedTask           = taskToSave;

                pictureBox.Image         = ByteArrayToImage(_selectedTask.PreviewImage);
                labelTaskPreview.Visible = false;
            }
        }
        public TaskFileBrowser(Task_Remote_DataManager remote_dataManager, Task taskToSave)
        {
            _remote_DataManager = remote_dataManager;
            InitializeComponent();
            
            buttonGetList_Click(null, null);

            if (taskToSave == null) // Open Mode
            {
                buttonNewTask.Enabled = false;
                textBoxNewTaskName.Enabled = false;
                textBoxDescription.ReadOnly = true;
            }
            else // save mode
            {
                saveMode = true;
                textBoxNewTaskName.Text = taskToSave.FileName;
                textBoxDescription.Text = taskToSave.TaskDescription;
                buttonOpen.Enabled = false;
                _selectedTask = taskToSave;

                pictureBox.Image = ByteArrayToImage(_selectedTask.PreviewImage);
                labelTaskPreview.Visible = false;
            }
        }
        public Create_Edit_Session_Control()
        {
            InitializeComponent();
            
            //Intercept the mouse wheel
            flowLayoutPanelTasks.MouseWheel += new MouseEventHandler(flowLayoutPanelTasks_MouseWheel);

            //A slight delay is required after the mouse wheel event
            _mouseWheelGuiUpdateTimer.Interval = 50;
            _mouseWheelGuiUpdateTimer.Tick += new EventHandler(_mouseWheelGuiUpdateTimer_Tick);

            //timer to delay selecting a task to allow time for the panel to resize
            _delayedSelectTaskTimer.Interval = 300;
            _delayedSelectTaskTimer.Tick += new EventHandler(_delayedSelectTaskTimer_Tick);

            

            //Fill out combobox
            foreach (Task.TaskTypeType type in Enum.GetValues(typeof(Task.TaskTypeType)))
            {
                comboBoxType.Items.Add(Task.GetEnumDescription(type));
            }
            comboBoxType.SelectedIndex = 0;
            foreach (Task.DistanceRangeType type in Enum.GetValues(typeof(Task.DistanceRangeType)))
            {
                comboBoxDistance.Items.Add(Task.GetEnumDescription(type));
            }
            comboBoxDistance.SelectedIndex = 0;
            foreach (Task.NumberOfObjectsRangeType type in Enum.GetValues(typeof(Task.NumberOfObjectsRangeType)))
            {
                comboBoxNumObjects.Items.Add(Task.GetEnumDescription(type));
            }
            comboBoxNumObjects.SelectedIndex = 0;

            //connect to the server via remoting
            if (TCPProcessor.ConnectedToServer)
            {
                _remote_Data_Manager = (Task_Remote_DataManager)Activator.GetObject(typeof(Task_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005, "TaskRemoteDataManagerConnection"));
                
            }

            //Setup the detailed task preview
            task_Detailed_Preview_Control.Visible = false;
            task_Detailed_Preview_Control.Dock = DockStyle.Fill;
            this.Controls.Add(task_Detailed_Preview_Control);
        }
        /// <summary>
        /// Main Task Designer Form.
        /// </summary>
        public Form_TaskDesigner()
        {
            InitializeComponent();

            m_objectsToDraw = (StromoLight_RemoteDrawingList.DrawingList)Activator.GetObject(typeof(StromoLight_RemoteDrawingList.DrawingList), "tcp://localhost:8002/TaskDesignerConnection");
            m_prevHeight = this.numericUpDownObjectHeight.Value;
            
            Connect();
            //Set up getting tasks from server
            
            remote_DataManager = (Task_Remote_DataManager)Activator.GetObject(typeof(Task_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005,"TaskRemoteDataManagerConnection"));
            
            //make the default task
            _defaultTask = new Task();
            Corridor corridor = new Corridor(-1.5f, 0.0f, 4.0f, 1.5f, 6.0f, -500.0f);
            _defaultTask.ObjectList.Add(corridor);
           
        }
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (TCPProcessor.ConnectedToServer)
     {
         _remote_Data_Manager = (Task_Remote_DataManager)Activator.GetObject(typeof(Task_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005, "TaskRemoteDataManagerConnection"));
         _remote_Data_Manager.ClientRequestTaskList();
         UpdateListOfTasks();
         GenerateTaskControls();
         OnSelectionStateChanged(false);
     }
 }