Show client version in title. Auto switch to episodes page
This commit is contained in:
@@ -14,6 +14,9 @@ namespace EstusShots.Gtk
|
|||||||
internal class MainWindow : Window
|
internal class MainWindow : Window
|
||||||
{
|
{
|
||||||
private const string ApiUrl = "http://localhost:5000/api/";
|
private const string ApiUrl = "http://localhost:5000/api/";
|
||||||
|
private const string ApplicationName = "Estus Shots";
|
||||||
|
private const string Version = "0.1";
|
||||||
|
private const int EpisodesPageNumber = 1;
|
||||||
|
|
||||||
[UI] private readonly Label _infoLabel = null;
|
[UI] private readonly Label _infoLabel = null;
|
||||||
[UI] public readonly Button LoadButton = null;
|
[UI] public readonly Button LoadButton = null;
|
||||||
@@ -52,6 +55,7 @@ namespace EstusShots.Gtk
|
|||||||
EpisodesPage.Hide();
|
EpisodesPage.Hide();
|
||||||
|
|
||||||
Info("Application Started");
|
Info("Application Started");
|
||||||
|
UpdateTitle();
|
||||||
|
|
||||||
// No need to wait for the loading to finnish
|
// No need to wait for the loading to finnish
|
||||||
var _ = ReloadSeasons();
|
var _ = ReloadSeasons();
|
||||||
@@ -76,6 +80,13 @@ namespace EstusShots.Gtk
|
|||||||
};
|
};
|
||||||
SeasonsControl = new BindableListControl<Season>(columns, nameof(Season.SeasonId), SeasonsView);
|
SeasonsControl = new BindableListControl<Season>(columns, nameof(Season.SeasonId), SeasonsView);
|
||||||
SeasonsControl.OnSelectionChanged += SeasonsViewOnOnSelectionChanged;
|
SeasonsControl.OnSelectionChanged += SeasonsViewOnOnSelectionChanged;
|
||||||
|
SeasonsControl.TreeView.RowActivated += SeasonsViewOnRowActivated;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SeasonsViewOnRowActivated(object o, RowActivatedArgs args)
|
||||||
|
{
|
||||||
|
UpdateTitle();
|
||||||
|
Navigation.Page = EpisodesPageNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitEpisodesControl()
|
private void InitEpisodesControl()
|
||||||
@@ -227,5 +238,12 @@ namespace EstusShots.Gtk
|
|||||||
{
|
{
|
||||||
_infoLabel.Text = message;
|
_infoLabel.Text = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateTitle()
|
||||||
|
{
|
||||||
|
Title = SeasonsControl.SelectedItem == null
|
||||||
|
? $"{ApplicationName} v{Version}"
|
||||||
|
: $"{SeasonsControl.SelectedItem.DisplayName} - {ApplicationName} v{Version}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user