Delete icon on workspace removal

This commit is contained in:
donlaci
2024-08-22 09:58:45 +02:00
parent c38412c7cb
commit 8911a6eb63

View File

@@ -348,10 +348,27 @@ namespace WorkspacesEditor.ViewModels
{
Workspaces.Remove(selectedProject);
_workspacesEditorIO.SerializeWorkspaces(Workspaces.ToList());
RemoveShortcut(selectedProject);
OnPropertyChanged(new PropertyChangedEventArgs(nameof(WorkspacesView)));
SendDeleteTelemetryEvent();
}
private void RemoveShortcut(Project selectedProject)
{
string shortcutAddress = Path.Combine(FolderUtils.Desktop(), selectedProject.Name + ".lnk");
string shortcutIconFilename = Path.Combine(FolderUtils.Temp(), selectedProject.Id + ".ico");
if (File.Exists(shortcutIconFilename))
{
File.Delete(shortcutIconFilename);
}
if (File.Exists(shortcutAddress))
{
File.Delete(shortcutAddress);
}
}
public void SetMainWindow(MainWindow mainWindow)
{
_mainWindow = mainWindow;