Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
Vereinsmeisterschaften.ViewModels.ShellViewModel Class Reference

ViewModel for the main shell of the application. More...

Inheritance diagram for Vereinsmeisterschaften.ViewModels.ShellViewModel:

Public Member Functions

 ShellViewModel (INavigationService navigationService, IDialogCoordinator dialogCoordinator, IWorkspaceService workspaceService)
 Constructor of the view model of the main shell of the application.
 
async Task<(bool saveOut, bool cancelOut)> CheckForUnsavedChangesAndQueryUserAction ()
 Show a dialog to the user when there are unsaved changes.
 

Protected Member Functions

void OnClosing (CancelEventArgs e)
 

Properties

string CurrentWorkspaceFolder [get]
 Path to the current workspace folder.
 
bool HasUnsavedChanges [get]
 True if the workspace has unsaved changes; otherwise false.
 
ObservableCollection< HamburgerMenuItem > MenuItems [get]
 Available menu items in the hamburger menu.
 
ObservableCollection< HamburgerMenuItem > OptionMenuItems [get]
 Available menu items in the hamburger menu options section.
 
RelayCommand GoBackCommand [get]
 Command to navigate back in the navigation stack.
 
ICommand MenuItemInvokedCommand [get]
 Command that is invoked when a menu item in the hamburger menu is clicked.
 
ICommand OptionsMenuItemInvokedCommand [get]
 Command that is invoked when an options menu item in the hamburger menu is clicked.
 
ICommand LoadedCommand [get]
 Command that is invoked when the shell is loaded.
 
ICommand UnloadedCommand [get]
 Command that is invoked when the shell is unloaded.
 
ICommand ClosingCommand [get]
 Command that is invoked when the shell is closing.
 
ICommand SaveWorkspaceCommand [get]
 Command to save the current workspace.
 
ICommand OpenWorkspaceFlyoutCommand [get]
 Command to open the workspace flyout.
 

Events

EventHandler WindowCloseRequested
 Event that is raised when the window close is requested.
 

Private Member Functions

async void OnLoaded ()
 
void OnUnloaded ()
 
void _workspaceService_PropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e)
 
void updateMenuItemsEnabledState ()
 Update the enabled state of the menu items based on whether a workspace is open.
 
void NavigateTo (Type targetViewModel)
 
void OnNavigated (object sender, string viewModelName)
 

Private Attributes

bool _isWorkspaceFlyoutOpen
 True if the workspace flyout is open (used to open, save, ... the workspace)
 
readonly INavigationService _navigationService
 
IDialogCoordinator _dialogCoordinator
 
IWorkspaceService _workspaceService
 
HamburgerMenuItem _selectedMenuItem
 Menu item that is currently selected in the hamburger menu.
 
HamburgerMenuItem _selectedOptionsMenuItem
 Menu item that is currently selected in the hamburger menu options section.
 
RelayCommand _goBackCommand
 
ICommand _menuItemInvokedCommand
 
ICommand _optionsMenuItemInvokedCommand
 
ICommand _loadedCommand
 
ICommand _unloadedCommand
 
ICommand _closingCommand
 
ICommand _saveWorkspaceCommand
 
ICommand _openWorkspaceFlyoutCommand
 
bool _forceClose = false
 

Static Private Attributes

const string SETTING_KEY_LAST_WORKSPACE_PATHS = "LastWorkspacePaths"
 
const string SETTING_KEY_LAST_WORKSPACE_FOLDER = "LastWorkspaceFolder"
 

Detailed Description

ViewModel for the main shell of the application.

Definition at line 18 of file ShellViewModel.cs.

Constructor & Destructor Documentation

◆ ShellViewModel()

Vereinsmeisterschaften.ViewModels.ShellViewModel.ShellViewModel ( INavigationService navigationService,
IDialogCoordinator dialogCoordinator,
IWorkspaceService workspaceService )

Constructor of the view model of the main shell of the application.

Parameters
navigationServiceINavigationService object
dialogCoordinatorIDialogCoordinator object
workspaceServiceIWorkspaceService object

Definition at line 156 of file ShellViewModel.cs.

Member Function Documentation

◆ _workspaceService_PropertyChanged()

void Vereinsmeisterschaften.ViewModels.ShellViewModel._workspaceService_PropertyChanged ( object sender,
System.ComponentModel.PropertyChangedEventArgs e )
private

Definition at line 198 of file ShellViewModel.cs.

◆ CheckForUnsavedChangesAndQueryUserAction()

