Recent Document List shows different order after load

Ribbon for WPF Forum

Posted 15 years ago by Willie
Version: 4.5.0486
I use the next code to load the document reference list.
However the items are shown in a different way than i add it????

Dim Ar As New ArrayList
On Error Resume Next
'Ar is filled with items here....

Dim M As ActiproSoftware.Windows.DocumentManagement.RecentDocumentManager = RecentFileDocumentManager

M.Documents.Clear() 'init
For i As Integer = 0 To Ar.Count - 1
Dim Idoc As ActiproSoftware.Windows.DocumentManagement.IDocumentReference = New ActiproSoftware.Windows.DocumentManagement.DocumentReference
Dim Filepath As String = "" & System.IO.Path.GetDirectoryName(Ar(i))
Dim Filename As String = "" & System.IO.Path.GetFileName(Ar(i))
Idoc.Location = New Uri(Filepath)
Idoc.LastOpenedDateTime = Now.AddMilliseconds(i)
Idoc.Name = Filename
Idoc.IsPinnedRecentDocument = False

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

It sorts them by their last opened date/time. Maybe your Now.AddMilliseconds isn't working as you'd expect.

I'd suggest starting off with a variable like:
Dim dt As DateTime = DateTime.Now
Then for each item, use 'dt' as the LastOpenedDateTime and do something like:
dt = dt.AddSeconds(1)

Actipro Software Support

Posted 15 years ago by Willie
i will be using instead. it works now.

Idoc.LastOpenedDateTime = Now.AddSeconds(i)

[Modified at 03/23/2009 05:10 AM]
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.