private Boolean Check(Boolean Show) { Boolean Check = true; if (!Edit_AC.Checked && !String.IsNullOrEmpty(Edit_DeviceNumber.Text)) { if (DeviceNumberId.IsEmpty()) { Edit_DeviceNumber.ErrorText = DeviceNumberTooltTip; Edit_DeviceNumber.ErrorIconAlignment = ErrorIconAlignment.MiddleRight; Check = false; } if (!Check || Show) { ToolTip t = new ToolTip(); t.ToolTipTitle = DeviceNumber; t.ToolTipIcon = DeviceNumberId.IsEmpty() ? ToolTipIcon.Error : ToolTipIcon.Info; t.Show(DeviceNumberTooltTip, Edit_DeviceNumber, 3000); } } else { DeviceNumber = ""; DeviceNumberId = Guid.Empty; DeviceNumberTooltTip = ""; Edit_DeviceNumber.ErrorText = ""; WarrantyEndDate = null; } for (Int32 i = 0; i < DataList.Count; i++) { DataList[i].Validate(); } View_Sensors.RefreshData(); if (DataList.Any(sensor => !sensor.Valid)) { Int32 i = DataList.IndexOf(DataList.First(sensor => !sensor.Valid)); ToolTipControllerShowEventArgs Args = Controller_ToolTip.CreateShowArgs(); Args.SelectedControl = Control_Sensors; Args.ToolTipType = ToolTipType.SuperTip; Args.SuperTip = new SuperToolTip(); SuperToolTipSetupArgs toolTipArgs = new SuperToolTipSetupArgs(); toolTipArgs.Title.Text = DataList[i].Sensor ?? "<Пусто>"; toolTipArgs.Contents.Text = DataList[i].ToolTip; Args.SuperTip.Setup(toolTipArgs); Args.IconType = DataList[i].Valid ? ToolTipIconType.Information : ToolTipIconType.Error; GridRowInfo RowInfo = (View_Sensors.GetViewInfo() as GridViewInfo).GetGridRowInfo(i); if (RowInfo.IsNull()) { Controller_ToolTip.ShowHint(Args, Control_Sensors); } else { Controller_ToolTip.ShowHint(Args, Control_Sensors.GetLocation() + (Size)RowInfo.TotalBounds.Location + RowInfo.TotalBounds.Size); } return(false); } return(Check); }
private void Controller_ToolTip_GetActiveObjectInfo(Object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) { if (e.SelectedControl == Control_Sensors) { GridHitInfo hitInfo = View_Sensors.CalcHitInfo(e.ControlMousePosition); if (hitInfo.RowHandle >= 0 && DataList.Count > 0) { SuperToolTipSetupArgs toolTipArgs = new SuperToolTipSetupArgs(); toolTipArgs.Title.Text = DataList[hitInfo.RowHandle].Sensor; toolTipArgs.Contents.Text = DataList[hitInfo.RowHandle].ToolTip; if (!String.IsNullOrEmpty(toolTipArgs.Contents.Text)) { e.Info = new ToolTipControlInfo(); e.Info.Object = hitInfo.HitTest.ToString() + hitInfo.RowHandle.ToString(); e.Info.ToolTipType = ToolTipType.SuperTip; e.Info.SuperTip = new SuperToolTip(); e.Info.SuperTip.Setup(toolTipArgs); e.Info.IconType = DataList[hitInfo.RowHandle].Valid ? ToolTipIconType.Information : ToolTipIconType.Error; } } } else if (e.SelectedControl == Edit_DeviceNumber) { SuperToolTipSetupArgs toolTipArgs = new SuperToolTipSetupArgs(); toolTipArgs.Title.Text = DeviceNumber; toolTipArgs.Contents.Text = DeviceNumberTooltTip; if (!String.IsNullOrEmpty(toolTipArgs.Contents.Text)) { e.Info = new ToolTipControlInfo(); e.Info.Object = Edit_DeviceNumber.ToString(); e.Info.ToolTipType = ToolTipType.SuperTip; e.Info.SuperTip = new SuperToolTip(); e.Info.SuperTip.Setup(toolTipArgs); e.Info.IconType = DeviceNumberId.IsEmpty() ? ToolTipIconType.Error : ToolTipIconType.Information; } } }