/// <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);
}
}