async Task<(bool saveOut, bool cancelOut)> Vereinsmeisterschaften.ViewModels.ShellViewModel.CheckForUnsavedChangesAndQueryUserAction ( )

Show a dialog to the user when there are unsaved changes.

The user can choose to save, not save or cancel.

Returns
Tuple of two bools (save, cancel)

Definition at line 282 of file ShellViewModel.cs.

◆ NavigateTo()

void Vereinsmeisterschaften.ViewModels.ShellViewModel.NavigateTo ( Type targetViewModel)
private

Definition at line 311 of file ShellViewModel.cs.

◆ OnClosing()

void Vereinsmeisterschaften.ViewModels.ShellViewModel.OnClosing ( CancelEventArgs e)
protected

Definition at line 240 of file ShellViewModel.cs.

◆ OnLoaded()

async void Vereinsmeisterschaften.ViewModels.ShellViewModel.OnLoaded ( )
private

Definition at line 167 of file ShellViewModel.cs.

◆ OnNavigated()

void Vereinsmeisterschaften.ViewModels.ShellViewModel.OnNavigated ( object sender,
string viewModelName )
private

Definition at line 319 of file ShellViewModel.cs.

◆ OnUnloaded()

void Vereinsmeisterschaften.ViewModels.ShellViewModel.OnUnloaded ( )
private

Definition at line 192 of file ShellViewModel.cs.

◆ updateMenuItemsEnabledState()

void Vereinsmeisterschaften.ViewModels.ShellViewModel.updateMenuItemsEnabledState ( )
private

Update the enabled state of the menu items based on whether a workspace is open.

Definition at line 217 of file ShellViewModel.cs.

Member Data Documentation

◆ _closingCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._closingCommand
private

Definition at line 102 of file ShellViewModel.cs.

◆ _dialogCoordinator

IDialogCoordinator Vereinsmeisterschaften.ViewModels.ShellViewModel._dialogCoordinator
private

Definition at line 39 of file ShellViewModel.cs.

◆ _forceClose

bool Vereinsmeisterschaften.ViewModels.ShellViewModel._forceClose = false
private

Definition at line 234 of file ShellViewModel.cs.

◆ _goBackCommand

RelayCommand Vereinsmeisterschaften.ViewModels.ShellViewModel._goBackCommand
private

Definition at line 97 of file ShellViewModel.cs.

◆ _isWorkspaceFlyoutOpen

bool Vereinsmeisterschaften.ViewModels.ShellViewModel._isWorkspaceFlyoutOpen
private

True if the workspace flyout is open (used to open, save, ... the workspace)

Definition at line 34 of file ShellViewModel.cs.

◆ _loadedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._loadedCommand
private

Definition at line 100 of file ShellViewModel.cs.

◆ _menuItemInvokedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._menuItemInvokedCommand
private

Definition at line 98 of file ShellViewModel.cs.

◆ _navigationService

readonly INavigationService Vereinsmeisterschaften.ViewModels.ShellViewModel._navigationService
private

Definition at line 38 of file ShellViewModel.cs.

◆ _openWorkspaceFlyoutCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._openWorkspaceFlyoutCommand
private

Definition at line 104 of file ShellViewModel.cs.

◆ _optionsMenuItemInvokedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._optionsMenuItemInvokedCommand
private

Definition at line 99 of file ShellViewModel.cs.

◆ _saveWorkspaceCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._saveWorkspaceCommand
private

Definition at line 103 of file ShellViewModel.cs.

◆ _selectedMenuItem

HamburgerMenuItem Vereinsmeisterschaften.ViewModels.ShellViewModel._selectedMenuItem
private

Menu item that is currently selected in the hamburger menu.

Definition at line 59 of file ShellViewModel.cs.

◆ _selectedOptionsMenuItem

HamburgerMenuItem Vereinsmeisterschaften.ViewModels.ShellViewModel._selectedOptionsMenuItem
private

Menu item that is currently selected in the hamburger menu options section.

Definition at line 65 of file ShellViewModel.cs.

◆ _unloadedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel._unloadedCommand
private

Definition at line 101 of file ShellViewModel.cs.

◆ _workspaceService

IWorkspaceService Vereinsmeisterschaften.ViewModels.ShellViewModel._workspaceService
private

Definition at line 40 of file ShellViewModel.cs.

◆ SETTING_KEY_LAST_WORKSPACE_FOLDER

const string Vereinsmeisterschaften.ViewModels.ShellViewModel.SETTING_KEY_LAST_WORKSPACE_FOLDER = "LastWorkspaceFolder"
staticprivate

Definition at line 47 of file ShellViewModel.cs.

