private void FindAll(AutomationElement automationElement, InitializeOption option) { var finder = new AutomationElementFinder(automationElement); List <AutomationElement> children = finder.Children(AutomationSearchCondition.All); ControlDictionary controlDictionary = ControlDictionary.Instance; foreach (AutomationElement child in children) { if (!controlDictionary.IsControlTypeSupported(child.Current.ControlType)) { continue; } if (controlDictionary.IsPrimaryControl(child.Current.ControlType, child.Current.ClassName, null)) { list.Add(child); } if (!controlDictionary.HasPrimaryChildren(child.Current.ControlType)) { continue; } if (!controlDictionary.IsExcluded(child.Current.ControlType)) { FindAll(child, option); } } }
public T Get <T>(string name) where T : System.Windows.Forms.Control { string key = name + typeof(T).Name; if (!ControlDictionary.ContainsKey(key)) { throw new System.ArgumentException("Control " + key + " not found!", "name"); } return(ControlDictionary[key] as T); }
public string GetDeleteQuery() { string query = string.Empty; if (ControlDictionary == null || !ControlDictionary.Any()) { ControlDictionary = ChildControls.ToControlDictionary(); } foreach (var pair in ControlDictionary) { if (pair.Value is ILinesEnabled grid) { query += $"DELETE FROM {grid.TableName} WHERE {this.TableName}_id = (SELECT id FROM {this.TableName} WHERE STRFTIME('%Y%m%d', eb_created_at_device) < @strdate AND eb_synced <> {(int)DataSyncStatus.NotSynced});"; } } return(query + $"DELETE FROM {this.TableName} WHERE STRFTIME('%Y%m%d', eb_created_at_device) < @strdate AND eb_synced <> {(int)DataSyncStatus.NotSynced}; "); }
public string GetQuery() { List <string> colums = new List <string> { "eb_device_id", "eb_appversion", "eb_created_at_device", "eb_retry_count", "eb_loc_id", "id" }; if (ControlDictionary == null || !ControlDictionary.Any()) { ControlDictionary = ChildControls.ToControlDictionary(); } foreach (var pair in ControlDictionary) { if (!(pair.Value is INonPersistControl) && !(pair.Value is ILinesEnabled)) { colums.Add(pair.Value.Name); } } colums.Reverse(); return(string.Join(",", colums.ToArray())); }
/// <summary> /// set child visibility for choice control /// </summary> /// <param name="parentControl"></param> private void SetChildrenVisibilityForControl(Control parentControl, int currentVisiableLayer) { ControlDesignerInfo controlDesignerInfo = parentControl.Tag as ControlDesignerInfo; if (controlDesignerInfo != null && controlDesignerInfo.LinkedIds != null) { foreach (int controlId in controlDesignerInfo.LinkedIds) { if (ControlDictionary.ContainsKey(controlId)) { Control linkedControl = ControlDictionary[controlId]; if (ComponentsDictionary.ContainsKey(linkedControl)) { int valueLayer = (int)ComponentsDictionary[linkedControl].PropertiesDescriptors[Constants.WinPropLayer].GetValue(linkedControl); if (parentControl.Visible) { PropertyDescriptor prop = ComponentsDictionary[linkedControl].PropertiesDescriptors[Constants.WinPropVisible]; bool visible = prop == null ? true : (bool)prop.GetValue(linkedControl); linkedControl.Visible = (valueLayer == 0 || valueLayer == currentVisiableLayer + 1) && visible; } else { linkedControl.Visible = false; } HandleVisibility(linkedControl); } } else { MessageBox.Show("try to use control that didn't created", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } } }
public DbTypedValue GetDbType(string name, object value, EbDbTypes type) { DbTypedValue TV = new DbTypedValue(name, value, type); EbMobileControl ctrl = ControlDictionary.ContainsKey(name) ? ControlDictionary[name] : null; if (ctrl != null) { TV.Type = ctrl.EbDbType; TV.Value = ctrl.SQLiteToActual(value); } else { if (TV.Type == EbDbTypes.Date) { TV.Value = Convert.ToDateTime(value).ToString("yyyy-MM-dd"); } else if (TV.Type == EbDbTypes.DateTime) { TV.Value = Convert.ToDateTime(value).ToString("yyyy-MM-dd HH:mm:ss"); } } return(TV); }
public ControlDictionaryTest() { controlDictionary = ControlDictionary.Instance; }
public void Setup() { controlDictionary = ControlDictionary.Instance; }
public void TestFixtureSetUp() { controlDictionary = ControlDictionary.Instance; }