//Сохранение предыдущего выбранного параметра в таблицу private void SaveParam() { if (_cells != null) { try { var ac = LinkCellAction.Text.ToCellAction(); string field = ac != CellActionType.Text ? CellField.Text : ""; int ix = LinkX.Text.ToInt(); int iy = LinkY.Text.ToInt(); _cells["CellAction"].Value = LinkCellAction.Text; _cells["Field"].Value = ac != CellActionType.Text ? CellField.Text : ""; _cells["X"].Value = ix.ToString(); _cells["Y"].Value = iy.ToString(); string codeForming = (WriteText.Visible ? WriteText.Text : LinkCodeForming.Visible ? LinkCodeForming.Text : "") ?? "<Полный код>"; _cells["CodeForming"].Value = codeForming; string s = "CodeForming=" + codeForming + ";CellAction=" + LinkCellAction.Text + ";Field=" + field + ";X=" + ix + ";Y=" + iy + ";"; if (ac == CellActionType.Save) { s += "LinkType=Сохранение"; } else if (ac != CellActionType.Text && field.ToLinkField().IsValueField()) { s += LinkPropsPanel.PropsString(); if (LinkPropsPanel.LinkPropsError != "") { Different.MessageError(LinkPropsPanel.LinkPropsError, "Не правильно заполнены поля"); } } _cells["Props"].Value = s; _cells["LinkType"].Value = !LinkPropsPanel.Visible ? "" : LinkPropsPanel.CellLinkType.Text; } catch { } } }
//Вызывается при изменении типа информации ссылки private void ApplyLinkField() { if (_cells != null) { var dic = _cells.Get("Props").ToPropertyDictionary(); var ac = LinkCellAction.Text.ToCellAction(); if (CellField.Text.ToLinkField().IsValueField() && ac != CellActionType.Save && ac != CellActionType.Text) { LinkPropsPanel.Visible = true; LinkPropsPanel.PropsFromDic(dic); } else { LinkPropsPanel.Visible = false; } } }
//Загрузка нового выбранного параметра из таблицы private void LoadParam() { _cells = TemplateGrid.CurrentRow == null ? null : TemplateGrid.CurrentRow.Cells; try { var dic = (_cells == null ? "" : _cells.Get("Props")).ToPropertyDictionary(); LinkCellAction.Text = dic.Get("CellAction", CellActionType.Link.ToRussian()); LinkCodeForming.Text = WriteText.Text = dic.Get("CodeForming", "<Полный код>"); ApplyCellAction(); CellField.Text = dic.Get("Field", "Значение"); ApplyLinkField(); LinkX.Text = dic.Get("X", "0"); LinkY.Text = dic.Get("Y", "0"); if (LinkPropsPanel.Visible) { LinkPropsPanel.PropsFromDic(dic); } } catch { } }