◆ SETTING_KEY_LAST_WORKSPACE_PATHS

const string Vereinsmeisterschaften.ViewModels.ShellViewModel.SETTING_KEY_LAST_WORKSPACE_PATHS = "LastWorkspacePaths"
staticprivate

Definition at line 46 of file ShellViewModel.cs.

Property Documentation

◆ ClosingCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.ClosingCommand
get

Command that is invoked when the shell is closing.

Definition at line 134 of file ShellViewModel.cs.

◆ CurrentWorkspaceFolder

string Vereinsmeisterschaften.ViewModels.ShellViewModel.CurrentWorkspaceFolder
get

Path to the current workspace folder.

Definition at line 23 of file ShellViewModel.cs.

◆ GoBackCommand

RelayCommand Vereinsmeisterschaften.ViewModels.ShellViewModel.GoBackCommand
get

Command to navigate back in the navigation stack.

Definition at line 109 of file ShellViewModel.cs.

◆ HasUnsavedChanges

bool Vereinsmeisterschaften.ViewModels.ShellViewModel.HasUnsavedChanges
get

True if the workspace has unsaved changes; otherwise false.

Definition at line 28 of file ShellViewModel.cs.

◆ LoadedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.LoadedCommand
get

Command that is invoked when the shell is loaded.

Definition at line 124 of file ShellViewModel.cs.

◆ MenuItemInvokedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.MenuItemInvokedCommand
get

Command that is invoked when a menu item in the hamburger menu is clicked.

Definition at line 114 of file ShellViewModel.cs.

◆ MenuItems

ObservableCollection<HamburgerMenuItem> Vereinsmeisterschaften.ViewModels.ShellViewModel.MenuItems
get
Initial value:
= new ObservableCollection<HamburgerMenuItem>()
{
new HamburgerMenuGlyphItem() { Label = Resources.ShellMainPage, Glyph = "\uE80F", TargetPageType = typeof(MainViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellWorkspacePage, Glyph = "\uE821", TargetPageType = typeof(WorkspaceViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellCompetitionPage, Glyph = "\uF0E3", TargetPageType = typeof(CompetitionViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellPeoplePage, Glyph = "\uE77B", TargetPageType = typeof(PeopleViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellPrepareRacesPage, Glyph = "\uE7C1", TargetPageType = typeof(PrepareRacesViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellTimeInputPage, Glyph = "\uE916", TargetPageType = typeof(TimeInputViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellResultsPage, Glyph = "\uE9F9", TargetPageType = typeof(ResultsViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellAnalyticsPage, Glyph = "\uE9D2", TargetPageType = typeof(AnalyticsViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellCreateDocumentsPage, Glyph = "\uE8A5", TargetPageType = typeof(CreateDocumentsViewModel) },
}
View model for the main view of the application.
ViewModel for the workspace, managing the current workspace folder, settings, and commands to load,...

Available menu items in the hamburger menu.

Definition at line 70 of file ShellViewModel.cs.

◆ OpenWorkspaceFlyoutCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.OpenWorkspaceFlyoutCommand
get

Command to open the workspace flyout.

Definition at line 144 of file ShellViewModel.cs.

◆ OptionMenuItems

ObservableCollection<HamburgerMenuItem> Vereinsmeisterschaften.ViewModels.ShellViewModel.OptionMenuItems
get
Initial value:
= new ObservableCollection<HamburgerMenuItem>()
{
new HamburgerMenuGlyphItem() { Label = Resources.ShellSettingsPage, Glyph = "\uE713", TargetPageType = typeof(SettingsViewModel) }
}

Available menu items in the hamburger menu options section.

Definition at line 86 of file ShellViewModel.cs.

◆ OptionsMenuItemInvokedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.OptionsMenuItemInvokedCommand
get

Command that is invoked when an options menu item in the hamburger menu is clicked.

Definition at line 119 of file ShellViewModel.cs.

◆ SaveWorkspaceCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.SaveWorkspaceCommand
get

Command to save the current workspace.

Definition at line 139 of file ShellViewModel.cs.

◆ UnloadedCommand

ICommand Vereinsmeisterschaften.ViewModels.ShellViewModel.UnloadedCommand
get

Command that is invoked when the shell is unloaded.

Definition at line 129 of file ShellViewModel.cs.

Event Documentation

◆ WindowCloseRequested

EventHandler Vereinsmeisterschaften.ViewModels.ShellViewModel.WindowCloseRequested

Event that is raised when the window close is requested.

Definition at line 239 of file ShellViewModel.cs.


The documentation for this class was generated from the following file: