/// <summary> /// 解析方案格式 /// </summary> /// <param name="queryScheme"></param> /// <param name="sqlFormatContext"></param> /// <param name="layoutContext"></param> private void ParseFromString(string funcScheme, out string inputItemFmts, out string layoutContext) { Dictionary <string, string> layoutFmt = DictionaryJsonHelper.DeserializeStringToDictionary <string, string>(funcScheme); inputItemFmts = layoutFmt["录入格式"]; layoutContext = layoutFmt["布局格式"]; }
/// <summary> /// 解析方案格式 /// </summary> /// <param name="queryScheme"></param> /// <param name="sqlFormatContext"></param> /// <param name="layoutContext"></param> public void ParseFromString(string queryScheme, out string sqlFormatContext, out string layoutContext) { Dictionary <string, string> layoutFmt = DictionaryJsonHelper.DeserializeStringToDictionary <string, string>(queryScheme); sqlFormatContext = layoutFmt["查询格式"]; layoutContext = layoutFmt["布局格式"]; }
private void butDicts_Click(object sender, EventArgs e) { try { frmDictData dictDatas = new frmDictData(); Dictionary <string, string> dicts = null; if (string.IsNullOrEmpty(txtValue.Text) == false) { try { dicts = DictionaryJsonHelper.DeserializeStringToDictionary <string, string>(txtValue.Text); } catch { dicts = null; } } dicts = dictDatas.ShowDictConstructor(dicts, this); if (dicts == null) { return; } txtValue.Text = DictionaryJsonHelper.SerializeDictionaryToJsonString <string, string>(dicts); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
protected EventActionReleation(SerializationInfo info, StreamingContext context) { EventName = info.GetString("EventName"); ActType = (ActionType)(info.GetInt32("ActType")); Tag = info.GetString("Tag"); Actions = DictionaryJsonHelper.DeserializeStringToDictionary <string, ActionItem>(info.GetString("Actions")); }
public void LoadFromString(string inputItemFmts) { Dictionary <string, InputItem> inputs = DictionaryJsonHelper.DeserializeStringToDictionary <string, InputItem>(inputItemFmts); foreach (InputItem ii in inputs.Values) { Add(ii.Name, ii); } }
public void SetSerializableFmt(string fmt) { if (string.IsNullOrEmpty(fmt)) { return; } Dictionary <string, object> serial = DictionaryJsonHelper.DeserializeStringToDictionary <string, object>(fmt); if (serial.Count <= 0) { return; } try { if (serial.ContainsKey("BackColor")) { BackColor = Color.FromArgb(Convert.ToInt32(serial["BackColor"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("DesignEventSerialFmt")) { DesignEventSerialFmt = (string)serial["DesignEventSerialFmt"]; } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("CustomDesignFmt")) { CustomDesignFmt = (string)serial["CustomDesignFmt"]; } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("ForeColor")) { ForeColor = Color.FromArgb(Convert.ToInt32(serial["ForeColor"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("ImeMode")) { ImeMode = (ImeMode)(Convert.ToInt32(serial["ImeMode"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("TabIndex")) { TabIndex = Convert.ToInt32(serial["TabIndex"]); } } catch (Exception ex) { MsgBox.ShowException(ex); } }
static public void RestoreGridView(GridView gv, string fileName) { Dictionary <string, string> dic = null; using (StreamReader sr = new StreamReader(fileName)) { dic = DictionaryJsonHelper.DeserializeStringToDictionary <string, string>(sr.ReadToEnd()); } if (dic != null) { using (MemoryStream ms = new MemoryStream()) using (StreamWriter sw = new StreamWriter(ms)) { sw.Write(dic["layout"]); sw.Flush(); ms.Position = 0; gv.RestoreLayoutFromStream(ms); } } string fixs = dic["fix"]; foreach (string fix in (fixs + ",").Split(',')) { if (string.IsNullOrEmpty(fix)) { continue; } string[] fixPro = (fix + "-0").Split('-'); if (fixPro[1] == "1") { gv.Columns[fixPro[0]].Fixed = FixedStyle.Right; } else { gv.Columns[fixPro[0]].Fixed = FixedStyle.Left; } } }
public override IBizDataItems QueryDatas(string dataIdentificationName) { BizDataItems resultDatas = new BizDataItems(); BizDataItem dataItem = new BizDataItem(); string dataName = _provideDataDesc.FormatDataName(_moduleName, dataIdentificationName); if (dataName != TestDataDefine.CurTestData) { return(null); } List <TestDataItem> curDatas = null; if (_designDatas != null && _designDatas.Count > 0) { curDatas = _designDatas; } if (_localDatas != null && _localDatas.Count > 0) { curDatas = _localDatas; } foreach (TestDataItem di in curDatas) { if (di.数据类型 == "字符串") { dataItem.Add(di.数据名称, di.数据内容); } else if (di.数据类型 == "字典") { dataItem.Add(di.数据名称, DictionaryJsonHelper.DeserializeStringToDictionary <string, string>(di.数据内容)); } else { dataItem.Add(di.数据名称, "不能识别的数据类型"); } } resultDatas.Add(dataItem); return(resultDatas); }
public void SetSerializableFmt(string fmt) { if (string.IsNullOrEmpty(fmt)) { return; } Dictionary <string, object> serial = DictionaryJsonHelper.DeserializeStringToDictionary <string, object>(fmt); if (serial.Count <= 0) { return; } try { if (serial.ContainsKey("MaxWidth") && serial.ContainsKey("MaxHeight")) { MaximumSize = new Size(Convert.ToInt32(serial["MaxWidth"]), Convert.ToInt32(serial["MaxHeight"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("MinWidth") && serial.ContainsKey("MinHeight")) { MinimumSize = new Size(Convert.ToInt32(serial["MinWidth"]), Convert.ToInt32(serial["MinHeight"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("SizeWidth") && serial.ContainsKey("SizeHeight")) { Size = new Size(Convert.ToInt32(serial["SizeWidth"]), Convert.ToInt32(serial["SizeHeight"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("BackColor")) { BackColor = Color.FromArgb(Convert.ToInt32(serial["BackColor"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } //try { if (serial.ContainsKey("BackColor2")) BackColor2 = Color.FromArgb(Convert.ToInt32(serial["BackColor2"])); } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("BorderStyle")) { BorderStyle = (BorderStyle)(Convert.ToInt32(serial["BorderStyle"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } //try { if (serial.ContainsKey("GradientMode")) GradientMode = (LinearGradientMode)(Convert.ToInt32(serial["GradientMode"])); } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("DesignEventSerialFmt")) { DesignEventSerialFmt = (string)serial["DesignEventSerialFmt"]; } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("CustomDesignFmt")) { CustomDesignFmt = (string)serial["CustomDesignFmt"]; } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("RClickMenuDesignFmt")) { RClickMenuDesignFmt = (string)serial["RClickMenuDesignFmt"]; } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("ForeColor")) { ForeColor = Color.FromArgb(Convert.ToInt32(serial["ForeColor"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("ImeMode")) { ImeMode = (ImeMode)(Convert.ToInt32(serial["ImeMode"])); } } catch (Exception ex) { MsgBox.ShowException(ex); } try { if (serial.ContainsKey("TabIndex")) { TabIndex = Convert.ToInt32(serial["TabIndex"]); } } catch (Exception ex) { MsgBox.ShowException(ex); } }