public static T TryGetDynamicPropertyValue <T>(this AccessControlModel control, string propertyName) { try { return(GetDynamicPropertyValue <T>(control.Control.Properties, propertyName)); } catch { return(default(T)); } }
public static bool TrySetDynamicPropertyValue <T>(this AccessControlModel control, string propertyName, T value) { try { control.SetDynamicPropertyValue <T>(propertyName, value); return(true); } catch { return(false); } }
private bool ExecuteHandlerCode(AccessFormModel form, AccessControlModel control, string actionName) { var handlerCode = control.TryGetPropertyValue <string>(actionName); if (!string.IsNullOrEmpty(handlerCode)) { ExecuteCode(form, control, handlerCode); return(true); } return(false); }
public static bool TryGetDynamicPropertyValue <T>(this AccessControlModel control, string propertyName, out T value) { try { value = GetDynamicPropertyValue <T>(control.Control.Properties, propertyName); return(true); } catch { value = default(T); return(false); } }
private void ExecuteCode(AccessFormModel formModel, AccessControlModel control, string code) { if (code == "[Event Procedure]") { //form.SetFocus(); control.SetFocus(); RobotWin32.SetForegroundWindow((IntPtr)formModel.Hwnd); System.Windows.Forms.SendKeys.SendWait("{ENTER}"); } else if (!string.IsNullOrEmpty(code)) { application.DoCmd.RunMacro(code); } else { throw new Exception("Code to execute is empty"); } }
private List <TreeNode> GetControlNodes(AccessControlModel model) { var result = new List <TreeNode>(); if (model.HasForm()) { result.Add(new LazyTreeNode(FormLabel).Add( GetLoadedFormNode(model.GetForm()) )); } if (model.HasReport()) { result.Add(new LazyTreeNode(ReportLabel).Add( () => GetReportNode(model.Report.Value) )); } var dynamicProperties = new Lazy <AccessDynamicPropertyCollectionModel>(() => new AccessDynamicPropertyCollectionModel(model.Control.Properties)); result.Add( new LazyTreeNode(PropertiesLabel) .Add(GetDynamicPropertyParentNode(dynamicProperties)) .AddRange(() => CreatePropertyNodes(model.Control)) ); if (model.GetChildrenCount() > 0) { model.LoadChildren(false); result.AddRange(model.Children.Select( cm => new LazyTreeNode(cm).AddRange(() => GetControlNodes(cm)) )); } return(result); }
public static void SetDynamicPropertyValue <T>(this AccessControlModel control, string propertyName, T value) { control.Control.Properties[propertyName].Value = value; }