Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions RetroBar/Controls/Toolbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void Settings_PropertyChanged(object sender, System.ComponentModel.Prope

Refresh();
}
else if (e.PropertyName == nameof(Settings.TaskbarScale))
else if (e.PropertyName == nameof(Settings.TaskbarScale) || e.PropertyName == nameof(Settings.RowCount))
{
Refresh();
}
Expand All @@ -93,8 +93,7 @@ private void Refresh()
return;
}

ListCollectionView cvs = (ListCollectionView)CollectionViewSource.GetDefaultView(Folder.Files);
cvs.Refresh();
SetItemsSource();
}

private void SetupFolder(string path)
Expand Down Expand Up @@ -201,13 +200,21 @@ private void ToolbarIcon_OnPreviewMouseRightButtonUp(object sender, MouseButtonE
{
return;
}


Mouse.Capture(null);
ShellFile file = icon.DataContext as ShellFile;

if (InvokeContextMenu(file, true))
if (file == null || string.IsNullOrWhiteSpace(file.Path))
{
e.Handled = true;
return;
}

e.Handled = true;

Dispatcher.BeginInvoke((Action)(() =>
{
InvokeContextMenu(file, true);
}));
}

private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
Expand Down Expand Up @@ -275,7 +282,7 @@ private bool InvokeContextMenu(ShellFile file, bool isInteractive)
{
return false;
}

var _ = new ShellItemContextMenu(new ShellItem[] { file }, Folder, IntPtr.Zero, HandleFileAction, isInteractive, false, new ShellMenuCommandBuilder(), GetFileCommandBuilder(file));
return true;
}
Expand Down
49 changes: 37 additions & 12 deletions RetroBar/PropertiesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using ManagedShell.WindowsTray;
using System.Runtime.CompilerServices;
using System.IO;
using System.Threading;

namespace RetroBar
{
Expand Down Expand Up @@ -306,18 +307,8 @@ private void OK_OnClick(object sender, RoutedEventArgs e)

private void SetQuickLaunchLocation_OnClick(object sender, RoutedEventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = (string)FindResource("quick_launch_folder");
#if NETCOREAPP3_0_OR_GREATER
fbd.UseDescriptionForTitle = true;
#endif
fbd.ShowNewFolderButton = false;
fbd.SelectedPath = Settings.Instance.QuickLaunchPath;

if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Settings.Instance.QuickLaunchPath = fbd.SelectedPath;
}
FBDThread fbdThread = new FBDThread();
fbdThread.Show();
}

private void PropertiesWindow_OnClosing(object sender, CancelEventArgs e)
Expand Down Expand Up @@ -474,4 +465,38 @@ private void OpenCustomThemesFolder_OnClick(object sender, RoutedEventArgs e)
ShellHelper.StartProcess(path);
}
}

public partial class FBDThread
{
private Thread t;

public FBDThread()
{
t = new Thread(new ParameterizedThreadStart(ShowFBD));
t.SetApartmentState(ApartmentState.STA);
}

public void Show()
{
t.Start(this);
}

private void ShowFBD(object o)
{
using (FolderBrowserDialog fbd = new FolderBrowserDialog())
{
fbd.Description = (string)System.Windows.Application.Current.Resources["quick_launch_folder"];
#if NETCOREAPP3_0_OR_GREATER
fbd.UseDescriptionForTitle = true;
#endif
fbd.ShowNewFolderButton = false;
fbd.SelectedPath = Settings.Instance.QuickLaunchPath;

if (fbd.ShowDialog() == DialogResult.OK)
{
Settings.Instance.QuickLaunchPath = fbd.SelectedPath;
}
}
}
}
}