/// <summary> /// Setup dialog with the information from the current log input. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dialog_Load(object sender, EventArgs e) { tb_MatlabName.Text = logInput.getKeyVariableName(); if (logInput.getAbsoluteTime() != null) { string[] absolute = logInput.getAbsoluteTime(); startDTP.Text = absolute[0]; endDTP.Text = absolute[1]; } else { startDTP.Text = logInput.getTimeRange().StartTime.ToString(); endDTP.Text = logInput.getTimeRange().EndTime.ToString(); } string path = logInput.getPath(); if (path.Contains("EventFrames")) //Cannot Edit Event Frames Time { startDTP.Enabled = false; endDTP.Enabled = false; } else { startDTP.Enabled = true; endDTP.Enabled = true; } }
/// <summary> /// Resulting Action of editting the List View. /// 1) Edit the List Item /// 2) Re-log the item /// 3) Edit the Matlab workspace. /// </summary> /// <param name="name"> The new variable name. (or the same)</param> /// <param name="start"> The new start time. (or the same)</param> /// <param name="end"> The new end time. (or the same)</param> /// <param name="previous"></param> public void EditLog(string name, string start, string end, LogInput previous) { MatlabAccess.removeMatlabVariable(previous.getKeyVariableName()); if (previous.getKeyVariableName() != name) { name = MatlabAccess.modifyMatlabName(name); } if (name == string.Empty) { name = previous.getKeyVariableName(); } string attName = previous.getAttribute(); string path = previous.getPath(); string elem = previous.getElement(); //EDIT LIST VIEW if (AFAccess.isAbsoluteTimeString(start, end, previous)) { lv_LogDialog.SelectedItems[0].SubItems[3].Text = start + " = " + end; lv_LogDialog.SelectedItems[0].Text = name; } else { AFTimeRange range = new AFTimeRange(start, end); lv_LogDialog.SelectedItems[0].SubItems[3].Text = range.ToString(); lv_LogDialog.SelectedItems[0].Text = name; } //EDIT ACTUAL LOG LogSystem.removeLogInput(previous.getKeyVariableName(), previous.getServerDatabase()); //Workspace Edit - remove variable, getNewData if (path == "PI.Point") { string[] info = Regex.Split(previous.getServerDatabase(), "'"); control.getPIData(attName, info[1], name, start, end, false); } else { control.getAFData(previous.getServerDatabase(), attName, name, path, start, end, false); } }
/// <summary> /// Resulting Action of editting the List View. /// 1) Edit the List Item /// 2) Re-log the item /// 3) Edit the Matlab workspace. /// </summary> /// <param name="name"> The new variable name. (or the same)</param> /// <param name="start"> The new start time. (or the same)</param> /// <param name="end"> The new end time. (or the same)</param> /// <param name="previous"></param> public void EditLog(string name, string start, string end, LogInput previous) { MatlabAccess.removeMatlabVariable(previous.getKeyVariableName()); if(previous.getKeyVariableName() != name) name = MatlabAccess.modifyMatlabName(name); if (name == string.Empty) name = previous.getKeyVariableName(); string attName = previous.getAttribute(); string path = previous.getPath(); string elem = previous.getElement(); //EDIT LIST VIEW if (AFAccess.isAbsoluteTimeString(start, end, previous)) { lv_LogDialog.SelectedItems[0].SubItems[3].Text = start + " = " + end; lv_LogDialog.SelectedItems[0].Text = name; } else { AFTimeRange range = new AFTimeRange(start, end); lv_LogDialog.SelectedItems[0].SubItems[3].Text = range.ToString(); lv_LogDialog.SelectedItems[0].Text = name; } //EDIT ACTUAL LOG LogSystem.removeLogInput(previous.getKeyVariableName(), previous.getServerDatabase()); //Workspace Edit - remove variable, getNewData if (path == "PI.Point") { string[] info = Regex.Split(previous.getServerDatabase(), "'"); control.getPIData(attName, info[1], name, start, end,false); } else control.getAFData(previous.getServerDatabase(), attName, name, path, start, end, false); }