private int GetControlCount(EbMobileControl ctrl, Dictionary <string, int> counter) { string name = ctrl.GetType().Name; counter[name] = counter.ContainsKey(name) ? counter[name]++ : 0; return(counter[name]); }
private void CreateOrUpdateControl(EbWebForm webForm, List <EbControl> flatControls, EbMobileControl ctrl, Dictionary <string, int> counter) { EbControl control = flatControls.Find(c => c.Name == ctrl.Name); if (control != null) { string cType = control.GetType().Name; if (!counter.ContainsKey(cType)) { counter[cType] = 0; } try { MatchCollection cmatch = CounterRegex.Matches(control.EbSid); if (cmatch.Count > 0) { int c = Convert.ToInt32(cmatch.LastOrDefault().Value); counter[cType] = counter[cType] < c ? c : counter[cType]; } } catch (Exception ex) { counter[cType]++; Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } ctrl.UpdateWebFormControl(control); } else { string name = ctrl.EbControlType; counter[name] = counter.ContainsKey(name) ? ++counter[name] : 0; webForm.Controls.Add(ctrl.GetWebFormControl(counter[name])); } }