Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Diagnostics;
- using System.ServiceModel.Channels;
- using Elead.Mobile.Utility.Messages;
- using Elead.Mobile.Utility.Services;
- using Elead.Mobile.Utility.ViewModels;
- using GalaSoft.MvvmLight.Messaging;
- namespace Elead.Crm.Modules.Home.ViewModels
- {
- /// <summary>
- /// Reprosents a view model for the home page.
- /// </summary>
- public class HomeViewModel : BaseViewModel
- {
- private readonly IClientService clientService;
- /// <summary>
- /// The Company name of hte user that is logged in.
- /// </summary>
- public string CompanyName { get; set; }
- /// <summary>
- /// The Full name of the user that is logged in.
- /// </summary>
- public string FullName { get; set; }
- /// <summary>
- /// Builds a new viewmodel for the home page.
- /// </summary>
- public HomeViewModel(IApplicationNavigationService navigationService, IClientService clientService) : base(navigationService)
- {
- this.clientService = clientService;
- Messenger.Default.Register<LoginSuccessfulMessage>(this, UpdateViews);
- CompanyName = "No Company";
- FullName = "No Name";
- }
- private void UpdateViews(LoginSuccessfulMessage loginSuccessfulMessage)
- {
- if (loginSuccessfulMessage.LoginSuccessful)
- {
- Debug.WriteLine("should be here");
- CompanyName = clientService.CurrentUser().CompanyName;
- FullName = clientService.CurrentUser().FullName;
- RaisePropertyChanged("CompanyName");
- RaisePropertyChanged("FullName");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement