Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

8 місяці тому
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Example.Connectors;
  2. using Example.Models;
  3. using Material.Icons;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Input;
  10. namespace Example.ViewModels
  11. {
  12. public class MainViewModel : ViewModelBase
  13. {
  14. private PlayerInfoModule _playerInfoModule = GetPlayerInfo.PlayerDetails;
  15. private ViewModelBase _currentChildView;
  16. private string _windowtitle;
  17. private MaterialIconKind _windowIcon;
  18. public PlayerInfoModule playerInfoModule
  19. {
  20. get
  21. {
  22. return _playerInfoModule;
  23. }
  24. set
  25. {
  26. _playerInfoModule = value;
  27. }
  28. }
  29. public ViewModelBase CurrentChildView { get => _currentChildView; set { _currentChildView = value; OnPropertyChanged(nameof(CurrentChildView)); } }
  30. public string Windowtitle { get => _windowtitle; set { _windowtitle = value; OnPropertyChanged(nameof(Windowtitle)); } }
  31. public MaterialIconKind WindowIcon { get => _windowIcon; set { _windowIcon = value; OnPropertyChanged(nameof(WindowIcon)); } }
  32. //--> Commands
  33. public ICommand ShowHomeViewCommand { get; }
  34. public ICommand ShowProfileViewCommand { get; }
  35. public MainViewModel()
  36. {
  37. //Initialize Commands
  38. ShowHomeViewCommand = new ViewModelCommand(ExecuteShowHomeViewCommand);
  39. ShowProfileViewCommand = new ViewModelCommand(ExecuteShowProfileViewCommand);
  40. // Default View
  41. ExecuteShowHomeViewCommand(null);
  42. }
  43. private void ExecuteShowProfileViewCommand(object obj)
  44. {
  45. CurrentChildView = new ProfileViewModel();
  46. Windowtitle = "Profile";
  47. WindowIcon = MaterialIconKind.Person;
  48. }
  49. private void ExecuteShowHomeViewCommand(object obj)
  50. {
  51. CurrentChildView = new HomeViewModel();
  52. Windowtitle = "Home";
  53. WindowIcon = MaterialIconKind.Home;
  54. }
  55. }
  56. }