Skip to content

Commit

Permalink
*All* app icons were previously (re)loaded from file every time an ap…
Browse files Browse the repository at this point in the history
…p is created or edited. Now icons are *individually* reloaded only when an app is added/edited, significantly improving performance. Addresses issue #136
  • Loading branch information
kimmknight committed Sep 21, 2024
1 parent fb4e4c0 commit 25681bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion remoteapp-tool/RemoteAppEditWindow.vb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Public Class RemoteAppEditWindow
HelpSystem.SetupTips(Me)
Me.LoadValues()
Dim dlgResult = Me.ShowDialog()
RemoteAppMainWindow.ReloadApps()
Me.Dispose()
Return RemoteApp
End Function
Expand Down
22 changes: 17 additions & 5 deletions remoteapp-tool/RemoteAppMainWindow.vb
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ Public Class RemoteAppMainWindow
Apps = SystemApps.GetAll

For Each App As RemoteApp In Apps
SmallIcons.Images.RemoveByKey(App.Name)
Dim TheBitmap = GetAppBitmap(App.Name)
' Check if the image is already present in SmallIcons before adding it
If Not Me.SmallIcons.Images.ContainsKey(App.Name) Then
Dim TheBitmap = GetAppBitmap(App.Name)
Me.SmallIcons.Images.Add(App.Name, TheBitmap)
End If

' Create the ListView item
Dim AppItem As New ListViewItem(App.Name)
AppItem.ToolTipText = App.FullName
AppItem.ImageIndex = 0
Me.SmallIcons.Images.Add(App.Name, TheBitmap)
AppItem.ImageKey = App.Name
AppItem.ImageKey = App.Name ' Use the ImageKey as it was set
AppList.Items.Add(AppItem)
Next

Expand Down Expand Up @@ -116,10 +119,19 @@ Public Class RemoteAppMainWindow
Private Sub EditRemoteApp(AppName As String)
Dim sra As New SystemRemoteApps
RemoteAppEditWindow.EditRemoteApp(sra.GetApp(AppName))
DeleteImage(AppName)
ReloadApps()
End Sub

Private Sub DeleteImage(AppName)
If Me.SmallIcons.Images.ContainsKey(AppName) Then
Me.SmallIcons.Images.RemoveByKey(AppName)
End If
End Sub

Private Sub DeleteButton_Click(sender As Object, e As EventArgs) Handles DeleteButton.Click
DeleteRemoteApp(AppList.SelectedItems(0).Text)
DeleteImage(AppList.SelectedItems(0).Text)
ReloadApps()
End Sub

Expand Down

0 comments on commit 25681bc

Please sign in to comment.