private void frmInputFixedList_Load(object sender, EventArgs e)
        {
            if (this.DialogData == null)
            {
                this.DialogData = new inputFixedList();
            }

            ItemTypeBindingList.Clear();

            if (this.DialogData.listValues != null)
            {
                foreach (itemType itmType in this.DialogData.listValues)
                {
                    itemType newIt = ItemTypeBindingList.AddNew();
                    itmType.PoplulateOther(newIt);
                    newIt.Parent = ItemTypeBindingList;
                }
            }

            this.listValuesBindingSource.DataSource = ItemTypeBindingList;
            this.UcPlaceholder.FieldText            = DialogData.placeholder;
            this.UcDialogTitle.FieldText            = DialogData.dialogtitle;
            this.UcDialogText.FieldText             = DialogData.dialogtext;
        }
Пример #2
0
        private void WriteReplacementInputFixedList(inputFixedList rep)
        {
            try
            {
                if (rep.listValues == null || rep.listValues.Length == 0)
                {
                    return;
                }
                string strList = string.Empty;
                foreach (var li in rep.listValues)
                {
                    if (li.defaultSpecified == true && li.@default == defaultType.@true)
                    {
                        strList = strList + li.Value + "||"; // Double || makes the this item be selected
                    }
                    else
                    {
                        strList = strList + li.Value + "|";
                    }
                }

                w.Write(@"varList");
                w.Write(" := \"");
                w.Write(strList);
                w.WriteLine("\"");

                w.Write(@"varListResult");
                w.Write(" := ");
                w.Write("cInputListLong(\"");
                w.Write(rep.dialogtitle);
                w.Write("\", \"");
                w.Write(rep.dialogtext);
                w.Write("\", ");
                w.Write(@"varList");
                w.WriteLine(")");

                w.Write(@"if(MfString.IsNullOrEmpty(");
                w.Write(@"varListResult");
                w.WriteLine("))");
                w.WriteLine(bo);
                w.Indent++;
                w.WriteLine("return");
                w.Indent--;
                w.WriteLine(bc);

                w.Write("varCode");
                w.Write(" := ");
                w.Write(@"Mfunc.StringReplace(");
                w.Write(@"varCode");
                w.Write(", \"");
                w.Write(rep.placeholder);
                w.Write("\", ");
                w.Write(@"varListResult");
                w.WriteLine(", 1)");
            }
            catch (Exception)
            {
                if (this.ExitReason == ExitCodeEnum.NotSet)
                {
                    this.ExitReason = ExitCodeEnum.HsWriteReplacementInputFixedList;
                }
                throw;
            }
        }