private void mniElementEnclosure_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var el = GetSelectedTextRangeViewModel().TextRange.GetEnclosingElement();
         ElementInfoDialog dlg = new ElementInfoDialog(el);
         dlg.Owner = Application.Current.MainWindow;
         dlg.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageDialog.Show(GetExceptionString(ex));
     }
 }
        private void mniElementEnclosure_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var el = GetSelectedTextRangeViewModel().TextRange.GetEnclosingElement();
                ElementInfoDialog dlg = new ElementInfoDialog(el);
                dlg.Owner = Application.Current.MainWindow;
                dlg.ShowDialog();
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
            {
                ex.ReportException();
                MessageDialog.Show(GetExceptionString(ex));
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }
 private void mniElementChildren_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var list = GetSelectedTextRangeViewModel().TextRange.GetChildren();
         if (list.Count != 0)
         {
             ElementInfoDialog dlg = new ElementInfoDialog(list);
             dlg.Owner = Application.Current.MainWindow;
             dlg.ShowDialog();
         }
         else
         {
             MessageDialog.Show("No child Element from the selected TextRange.");
         }
     }
     catch (Exception ex)
     {
         MessageDialog.Show(GetExceptionString(ex));
     }
 }
        private void mniElementChildren_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var list = GetSelectedTextRangeViewModel().TextRange.GetChildren();
                if (list.Count != 0)
                {
                    ElementInfoDialog dlg = new ElementInfoDialog(list);
                    dlg.Owner = Application.Current.MainWindow;
                    dlg.ShowDialog();
                }
                else
                {
                    MessageDialog.Show(Properties.Resources.NoChildElementFromTextRange);
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
            {
                ex.ReportException();
                MessageDialog.Show(GetExceptionString(ex));
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }