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; } }
private void buttonOpen_Click(object sender, EventArgs e) { if (fileListBox.SelectedIndex != -1) { _remote_DataManager.ClientRequestTask(fileListBox.SelectedIndex); _selectedTask = _remote_DataManager.Task; this.DialogResult = DialogResult.OK; this.Close(); } }
/// <summary> /// Returns the current task /// </summary> /// <returns></returns> public static Task GetCurrentTask() { if (_currentTask == null) { ReadListOfTaskFiles(); SelectTaskFile(0); if (_currentTask == null) _currentTask = new Task(); } return _currentTask; }
/// <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 fileListBox_SelectedIndexChanged(object sender, EventArgs e) { if (saveMode) { _remote_DataManager.ClientRequestTask(fileListBox.SelectedIndex); textBoxNewTaskName.Text = _remote_DataManager.Task.FileName; } else { _remote_DataManager.ClientRequestTask(fileListBox.SelectedIndex); _selectedTask = _remote_DataManager.Task; textBoxDescription.Text = _selectedTask.TaskDescription; if (_selectedTask.PreviewImage != null) { pictureBox.Image = ByteArrayToImage(_selectedTask.PreviewImage); labelTaskPreview.Visible = false; } else { pictureBox.Image = null; labelTaskPreview.Visible = true; } } }
void Create_Edit_Session_Control_TaskSelect(Task task) { if (create_Edit_Session_Control.ShowDetailedTaskPreview) { ShowScheduledSessionControlButtons(); create_Edit_Session_Control.Visible = false; session_Details_Control.Visible = true; _patient.Sessions[_selectedSessionIndex].Clinician = CurrentClinician.NameString; _patient.Sessions[_selectedSessionIndex].Task = task; _remote_DataManager.ClientUpdatePatient(_patient, _selectedPatientIndex); FillInFields(); session_Details_Control.Session = _patient.Sessions[_selectedSessionIndex]; for (int i = 0; i < listViewSessions.Items.Count; i++) { if (Int32.Parse(listViewSessions.Items[i].SubItems[listViewSessions.Columns.Count].Text) == _selectedSessionIndex) listViewSessions.Items[i].Selected = true; } ShowScheduledSessionControlButtons(); session_Details_Control.ReadOnlyNotes = false; } else create_Edit_Session_Control.ShowDetailedTaskPreview = true; }
/// <summary> /// Selects the specified task (after a short delay to ensure the panel size has setup correct for it to scroll) /// </summary> /// <param name="task"></param> public void DelayedSelectTask(Task task) { _taskToSelect = task; _delayedSelectTaskTimer.Start(); }
void Task_Designer_Remote_Control_EditTaskRequest(Task task) { _currentTask = task; m_objectsToDraw.ObjectsToDraw = _currentTask.ObjectList; }
private void openExistingTaskToolStripMenuItem_Click(object sender, EventArgs e) { if (readOnlyPlaybackMode == false) { TaskFileBrowser taskFileDialog = new TaskFileBrowser(_remote_DataManager, null); if (taskFileDialog.ShowDialog() != DialogResult.Cancel) { _currentTask = taskFileDialog.Task; m_objectsToDraw.ObjectsToDraw = _currentTask.ObjectList; } } else MessageBox.Show("Cannot moddify the current task.", "Playback mode enabled.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
static void Remote_DataManager_TaskSaveRequestedByClient(Task newTask) { if (SaveTaskFile(newTask)) SetCurrentTask(newTask); }
/// <summary> /// Saves a task file to disk /// </summary> /// <param name="task"></param> /// <returns></returns> private static bool SaveTaskFile(Task task) { bool saveSucceeded = false; string filePath = _taskDIR + task.FileName + FILE_EXTENTION; try { FileStream fs = new FileStream(filePath, FileMode.Create); BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(fs, task); fs.Close(); saveSucceeded = true; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Save Unsuccesful. System Message: " + ex.Message); } finally { if (saveSucceeded) { // System.Windows.Forms.MessageBox.Show("File Saved", "Save Successful"); } } return saveSucceeded; }
/// <summary> /// Sets the task for the client /// </summary> /// <param name="task"></param> public void ServerSetTask(Task task) { _currentTask = task; }
/// <summary> /// Saves a task from the client onto the server /// </summary> /// <param name="newTask"></param> public void ClientRequestSaveTask(Task newTask) { if (TaskSaveRequestedByClient != null) TaskSaveRequestedByClient(newTask); }
/// <summary> /// Selects a specific task /// </summary> /// <param name="task"></param> private void SelectTask(Task task) { ClearSelection(); foreach (Task_Preview_Control tpc in flowLayoutPanelTasks.Controls) { if (tpc.Task.FileName.CompareTo(task.FileName) == 0) { SelectTask_Preview_Control(tpc); flowLayoutPanelTasks.ScrollControlIntoView(tpc); _mouseWheelGuiUpdateTimer.Start(); break; } } }
/// <summary> /// Sets the current task /// </summary> /// <param name="task">The task</param> /// <param name="readOnly">Is it a read only task</param> public static void SetCurrentTask(Task task) { _currentTask = task; _remote_DataManager.ServerSetTask(task); }
private void createANewTaskToolStripMenuItem_Click(object sender, EventArgs e) { _currentTask = _defaultTask; m_objectsToDraw.ObjectsToDraw = _currentTask.ObjectList; }
/// <summary> /// Creates a new session based on the supplied task /// </summary> /// <param name="task"></param> private void CreateNewSession(Task task) { if (CurrentClinician.ScheduleSessions) { Session newSession = new Session(); newSession.Task = task; newSession.Clinician = CurrentClinician.NameString; // Add _patient.AddSession(newSession); _remote_DataManager.ClientUpdatePatient(_patient, _selectedPatientIndex); _remote_DataManager.ClientRequestUpdatedPatientList(); FillInListViewSessions(); if(session_Details_Control.Visible) buttonBack_Click(null, null); } else MessageBox.Show(StroMoHab_Client.Properties.Settings.Default.InvalidPermissionsString, "StroMoHab Client", MessageBoxButtons.OK, MessageBoxIcon.Error); }
/// <summary> /// Forces the Task Designer to get the current task from the Server /// This is used when in playback mode /// </summary> public void GetCurrentTaskFromServer() { _currentTask = _remote_DataManager.Task; try { m_objectsToDraw.ObjectsToDraw = _currentTask.ObjectList; } catch { Externals.LoadVisualiser(m_objectsToDraw); MessageBox.Show("Loading Visualiser...\nPress Ok when Done."); m_objectsToDraw.ObjectsToDraw = _currentTask.ObjectList; } }
private void LoadTaskDeisnger(Task task) { MessageBox.Show("Edit the task in the Task Desinger.\nOnce finished, save the task and close the Task Designer.", "StroMoHab Client", MessageBoxButtons.OK, MessageBoxIcon.Information); //Todo - connect to task designer and pass it task (if task==null then it should make a new task based on the default task) }
/// <summary> /// Accepts the task set by the server /// </summary> /// <param name="task"></param> /// <param name="readOnly"></param> void Remote_DataManager_TaskSetByServer(Task task, bool readOnly) { m_objectsToDraw.ObjectsToDraw = task.ObjectList; readOnlyPlaybackMode = readOnly; }
private void OnTaskSelect(Task task) { if (TaskSelect != null) TaskSelect(task); }