-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathOpenedPagesExplorer.vb
More file actions
62 lines (49 loc) · 1.71 KB
/
OpenedPagesExplorer.vb
File metadata and controls
62 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Public Class OpenedPagesExplorer
Inherits Explorer
Protected Overrides ReadOnly Property ItemsSource As Specialized.INotifyCollectionChanged
Get
Return Designer.FormNames
End Get
End Property
Protected Overrides Sub OnSelectionChanged()
Designer.SwitchTo(Designer.FormKeys(FilesList.SelectedIndex))
End Sub
Protected Overrides Sub OnDeleteItem()
If Designer.IsNew AndAlso Designer.PageCount = 1 OrElse FilesList.SelectedIndex = -1 Then
Beep()
Return
End If
Designer.ClosePage()
End Sub
Protected Overrides Function OnCommit(newName As String) As Boolean
Dim msg = Helper.FormNameExists(Designer, newName)
If msg <> "" Then
MsgBox(msg)
Return False
End If
Return Designer.ChangeFormName(newName)
End Function
Dim firstTime As Boolean = True
Private Sub Explorer_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
If firstTime Then
firstTime = False
FilesList.ItemsSource = ItemsSource
If FilesList.Items.Count > 0 Then FilesList.SelectedIndex = 0
End If
End Sub
Protected Overrides Function OnBeginEdit() As Boolean
Return True
End Function
Public Property Designer As Designer
Get
Return GetValue(DesignerProperty)
End Get
Set(value As Designer)
SetValue(DesignerProperty, value)
End Set
End Property
Public Shared ReadOnly DesignerProperty As DependencyProperty =
DependencyProperty.Register("Designer",
GetType(Designer), GetType(OpenedPagesExplorer))
End Class