diff --git a/EtoForms.Controls.Custom/UserIdle/UserIdleChecker.cs b/EtoForms.Controls.Custom/UserIdle/UserIdleChecker.cs
index 558157a0..4a9b731a 100644
--- a/EtoForms.Controls.Custom/UserIdle/UserIdleChecker.cs
+++ b/EtoForms.Controls.Custom/UserIdle/UserIdleChecker.cs
@@ -94,11 +94,11 @@ public bool IsUserIdle
if (!idleEventInvoked)
{
previousActiveTime = DateTime.Now;
- UserActivated?.Invoke(this, new UserIdleEventArgs());
+ UserActivated?.Invoke(this, new UserIdleEventArgs(false));
}
else
{
- UserIdle?.Invoke(this, new UserIdleEventArgs());
+ UserIdle?.Invoke(this, new UserIdleEventArgs(true));
}
}
}
@@ -173,7 +173,7 @@ private DateTime PreviousActiveTime
if (idleEventInvoked)
{
idleEventInvoked = false;
- UserActivated?.Invoke(this, new UserIdleEventArgs());
+ UserActivated?.Invoke(this, new UserIdleEventArgs(false));
}
}
}
@@ -188,7 +188,7 @@ private void ThreadFunc()
if (spanSeconds > UserInactiveInterval)
{
idleEventInvoked = true;
- UserIdle?.Invoke(this, new UserIdleEventArgs());
+ UserIdle?.Invoke(this, new UserIdleEventArgs(true));
}
else
{
diff --git a/EtoForms.Controls.Custom/UserIdle/UserIdleEventArgs.cs b/EtoForms.Controls.Custom/UserIdle/UserIdleEventArgs.cs
index 205781fb..23d559e6 100644
--- a/EtoForms.Controls.Custom/UserIdle/UserIdleEventArgs.cs
+++ b/EtoForms.Controls.Custom/UserIdle/UserIdleEventArgs.cs
@@ -35,4 +35,18 @@ namespace EtoForms.Controls.Custom.UserIdle;
///
public class UserIdleEventArgs : EventArgs
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// if set to true the user is currently idle.
+ public UserIdleEventArgs(bool isUserIdle)
+ {
+ IsUserIdle = isUserIdle;
+ }
+
+ ///
+ /// Gets a value indicating whether the user is currently idle.
+ ///
+ /// true if the user is currently idle; otherwise, false.
+ private bool IsUserIdle { get; }
}
\ No newline at end of file
diff --git a/amp.EtoForms/Dialogs/DialogAddFilesProgress.cs b/amp.EtoForms/Dialogs/DialogAddFilesProgress.cs
index aef492cb..e32f6c72 100644
--- a/amp.EtoForms/Dialogs/DialogAddFilesProgress.cs
+++ b/amp.EtoForms/Dialogs/DialogAddFilesProgress.cs
@@ -27,7 +27,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.ComponentModel;
using amp.Database;
using amp.Database.DataModel;
-using amp.EtoForms.Utilities;
using amp.Shared.Classes;
using amp.Shared.Constants;
using amp.Shared.Localization;
@@ -172,7 +171,7 @@ private DialogAddFilesProgress(AmpContext context, long albumId)
private void DialogAddFilesProgress_Closed(object? sender, EventArgs e)
{
- defaultCancelButtonHandler.Dispose();
+ defaultCancelButtonHandler?.Dispose();
}
#region InternalEvents
diff --git a/amp.EtoForms/Dialogs/DialogCheckNewVersion.cs b/amp.EtoForms/Dialogs/DialogCheckNewVersion.cs
index df5117fe..52319790 100644
--- a/amp.EtoForms/Dialogs/DialogCheckNewVersion.cs
+++ b/amp.EtoForms/Dialogs/DialogCheckNewVersion.cs
@@ -26,7 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Globalization;
using System.Text;
-using amp.EtoForms.Utilities;
using amp.Shared.Classes;
using amp.Shared.Localization;
using amp.Shared.UpdateCheck;
diff --git a/amp.EtoForms/Dialogs/DialogDatabaseConvertProgress.cs b/amp.EtoForms/Dialogs/DialogDatabaseConvertProgress.cs
index d05cc2a9..d56ef158 100644
--- a/amp.EtoForms/Dialogs/DialogDatabaseConvertProgress.cs
+++ b/amp.EtoForms/Dialogs/DialogDatabaseConvertProgress.cs
@@ -26,7 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.ComponentModel;
using amp.Database.LegacyConvert;
-using amp.EtoForms.Utilities;
using amp.Shared.Localization;
using Eto.Drawing;
using Eto.Forms;
diff --git a/amp.EtoForms/Dialogs/DialogUpdateTagData.cs b/amp.EtoForms/Dialogs/DialogUpdateTagData.cs
index b36c5519..ce66f50d 100644
--- a/amp.EtoForms/Dialogs/DialogUpdateTagData.cs
+++ b/amp.EtoForms/Dialogs/DialogUpdateTagData.cs
@@ -26,7 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using amp.Database;
using amp.EtoForms.DtoClasses;
-using amp.EtoForms.Utilities;
using amp.Shared.Classes;
using amp.Shared.Localization;
using Eto.Drawing;
diff --git a/amp.EtoForms/FormMain.Events.cs b/amp.EtoForms/FormMain.Events.cs
index 4f565831..669e624a 100644
--- a/amp.EtoForms/FormMain.Events.cs
+++ b/amp.EtoForms/FormMain.Events.cs
@@ -115,7 +115,7 @@ await playbackOrder.MoveToQueueTopOrBottom(tracks, shift, e.Key == Keys.PageUp,
if (e.Key == Keys.Delete)
{
- await gvAudioTracks.DeleteSongs(context, tracks, FilterTracks);
+ await gvAudioTracks.DeleteSongs(context, tracks, () => FilterTracks(false));
e.Handled = true;
return;
@@ -175,12 +175,12 @@ private void FormMain_LocationChanged(object? sender, EventArgs e)
private void TbSearch_TextChanged(object? sender, EventArgs e)
{
- FilterTracks();
+ FilterTracks(false);
}
private void BtnShowQueue_CheckedChange(object? sender, CheckedChangeEventArguments e)
{
- FilterTracks();
+ FilterTracks(false);
}
private void FormMain_Closing(object? sender, CancelEventArgs e)
@@ -272,14 +272,7 @@ private void PlaybackManagerTrackChanged(object? sender, TrackChangedArgs e)
lbTracksTitle.Text = track?.GetAudioTrackName() ?? string.Empty;
currentTrackId = track != null ? e.AudioTrackId : 0;
- var dataSource = gvAudioTracks.DataStore.Cast().ToList();
- var displayTrack = dataSource.FindIndex(f => f.AudioTrackId == e.AudioTrackId);
- if (displayTrack != -1)
- {
- gvAudioTracks.SelectedRow = displayTrack;
- gvAudioTracks.ScrollToRow(displayTrack);
- gvAudioTracks.Focus();
- }
+ FocusPlayingTrack(e.AudioTrackId);
if (track != null && Globals.Settings.ShowAlbumImage)
{
@@ -419,7 +412,7 @@ private void AddFilesToDatabase_Executed(object? sender, EventArgs e)
private void IdleChecker_UserIdleChanged(object? sender, UserIdleEventArgs e)
{
- FilterTracks();
+ FilterTracks(true);
}
private void FormMain_Shown(object? sender, EventArgs e)
@@ -821,4 +814,18 @@ private void OpenHelp_Executed(object? sender, EventArgs e)
{
Help.LaunchHelpFromSettings(this);
}
+
+ private void CmbAlbumSelect_SelectedIndexChanged(object? sender, EventArgs e)
+ {
+ if (suspendAlbumChange || cmbAlbumSelect.SelectedIndex < 0)
+ {
+ return;
+ }
+
+ Globals.LoggerSafeInvoke(() =>
+ {
+ CurrentAlbumId = albums[cmbAlbumSelect.SelectedIndex].Id;
+ RefreshCurrentAlbum();
+ });
+ }
}
\ No newline at end of file
diff --git a/amp.EtoForms/FormMain.Fields.cs b/amp.EtoForms/FormMain.Fields.cs
index 982afbe7..d98a1df3 100644
--- a/amp.EtoForms/FormMain.Fields.cs
+++ b/amp.EtoForms/FormMain.Fields.cs
@@ -126,4 +126,8 @@ partial class FormMain
// Update check
private readonly UITimer timerCheckUpdates = new() { Interval = 15, };
+
+ // User idle
+ private List userIdleSelectedRows = new();
+ private int userIdleSelectedRow = -1;
}
\ No newline at end of file
diff --git a/amp.EtoForms/FormMain.Layout.cs b/amp.EtoForms/FormMain.Layout.cs
index bb83218e..690918f1 100644
--- a/amp.EtoForms/FormMain.Layout.cs
+++ b/amp.EtoForms/FormMain.Layout.cs
@@ -73,20 +73,6 @@ private Control CreateAlbumSelector()
return result;
}
- private void CmbAlbumSelect_SelectedIndexChanged(object? sender, EventArgs e)
- {
- if (suspendAlbumChange || cmbAlbumSelect.SelectedIndex < 0)
- {
- return;
- }
-
- Globals.LoggerSafeInvoke(() =>
- {
- CurrentAlbumId = albums[cmbAlbumSelect.SelectedIndex].Id;
- RefreshCurrentAlbum();
- });
- }
-
private StackLayout CreateToolbar()
{
var result = new StackLayout
diff --git a/amp.EtoForms/FormMain.Methods.cs b/amp.EtoForms/FormMain.Methods.cs
index 30fe5d24..3351f570 100644
--- a/amp.EtoForms/FormMain.Methods.cs
+++ b/amp.EtoForms/FormMain.Methods.cs
@@ -156,7 +156,7 @@ private async Task UpdateQueueFunc(Dictionary updateQueueData, bool a
if (btnShowQueue.Checked && count > 0)
{
- FilterTracks();
+ FilterTracks(false);
}
UpdateCounters();
@@ -263,14 +263,26 @@ private void SetupInitialSettings()
TrackDisplayNameGenerate.TrackNamingFallbackToFileNameWhenNoLetters = Globals.Settings.TrackNamingFallbackToFileNameWhenNoLetters;
}
- private void FilterTracks()
+ private void FilterTracks(bool fromUserIdleEvent)
{
Application.Instance.Invoke(() =>
{
+ if (!fromUserIdleEvent)
+ {
+ userIdleSelectedRows.Clear();
+ userIdleSelectedRow = -1;
+ }
+
var text = tbSearch.Text;
var queueOnly = btnShowQueue.Checked;
var userIdle = idleChecker.IsUserIdle;
+ // The user went idle, save the current selection.
+ if (userIdle && fromUserIdleEvent)
+ {
+ userIdleSelectedRows = gvAudioTracks.SelectedRows.ToList();
+ userIdleSelectedRow = gvAudioTracks.SelectedRow;
+ }
filteredTracks = tracks;
@@ -289,12 +301,25 @@ private void FilterTracks()
}
gvAudioTracks.DataStore = filteredTracks;
+
+ if (!userIdle && userIdleSelectedRow != -1 && fromUserIdleEvent)
+ {
+ gvAudioTracks.SelectedRows = userIdleSelectedRows;
+ gvAudioTracks.SelectedRow = userIdleSelectedRow;
+ gvAudioTracks.ScrollToRow(userIdleSelectedRow);
+ }
+
UpdateCounters();
if (userIdle && !gvAudioTracks.HasFocus)
{
gvAudioTracks.Focus();
}
+
+ if (userIdle)
+ {
+ FocusPlayingTrack(currentTrackId, userIdleSelectedRow);
+ }
});
}
@@ -474,4 +499,22 @@ private async Task UpdateCheck(bool autoCheck)
Globals.SaveSettings();
}
}
+
+ private void FocusPlayingTrack(long trackId, int compareToRow = -1)
+ {
+ var dataSource = gvAudioTracks.DataStore.Cast().ToList();
+ var displayTrack = dataSource.FindIndex(f => f.AudioTrackId == trackId);
+
+ if (compareToRow != -1 && displayTrack == compareToRow)
+ {
+ return;
+ }
+
+ if (displayTrack != -1)
+ {
+ gvAudioTracks.SelectedRow = displayTrack;
+ gvAudioTracks.ScrollToRow(displayTrack);
+ gvAudioTracks.Focus();
+ }
+ }
}
\ No newline at end of file
diff --git a/amp.EtoForms/FormMain.Properties.cs b/amp.EtoForms/FormMain.Properties.cs
index a62d5af4..782ccb0c 100644
--- a/amp.EtoForms/FormMain.Properties.cs
+++ b/amp.EtoForms/FormMain.Properties.cs
@@ -55,6 +55,8 @@ private long CurrentAlbumId
Globals.Settings.SelectedAlbum = value;
Globals.SaveSettings();
SetTitle();
+ userIdleSelectedRow = -1;
+ userIdleSelectedRows.Clear();
}
}
}
diff --git a/amp.EtoForms/Forms/FormAlbums.cs b/amp.EtoForms/Forms/FormAlbums.cs
index 60aae22a..149316b3 100644
--- a/amp.EtoForms/Forms/FormAlbums.cs
+++ b/amp.EtoForms/Forms/FormAlbums.cs
@@ -34,7 +34,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using EtoForms.Controls.Custom.Utilities;
using FluentIcons.Resources.Filled;
using Microsoft.EntityFrameworkCore;
-using amp.EtoForms.Utilities;
namespace amp.EtoForms.Forms;
diff --git a/amp.EtoForms/Forms/FormColorSettings.cs b/amp.EtoForms/Forms/FormColorSettings.cs
index e46c60ae..cd3160f8 100644
--- a/amp.EtoForms/Forms/FormColorSettings.cs
+++ b/amp.EtoForms/Forms/FormColorSettings.cs
@@ -28,7 +28,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Globalization;
using System.Reflection;
using amp.EtoForms.Settings;
-using amp.EtoForms.Utilities;
using amp.Shared.Extensions;
using amp.Shared.Localization;
using Eto.Drawing;
diff --git a/amp.EtoForms/Forms/FormDialogTrackInfo.cs b/amp.EtoForms/Forms/FormDialogTrackInfo.cs
index 909b84a0..dc181212 100644
--- a/amp.EtoForms/Forms/FormDialogTrackInfo.cs
+++ b/amp.EtoForms/Forms/FormDialogTrackInfo.cs
@@ -26,7 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using amp.EtoForms.DtoClasses;
using amp.EtoForms.Forms.EventArguments;
-using amp.EtoForms.Utilities;
using amp.Shared.Classes;
using amp.Shared.Localization;
using ATL;
diff --git a/amp.EtoForms/amp.EtoForms.csproj b/amp.EtoForms/amp.EtoForms.csproj
index 22891b65..16ef83c8 100644
--- a/amp.EtoForms/amp.EtoForms.csproj
+++ b/amp.EtoForms/amp.EtoForms.csproj
@@ -16,7 +16,7 @@
MIT
bin\$(Configuration)\amp.EtoForms.xml
true
- 1.0.0.1
+ 1.0.0.2
diff --git a/amp.Shared/Localization/Messages.fi.resx b/amp.Shared/Localization/Messages.fi.resx
index 8004994b..50cf2536 100644
--- a/amp.Shared/Localization/Messages.fi.resx
+++ b/amp.Shared/Localization/Messages.fi.resx
@@ -1,6 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 1.3
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
Muunna tietokanta
-
+
Muunnetaanko aiempi tietokanta uuteen muotoon. Siihen voi kulua muutama minuutti.
-
+
{0}{1} kappaletta, {2} albumia, {3} albumimerkintää ja {4} jonomerkintää muunnetaan.
-
+
Tiedostoa '{0}' ei löytynyt.
-
+
Huomautus
-
+
Oletusalbumia ei voi poistaa. Ainoastaan uudelleennimeäminen on mahdollista.
-
- Nimertön
+
+ Nimetön
-
+
Albumin nimi ei voi olla tyhjä merkkijono.
-
+
Tallennetaanko tunnisteen muutokset? Tämä muokkaa varsinaista musiikkitiedostoa.
-
+
Varmistus
-
+
Latataan {0:F1} %
-
+
Sinulla on jo käytössäsi viimeisin versio sovelluksesta.
-
+
Ilmoitus
-
+
Määritä apukansion polku asetuksista.
\ No newline at end of file