/// <summary> /// Called after an element's ChildElements have been /// created. The child element's can be repositioned here /// and/or new element's can be added. /// </summary> /// <param name="parent">The <see cref="T:Infragistics.Win.UIElement" /> whose child elements have been created/positioned.</param> public void AfterCreateChildElements(Infragistics.Win.UIElement parent) { if (parent is DayUIElement) { List <UIElement> elementsToRemove = new List <UIElement>(); foreach (UIElement childElement in parent.ChildElements) { if (childElement is AppointmentSelectedUIElement) { elementsToRemove.Add(childElement); } } foreach (UIElement element in elementsToRemove) { parent.ChildElements.Remove(element); element.Dispose(); } return; } MoreItemsIndicatorUIElement moreItemsElement = parent as MoreItemsIndicatorUIElement; if (moreItemsElement != null) { moreItemsElement.Image = (moreItemsElement.Up) ? Properties.Resources.MoreActivityIndicator_Up : Properties.Resources.MoreActivityIndicator_Down; return; } }
private void grdDataMedicalExamFieldValue_MouseDown(object sender, MouseEventArgs e) { //if (e.Button == MouseButtons.Right) //{ Point point = new System.Drawing.Point(e.X, e.Y); Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point); if (uiElement == null || uiElement.Parent == null) { return; } Infragistics.Win.UltraWinGrid.UltraGridRow row = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow)); if (row != null) { grdDataMedicalExamFieldValue.Rows[row.Index].Selected = true; contextMenuMedicalExamFieldValues.Items["mnuGridNewMedicalExamFieldValue"].Enabled = true; contextMenuMedicalExamFieldValues.Items["mnuGridEditMedicalExamFieldValue"].Enabled = true; contextMenuMedicalExamFieldValues.Items["mnuGridDeleteMedicalExamFieldValue"].Enabled = true; } else { contextMenuMedicalExamFieldValues.Items["mnuGridNewMedicalExamFieldValue"].Enabled = true; contextMenuMedicalExamFieldValues.Items["mnuGridEditMedicalExamFieldValue"].Enabled = false; contextMenuMedicalExamFieldValues.Items["mnuGridDeleteMedicalExamFieldValue"].Enabled = false; } //} }
private void ultraGridPolicyMetrics_MouseClick(object sender, MouseEventArgs e) { if (m_allowEdit && e.Button == MouseButtons.Left) { Infragistics.Win.UIElement selectedElement = ultraGridPolicyMetrics.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y)); if (selectedElement is Infragistics.Win.CheckIndicatorUIElement) { Infragistics.Win.UltraWinGrid.UltraGridRow row = selectedElement.SelectableItem as Infragistics.Win.UltraWinGrid.UltraGridRow; if (row != null && row.Cells != null) { // SQLsecure 3.1 (Anshul Aggarwal) - Type of control decides editable columns in the grid. if (m_ControlType == ConfigurePolicyControlType.ImportExportSecurityCheck) { UltraGridCell cell = selectedElement.GetContext(typeof(UltraGridCell)) as UltraGridCell; if (cell != null && (cell.Column.Key == Utility.Constants.POLICY_METRIC_VALUE_IS_SELECTED)) { cell.Value = !((bool)cell.Value); UpdateEnabledCount(); } } else { Infragistics.Win.UltraWinGrid.UltraGridCell cell = row.Cells[Utility.Constants.POLICY_METRIC_COLUMN_IS_ENABLED]; if (cell != null && cell.Value is bool) { cell.Value = !(bool)cell.Value; UpdateEnabledCount(); } } } } } }
/// <summary> /// Called after an element's ChildElements have been /// created. The child element's can be repositioned here /// and/or new element's can be added. /// </summary> /// <param name="parent">The <see cref="T:Infragistics.Win.UIElement"/> whose child elements have been created/positioned.</param> public void AfterCreateChildElements(Infragistics.Win.UIElement parent) { if (parent is TimeSlotDescriptorAreaUIElement) { List <UIElement> elementsToRemove = new List <UIElement>(); foreach (UIElement element in parent.ChildElements) { // find all the UIElements for the TileSlotDescriptors that are not 8, 12, or 4. TimeSlotDescriptorUIElement timeSlotElement = element as TimeSlotDescriptorUIElement; if (timeSlotElement != null && timeSlotElement.FirstTimeSlot.StartTime.Hour % 4 == 0) { continue; } // add to the list of element to remove elementsToRemove.Add(timeSlotElement); } if (elementsToRemove.Count > 0) { // remove each element in the list foreach (UIElement element in elementsToRemove) { parent.ChildElements.Remove(element); } } } }
private void grdProtocolComponent_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Point point = new System.Drawing.Point(e.X, e.Y); Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point); if (uiElement == null || uiElement.Parent == null) { return; } // Capturar valor de una celda especifica al hace click derecho sobre la celda k se quiere su valor Infragistics.Win.UltraWinGrid.UltraGridCell cell = (Infragistics.Win.UltraWinGrid.UltraGridCell)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell)); Infragistics.Win.UltraWinGrid.UltraGridRow row = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow)); if (row != null) { _rowIndexPc = row.Index; if (row.Cells["v_ProtocolComponentId"].Value != null) { _protocolComponentId = row.Cells["v_ProtocolComponentId"].Value.ToString(); } grdProtocolComponent.Rows[_rowIndexPc].Selected = true; cmProtocol.Items["Edit"].Enabled = true; if (_mode == "Edit") { OperationResult objOperationResult = new OperationResult(); var isProtocolInService = _protocolBL.IsExistsProtocol(ref objOperationResult, _protocolId); if (isProtocolInService) { cmProtocol.Items["delete"].Enabled = false; } else { cmProtocol.Items["delete"].Enabled = true; } } else { cmProtocol.Items["delete"].Enabled = true; } } else { cmProtocol.Items["delete"].Enabled = false; cmProtocol.Items["Edit"].Enabled = false; } } }
/// <summary> /// Called after an element's ChildElements have been /// created. The child element's can be repositioned here /// and/or new element's can be added. /// </summary> /// <param name="parent">The <see cref="T:Infragistics.Win.UIElement"/> whose child elements have been created/positioned.</param> public void AfterCreateChildElements(Infragistics.Win.UIElement parent) { if (parent is RibbonCaptionAreaUIElement) { foreach (UIElement child in parent.ChildElements) { // remove the UIElement for the Form Icon if (child is PopupToolUIElement) { parent.ChildElements.Remove(child); return; } } } }
private void grdDataServiceComponent_MouseDown(object sender, MouseEventArgs e) { Point point = new System.Drawing.Point(e.X, e.Y); Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point); if (uiElement == null || uiElement.Parent == null) { return; } Infragistics.Win.UltraWinGrid.UltraGridRow row = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow)); if (row != null) { grdDataServiceComponent.Rows[row.Index].Selected = true; contextMenuStrip2.Items["btnRemoverEsamen"].Enabled = true; } else { contextMenuStrip2.Items["btnRemoverEsamen"].Enabled = false; } }
private void grdDataCalendar_MouseDown(object sender, MouseEventArgs e) { Point point = new System.Drawing.Point(e.X, e.Y); Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point); if (uiElement == null || uiElement.Parent == null) { return; } Infragistics.Win.UltraWinGrid.UltraGridRow row = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow)); if (e.Button == MouseButtons.Right) { if (row != null) { _RowIndexgrdDataCalendar = row.Index; grdDataCalendar.Rows[row.Index].Selected = true; int CalendarStatusId = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_CalendarStatusId"].Value.ToString()); int LineStatusId = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_LineStatusId"].Value.ToString()); int ServiceStatusId = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_ServiceStatusId"].Value.ToString()); _PacientId = grdDataCalendar.Selected.Rows[0].Cells["v_PersonId"].Value.ToString(); if (CalendarStatusId == (int)Common.CalendarStatus.Agendado) { contextMenuStrip1.Items["mnuCancelCalendar"].Enabled = true; contextMenuStrip1.Items["mnuFinCircuito"].Enabled = false; contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = true; contextMenuStrip1.Items["mnuReagendarCita"].Enabled = true; } else if (CalendarStatusId == (int)Common.CalendarStatus.Atendido) { contextMenuStrip1.Items["mnuCancelCalendar"].Enabled = false; contextMenuStrip1.Items["mnuFinCircuito"].Enabled = true; contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false; contextMenuStrip1.Items["mnuReagendarCita"].Enabled = false; } else if (CalendarStatusId == (int)Common.CalendarStatus.Cancelado) { contextMenuStrip1.Items["mnuCancelCalendar"].Enabled = false; contextMenuStrip1.Items["mnuFinCircuito"].Enabled = false; contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false; contextMenuStrip1.Items["mnuReagendarCita"].Enabled = true; } if (LineStatusId == (int)Common.LineStatus.FueraCircuito && CalendarStatusId == (int)Common.CalendarStatus.Atendido) { contextMenuStrip1.Items["mnuCancelCalendar"].Enabled = false; contextMenuStrip1.Items["mnuFinCircuito"].Enabled = false; contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false; contextMenuStrip1.Items["mnuReagendarCita"].Enabled = false; } OperationResult objOperationResult = new OperationResult(); ServiceBL objServiceBL = new ServiceBL(); List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>(); _strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString(); ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId); grdDataServiceComponent.DataSource = ListServiceComponent; } else { contextMenuStrip1.Items["mnuCancelCalendar"].Enabled = false; contextMenuStrip1.Items["mnuFinCircuito"].Enabled = false; contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false; contextMenuStrip1.Items["mnuReagendarCita"].Enabled = false; } } if (e.Button == MouseButtons.Left) { if (row != null) { OperationResult objOperationResult = new OperationResult(); ServiceBL objServiceBL = new ServiceBL(); List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>(); PacientBL objPacientBL = new PacientBL(); personDto objpersonDto = new personDto(); _PacientId = grdDataCalendar.Selected.Rows[0].Cells["v_PersonId"].Value.ToString(); //string strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString(); _strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString(); ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId); grdDataServiceComponent.DataSource = ListServiceComponent; txtTrabajador.Text = grdDataCalendar.Selected.Rows[0].Cells["v_Pacient"].Value.ToString(); if (grdDataCalendar.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value != null) { WorkingOrganization.Text = grdDataCalendar.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString(); } txtProtocol.Text = grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolName"].Value == null ? "" : grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString(); txtService.Text = grdDataCalendar.Selected.Rows[0].Cells["v_ServiceName"].Value.ToString(); if (grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolId"].Value != null) { if (grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString() == Constants.CONSULTAMEDICA) { txtTypeESO.Text = ""; } else { txtTypeESO.Text = grdDataCalendar.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString(); } } _personName = grdDataCalendar.Selected.Rows[0].Cells["v_Pacient"].Value.ToString(); objpersonDto = objPacientBL.GetPerson(ref objOperationResult, _PacientId); Byte[] ooo = objpersonDto.b_PersonImage; if (ooo == null) { pbImage.Image = Resources.nofoto; } else { pbImage.Image = Common.Utils.BytesArrayToImageOficce(ooo, pbImage); _personImage = ooo; } // Huella y Firma if (objpersonDto.b_FingerPrintImage == null) { txtExisteHuella.Text = "NO REGISTRADO"; txtExisteHuella.ForeColor = Color.Red; } else { txtExisteHuella.Text = "REGISTRADO"; txtExisteHuella.ForeColor = Color.DarkBlue; } // Firma if (objpersonDto.b_RubricImage == null) { txtExisteFirma.Text = "NO REGISTRADO"; txtExisteFirma.ForeColor = Color.Red; } else { txtExisteFirma.Text = "REGISTRADO"; txtExisteFirma.ForeColor = Color.DarkBlue; } } } }
/// <summary> /// Called before child elements are to be created/positioned. /// This is called during a draw operation for an element /// whose ChildElementsDirty is set to true. Returning true from /// this method indicates that the default creation logic /// should be bypassed. /// </summary> /// <param name="parent">The <see cref="T:Infragistics.Win.UIElement" /> whose child elements are going to be created/positioned.</param> /// <returns> /// True if the default creation logic should be bypassed. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public bool BeforeCreateChildElements(Infragistics.Win.UIElement parent) { return(false); }
public void AfterCreateChildElements(Infragistics.Win.UIElement parent) // Implements Infragistics.Win.IUIElementCreationFilter.AfterCreateChildElements { // Check for the HeaderUIElement if (parent is HeaderUIElement) { // Get the HeaderBase object from the HeaderUIElement Infragistics.Win.UltraWinGrid.HeaderBase aHeader = ((HeaderUIElement)parent).Header; // Only put the checkbox into headers whose DataType is boolean if (aHeader.Column.DataType == typeof(bool)) { TextUIElement aTextUIElement; CheckBoxUIElement aCheckBoxUIElement = (CheckBoxUIElement)parent.GetDescendant(typeof(CheckBoxUIElement)); // Since the grid sometimes re-uses UIElements, we need to check to make sure // the header does not already have a CheckBoxUIElement attached to it. // If it does, we just get a reference to the existing CheckBoxUIElement, // and reset its properties. if (aCheckBoxUIElement == null) { //Create a New CheckBoxUIElement aCheckBoxUIElement = new CheckBoxUIElement(parent); } // Get the TextUIElement - this is where the text for the // Header is displayed. We need this so we can push it to the right // in order to make room for the CheckBox aTextUIElement = (TextUIElement)parent.GetDescendant(typeof(TextUIElement)); // Sanity check if (aTextUIElement == null) { return; } // Get the Header and see if the Tag has been set. If the Tag is // set, we will assume it's the stored CheckState. This has to be // done in order to maintain the CheckState when the grid repaints and // UIElement are destroyed and recreated. Infragistics.Win.UltraWinGrid.ColumnHeader aColumnHeader = (Infragistics.Win.UltraWinGrid.ColumnHeader)aCheckBoxUIElement.GetAncestor(typeof(HeaderUIElement)) .GetContext(typeof(Infragistics.Win.UltraWinGrid.ColumnHeader)); if (aColumnHeader.Tag == null) { //If the tag was nothing, this is probably the first time this //Header is being displayed, so default to Indeterminate aColumnHeader.Tag = CheckState.Indeterminate; } else { aCheckBoxUIElement.CheckState = (CheckState)aColumnHeader.Tag; } // Hook the ElementClick of the CheckBoxUIElement aCheckBoxUIElement.ElementClick += new UIElementEventHandler(aCheckBoxUIElement_ElementClick); // Add the CheckBoxUIElement to the HeaderUIElement parent.ChildElements.Add(aCheckBoxUIElement); // Position the CheckBoxUIElement. The number 3 here is used for 3 // pixels of padding between the CheckBox and the edge of the Header. // The CheckBox is shifted down slightly so it is centered in the header. aCheckBoxUIElement.Rect = new Rectangle(parent.Rect.X + 3, parent.Rect.Y + ((parent.Rect.Height - aCheckBoxUIElement.CheckSize.Height) / 2), aCheckBoxUIElement.CheckSize.Width, aCheckBoxUIElement.CheckSize.Height); // Push the TextUIElement to the right a little to make // room for the CheckBox. 3 pixels of padding are used again. aTextUIElement.Rect = new Rectangle(aCheckBoxUIElement.Rect.Right + 3, aTextUIElement.Rect.Y, parent.Rect.Width - (aCheckBoxUIElement.Rect.Right - parent.Rect.X), aTextUIElement.Rect.Height); } else { // If the column is not a boolean column, we do not want to have a checkbox in it // Since UIElements can be reused by the grid, there is a chance that one of the // HeaderUIElements that we added a checkbox to for a boolean column header // will be reused in a column that is not boolean. In this case, we must remove // the checkbox so that it will not appear in an inappropriate column header. CheckBoxUIElement aCheckBoxUIElement = (CheckBoxUIElement)parent.GetDescendant(typeof(CheckBoxUIElement)); if (aCheckBoxUIElement != null) { parent.ChildElements.Remove(aCheckBoxUIElement); aCheckBoxUIElement.Dispose(); } } } }
public bool BeforeCreateChildElements(Infragistics.Win.UIElement parent) // Implements Infragistics.Win.IUIElementCreationFilter.BeforeCreateChildElements { // Don't need to do anything here return(false); }