private string GetTextFromContentTextbox() { if (mSelection != null && mMetadataListView.SelectedItems.Count > 0) { string entryName = mMetadataListView.SelectedItems[0].Text; if (IsDateMetadataSelected) { // first check if this is year only format: this format is not accepted by default date stuff of c# string strYearVal = mContentTextbox.Text; int yearOnlyDate = 0; int.TryParse(strYearVal, out yearOnlyDate); if (yearOnlyDate > 0 && strYearVal.Length == 4) { return(strYearVal); } try { DateTime dateEntry = DateTime.Parse(mContentTextbox.Text); string strDate = dateEntry.Year.ToString() + "-" + AdjustSingleDigitDate(dateEntry.Month.ToString()) + "-" + AdjustSingleDigitDate(dateEntry.Day.ToString()); return(strDate); } catch (System.FormatException ex) { mView.WriteToLogFile(ex.ToString()); MessageBox.Show(Localizer.Message("Metadata_InvalidDateFormat")); return(""); } catch (System.Exception ex) { mView.WriteToLogFile(ex.ToString()); MessageBox.Show(Localizer.Message("MetadataView_InvalidMetadata") + "\n\n" + ex.ToString()); //@Messagecorrected return(""); } } else { return(mContentTextbox.Text); } } return(""); }
/// <summary> /// Make the tree node for this section visible. /// </summary> public void MakeTreeNodeVisibleForSection(SectionNode section) { try { if (section != null && section.IsRooted) { FindTreeNode(section).EnsureVisible(); } } catch (System.Exception ex) { mProjectView.WriteToLogFile(ex.ToString()); MessageBox.Show(Localizer.Message("Operation_Cancelled") + "\n\n" + ex.ToString()); } }