Example #1
0
 //private void LoadControlsByTypeCallback(LoadOperation<t_Control> result)
 //{
 //    if (!result.HasError)
 //    {
 //        _t_toolTipControl = result.Entities.FirstOrDefault();
 //        CreateToolTip(_t_toolTipControl);
 //    }
 //}
 private void CreateToolTip(t_Control t_control)
 {
     var target = _associatedElement as MonitorControl;
     if (null != target)
     {
         if (t_control != null)
         {
             target.IsToolTipLoaded = true;
             var toolTipControl = new ToolTipControl(target);
             toolTipControl.SetValue(Canvas.ZIndexProperty, 10000);
             var listElementProperties = new List<t_ElementProperty>();
             var toolTipControlElement = MonitorControl.OnInitControl(t_control);
             toolTipControlElement.Transparent = 100;
             toolTipControlElement.ControlID = -9999;
             toolTipControlElement.ElementType = "ToolTip";
             toolTipControlElement.ElementName = t_control.ControlName;
             toolTipControl.ScreenElement = toolTipControlElement;
             toolTipControlElement.Width = 300;
             toolTipControlElement.Height = 200;
             var elementProperties = new ControlPropertyDA().SelectByControlId(t_control.ControlID);
             foreach (t_ControlProperty property in elementProperties)
             {
                 t_ElementProperty tt = new t_ElementProperty();
                 tt.Caption = property.Caption;
                 tt.ElementID = toolTipControlElement.ElementID;
                 tt.PropertyNo = property.PropertyNo;
                 tt.PropertyValue = property.DefaultValue;
                 tt.PropertyName = property.PropertyName;
                 listElementProperties.Add(tt);
             }
             toolTipControl.ScreenElement = toolTipControlElement;
             toolTipControl.ListElementProp = listElementProperties;
             toolTipControl.ElementState = ElementSate.New;
             toolTipControl.SetPropertyValue();
             toolTipControl.SetCommonPropertyValue();
             _parent.Children.Add(toolTipControl);
             toolTipControl.DesignMode();
             toolTipControl.SetPosition();
             target.ToolTipControl = toolTipControl;
             if (null != CurrenttoolTipControl)
             {
                 CurrenttoolTipControl.IsOpen = false;
                 Adorner.RemoveMutiSelected(CurrenttoolTipControl.AdornerLayer);
             }
             CurrenttoolTipControl = toolTipControl;
             toolTipControl.IsOpen = true;
         }
     }
 }
Example #2
0
        public void SetAttrByName(string name, object value)
        {
            if (null == ScreenElement
                || !ScreenElement.ControlID.HasValue)
            {
                return;
            }
            if (ListElementProp == null)
            {
                ListElementProp = new ElementPropertyDA().SelectBy(ScreenElement.ElementID);
                if (ListElementProp.Count == 0)
                {
                    var elementProperties = new ControlPropertyDA().SelectByControlId(ScreenElement.ControlID.Value);
                    foreach (t_ControlProperty elementProperty in elementProperties)
                    {
                        t_ElementProperty tt = new t_ElementProperty();
                        tt.Caption = elementProperty.Caption;
                        tt.ElementID = ScreenElement.ElementID;
                        tt.PropertyNo = elementProperty.PropertyNo;
                        tt.PropertyValue = elementProperty.DefaultValue;
                        tt.PropertyName = elementProperty.PropertyName;
                        ListElementProp.Add(tt);
                    }
                }
            }

            var property = ListElementProp.FirstOrDefault(p => string.Equals(p.PropertyName, name, StringComparison.CurrentCultureIgnoreCase));
            if (null != property)
            {
                property.PropertyValue =( null == value ? string.Empty : value.ToString());
            }
        }