void HandleRefreshLinkClick(object sender, EventArgs e) { this.richBox.Text = ""; Layout.SaveLayout(); Update(Layout); BringToFrontAndShow(); }
// sFile comes in the format of parent.child public virtual void SetLink(string file) { //the sExtra needs to be in Parent.Child form for the REciprocal links to work later LinkTableRecord result = Array.Find(Layout.GetLinkTable().GetRecords(), LinkTableRecord => LinkTableRecord.sExtra == String.Format(CoreUtilities.Links.LinkTableRecord.PageLinkFormatString, Layout.GUID, this.GuidForNote)); //string file = String.Format (CoreUtilities.Links.LinkTableRecord.PageLinkFormatString, LayoutGuid, ChildGuid); // August 2013 -- moved this out of the results==null routine BEACAUSE we need this to be updated when //editing a link too! Not just on the initial creation string newCaption = Constants.BLANK; // may 2013 - if we have a * it means we have a caption encoded at end of string and this neesd to be removed. if (file.IndexOf("*") > -1) { string[] details = file.Split(new char[1] { '*' }); if (details != null && details.Length == 2) { file = details[0]; newCaption = details[1]; this.Caption = newCaption; } } if (result == null) { // add new result = new LinkTableRecord(); result.sFileName = file; string SourceContainerGUIDToUse = Layout.GUID; result.sExtra = String.Format(CoreUtilities.Links.LinkTableRecord.PageLinkFormatString, SourceContainerGUIDToUse, this.GuidForNote); result.sText = this.Caption; Layout.GetLinkTable().Add(result); } else { // edit existing result.sFileName = file; Layout.GetLinkTable().Edit(result); } this.richBox.Text = Constants.BLANK; // force a save else table might not be made correctly Layout.SaveLayout(); Update(Layout); BringToFrontAndShow(); }