Example #1
0
 public AddItemForm(ACA.LabelX.Label.Label.Value item)
     : this()
 {
     idtxt.Text            = item.Key;
     idtxt.Enabled         = false;
     valuetxt.Text         = item.Data;
     languagecombo.Enabled = false;
 }
Example #2
0
        private void LuaVarsToLabel(Dictionary <string, string> LabelVariablesDict, ACA.LabelX.Label.Label currentLabel, ACA.LabelX.Label.Label defaultLabel, ACA.LabelX.Label.Label baseLabel, ACA.LabelX.Label.Label staticVarsLabel, Dictionary <string, string> LuaVariablesDict, Lua lua)
        {//Converts Dictionary with lua variable names back to their labels
            foreach (KeyValuePair <string, string> pair in LuaVariablesDict)
            {
                ACA.LabelX.Label.Label labelToUse = null;
                if (pair.Key.StartsWith("cl_"))
                {
                    labelToUse = currentLabel;
                }
                else if (pair.Key.StartsWith("dl_"))
                {
                    labelToUse = defaultLabel;
                }
                else if (pair.Key.StartsWith("bl_"))
                {
                    labelToUse = baseLabel;
                }
                else if (pair.Key.StartsWith("staticvar_"))
                {
                    labelToUse = staticVarsLabel;
                }
                if (labelToUse != null)
                {
                    ACA.LabelX.Label.Label.Value value;
                    string labelPrintNaam;

                    if (LabelVariablesDict.TryGetValue(pair.Key, out labelPrintNaam))
                    {
                        if (labelToUse.Values.TryGetValue(labelPrintNaam, out value))
                        {
                            string luaValue = lua[pair.Key].ToString();

                            if (luaValue != null)
                            {
                                value.Data = luaValue;
                            }

                            /* mve fix
                             * if (!string.IsNullOrEmpty(luaValue))
                             * {
                             *  value.Data = luaValue;
                             * }
                             */
                        }
                    }
                    else if (pair.Key.StartsWith("staticvar_")) //If the key doesn't exist but is a staticvar, add it
                    {
                        string[] stringAr = pair.Key.Split('_');
                        if (isInteger(stringAr[stringAr.Length - 1])) //If last part isn't a language code, don't bother
                        {
                            string languagecode = stringAr[stringAr.Length - 1];
                            string variableName = "";
                            for (int i = 1; i < stringAr.Length - 1; i++)
                            {
                                variableName = variableName + stringAr[i] + '_';
                            }
                            variableName = variableName.Substring(0, variableName.Length - 1);
                            variableName = variableName + '.' + languagecode;

                            ACA.LabelX.Label.Label.Value tempvalue = new ACA.LabelX.Label.Label.Value();
                            tempvalue.Type = "xs:string";
                            tempvalue.Key  = variableName;
                            tempvalue.Data = pair.Value;
                            KeyValuePair <string, ACA.LabelX.Label.Label.Value> tempKeyValuePair = new KeyValuePair <string, ACA.LabelX.Label.Label.Value>(variableName, tempvalue);
                            labelToUse.Values.Add(tempKeyValuePair);
                        }
                    }
                }
            }
        }