/// <summary>
 /// On loaded the certificate list screen
 /// </summary>
 /// <param name="sender">The parameter is not used.</param>
 /// <param name="e">The parameter is not used.</param>
 private void CertificateList_Loaded(object sender, RoutedEventArgs e)
 {
     if (_context == null)
     {
         _context = this.DataContext as CertificateListViewModel;
         _context.CertificateEditionRequested += CertificateEditionRequested;
         _context.GridActionCompleted += GridActionCompleted;
         _context.ShowHideExportButtons += ContextShowHideExportButtons;
         GridResults.Columns.GetByName("colPublishInformation").Visibility = _context.IsPublishVisible ? Visibility.Visible : Visibility.Collapsed;
         GridResults.Columns.GetByName("colSyncComdiv").Visibility = App.CurrentUser.IsInRole(UserRoleEnum.BorderAgent, UserRoleEnum.LOAdmin) ? Visibility.Collapsed : Visibility.Visible;
         paginator.CanExportRN = App.CurrentUser.IsInRole(UserRoleEnum.BorderAgent, UserRoleEnum.LOAdmin, UserRoleEnum.SuperAdmin,UserRoleEnum.Supervisor) ? Visibility.Visible : Visibility.Collapsed;
     }
 }
        void GridResults_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            _context = this.DataContext as CertificateListViewModel;

            //Get the HyperLink Button of column with index 8
            HyperlinkButton editButton = GridResults.Columns.GetByName("colEditAction").GetCellContent(e.Row) as HyperlinkButton;

            if (editButton == null) return;

            //Get the certificate attached to current row
            Certificate certificate = e.Row.DataContext as Certificate;
            bool canEditRoUser = false;
            canEditRoUser = App.CurrentUser.IsInRole(UserRoleEnum.SuperAdmin) ||
                            certificate.OfficeId == App.CurrentUser.OfficeId;

            //Set the button text according to IsPublished flag

            if (App.CurrentUser.IsInRole(UserRoleEnum.Coordinator))
            {
                editButton.Content = certificate.CanBeEditedCoordinator && canEditRoUser ? Strings.Edit : Strings.Details;
            }
            else
            {
                //Set the button text according to IsEditVisible
                editButton.Content = _context.IsEditVisible && certificate.CanBeEdited && canEditRoUser ? Strings.Edit : Strings.Details;
            }
        }