Hi,
I have am using the Document Manager though I have no use for the URI property.
I am using the Tag property to store the document unique Guid used to re-open the document.
Every time I update the LastOpenedDateTime the list is not being re sorted according to the last opened date time. is there a way to resolve this? am I doing something wrong?
On that note, why isn't there a way to get a reference using the Tag property rather than the uri?
here is my code:
I have am using the Document Manager though I have no use for the URI property.
I am using the Tag property to store the document unique Guid used to re-open the document.
Every time I update the LastOpenedDateTime the list is not being re sorted according to the last opened date time. is there a way to resolve this? am I doing something wrong?
On that note, why isn't there a way to get a reference using the Tag property rather than the uri?
here is my code:
RecentDocumentManager manager = MainWindow.Instance.recentDocManager;
manager.Documents.BeginUpdate();
DateTime dateTime = DateTime.Now;
Guid guid = dock.Graph.First.UniqueKey;
string label = dock.Graph.First.Label;
bool exists = false;
foreach (DocumentReference current in manager.Documents)
{
if (guid.ToString().Equals(current.Tag.ToString(),
StringComparison.OrdinalIgnoreCase))
{
//manager.NotifyDocumentOpened(null, label, guid);
current.LastOpenedDateTime = dateTime;
exists = true;
break;
}
}
if (!exists)
{
DocumentReference docRef = new DocumentReference();
docRef.Name = label;
docRef.Tag = guid;
docRef.LastOpenedDateTime = dateTime;
manager.Documents.Add(docRef);
}
manager.Documents.EndUpdate();