示例#1
0
 /// <summary>
 ///     Handles the Click event of the btnClear control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DGAttachData.CancelEdit();
         BindGrid();
     }
     catch (Exception commonException)
     {
         _logger.Error("Error occurred as " + commonException.Message);
     }
 }
示例#2
0
        /// <summary>
        /// Handles the Click event of the CallDataAddMenuitem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        public void CallDataAddMenuitem1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MenuItem menuitem = sender as MenuItem;

                DGAttachData.UpdateLayout();
                if (DGAttachData.Items.Count > 2)
                {
                    DGAttachData.ScrollIntoView(DGAttachData.Items[DGAttachData.Items.Count - 2]);
                }
                int rowIndex =
                    Datacontext.GetInstance()
                    .NotifyCallData.IndexOf(
                        Datacontext.GetInstance()
                        .NotifyCallData.Where(p => p.Key == menuitem.Header.ToString())
                        .FirstOrDefault());
                var dataGridCellInfo = new Microsoft.Windows.Controls.DataGridCellInfo(DGAttachData.Items[rowIndex], DGAttachData.Columns[1]);
                var cell             = TryToFindGridCell(DGAttachData, dataGridCellInfo);
                if (cell == null)
                {
                    return;
                }
                cell.Focus();
                _isCaseDataManualBeginEdit = true;
                DGAttachData.BeginEdit();

                if (_dataContext.NotifyCallData.Count <= 0)
                {
                    DGAttachData.Visibility      = Visibility.Collapsed;
                    txtAttachDataInfo.Visibility = Visibility.Visible;
                }
                else
                {
                    DGAttachData.Visibility      = Visibility.Visible;
                    txtAttachDataInfo.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception commonException)
            {
                _logger.Error("CallDataAddMenuitem_Click: " + commonException.Message.ToString());
            }
        }