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);
            }
        }
Пример #2
0
        public string GetSerializableFmt()
        {
            Dictionary <string, object> serial = new Dictionary <string, object>();

            serial.Add("MaxWidth", MaximumSize.Width);
            serial.Add("MaxHeight", MaximumSize.Height);
            serial.Add("MinWidth", MinimumSize.Width);
            serial.Add("MinHeight", MinimumSize.Height);
            serial.Add("SizeWidth", Size.Width);
            serial.Add("SizeHeight", Size.Height);

            serial.Add("BackColor", BackColor.ToArgb());
            //serial.Add("BackColor2", BackColor2.ToArgb());
            serial.Add("BorderStyle", BorderStyle);
            //serial.Add("GradientMode", GradientMode);
            serial.Add("DesignEventSerialFmt", DesignEventSerialFmt);

            serial.Add("CustomDesignFmt", CustomDesignFmt);
            serial.Add("RClickMenuDesignFmt", RClickMenuDesignFmt);
            serial.Add("ForeColor", ForeColor.ToArgb());
            serial.Add("ImeMode", ImeMode);

            serial.Add("TabIndex", TabIndex);

            return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, object>(serial));
        }
Пример #3
0
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("EventName", EventName);
            info.AddValue("ActType", (int)ActType);
            info.AddValue("Tag", Tag);

            info.AddValue("Actions", DictionaryJsonHelper.SerializeDictionaryToJsonString <string, ActionItem>(Actions));
        }
Пример #4
0
        /// <summary>
        /// 编辑属性值
        /// </summary>
        /// <param name="designParent"></param>
        /// <param name="instance"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static object EditValue(Control designParent, ISysDesign instance, object value)
        {
            using (frmProEventEditor form = new frmProEventEditor(designParent, instance, value))
            {
                form.ShowDialog(designParent);

                return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, EventActionReleation>(form.DesignEvents));// JsonConvert.SerializeObject(form.DesignEvents);
            }
        }
Пример #5
0
        public string GetSerializableFmt()
        {
            Dictionary <string, object> serial = new Dictionary <string, object>();

            serial.Add("BackColor", BackColor);
            serial.Add("DesignEventSerialFmt", DesignEventSerialFmt);

            serial.Add("CustomDesignFmt", CustomDesignFmt);
            serial.Add("ForeColor", ForeColor);
            serial.Add("ImeMode", ImeMode);
            serial.Add("TabIndex", TabIndex);

            return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, object>(serial));
        }
Пример #6
0
        public string GetStorageData()
        {
            if (_inputs == null || _inputs.Count <= 0)
            {
                return("");
            }

            Dictionary <string, object> values = new Dictionary <string, object>();

            foreach (InputItem ii in _inputs.Values)
            {
                if (ii.AllowStorage == false || ii.LinkControl == null)
                {
                    continue;
                }

                object value = null;
                switch (ii.ControlType)
                {
                case FuncConstDefine.Txt:
                    value = (ii.LinkControl as TextBox).Text;
                    break;

                case FuncConstDefine.RTxt:
                    value = (ii.LinkControl as RichTextBox).Text;
                    break;

                case FuncConstDefine.Cbx:
                    value = (ii.LinkControl as ComboBox).Text;
                    break;

                case FuncConstDefine.Dtp:
                    value = (ii.LinkControl as DateTimePicker).Value;
                    break;

                default:
                    break;
                }

                values.Add(ii.Name, value);
            }

            return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, object>(values));
        }
Пример #7
0
        /// <summary>
        /// 保存为格式串
        /// </summary>
        /// <returns></returns>
        public string SaveSchemeToString()
        {
            Dictionary <string, string> layoutFmt = new Dictionary <string, string>();

            layoutFmt.Add("查询格式", _queryCore.SourceSqlFmt);

            using (MemoryStream ms = new MemoryStream())
            {
                lcDemo.SaveLayoutToStream(ms);

                ms.Position = 0;

                StreamReader sr = new StreamReader(ms);

                layoutFmt.Add("布局格式", sr.ReadToEnd());
            }

            return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, string>(layoutFmt));
        }
Пример #8
0
        static public void SaveGridView(GridView gv, string fileName)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                gv.SaveLayoutToStream(ms);
                ms.Position = 0;

                Dictionary <string, string> dic = new Dictionary <string, string>();

                using (StreamReader sr = new StreamReader(ms))
                {
                    dic.Add("layout", sr.ReadToEnd());
                }

                string fix = "";
                foreach (GridColumn gc in gv.Columns)
                {
                    if (gc.Fixed != FixedStyle.None)
                    {
                        if (string.IsNullOrEmpty(fix) == false)
                        {
                            fix = fix + ",";
                        }
                        fix = fix + gc.FieldName + "-" + ((gc.Fixed == FixedStyle.Left) ? "0" : "1");
                    }
                }

                dic.Add("fix", fix);

                using (StreamWriter sw = new StreamWriter(fileName))
                {
                    string json = DictionaryJsonHelper.SerializeDictionaryToJsonString <string, string>(dic);
                    sw.Write(json);

                    sw.Flush();
                }
            }
        }
Пример #9
0
 public string SaveToString()
 {
     return(DictionaryJsonHelper.SerializeDictionaryToJsonString <string, InputItem>(this));
 }