Advertisement
Guest User

Home Page

a guest
Aug 4th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1. using System.Diagnostics;
  2. using System.ServiceModel.Channels;
  3. using Elead.Mobile.Utility.Messages;
  4. using Elead.Mobile.Utility.Services;
  5. using Elead.Mobile.Utility.ViewModels;
  6. using GalaSoft.MvvmLight.Messaging;
  7.  
  8. namespace Elead.Crm.Modules.Home.ViewModels
  9. {
  10.     /// <summary>
  11.     ///     Reprosents a view model for the home page.
  12.     /// </summary>
  13.     public class HomeViewModel : BaseViewModel
  14.     {
  15.         private readonly IClientService clientService;
  16.  
  17.         /// <summary>
  18.         ///     The Company name of hte user that is logged in.
  19.         /// </summary>
  20.         public string CompanyName { get; set; }
  21.         /// <summary>
  22.         ///     The Full name of the user that is logged in.
  23.         /// </summary>
  24.         public string FullName { get; set; }
  25.  
  26.         /// <summary>
  27.         ///     Builds a new viewmodel for the home page.
  28.         /// </summary>
  29.         public HomeViewModel(IApplicationNavigationService navigationService, IClientService clientService) : base(navigationService)
  30.         {
  31.             this.clientService = clientService;
  32.  
  33.             Messenger.Default.Register<LoginSuccessfulMessage>(this, UpdateViews);
  34.  
  35.             CompanyName = "No Company";
  36.             FullName = "No Name";
  37.         }
  38.  
  39.         private void UpdateViews(LoginSuccessfulMessage loginSuccessfulMessage)
  40.         {
  41.             if (loginSuccessfulMessage.LoginSuccessful)
  42.             {
  43.                 Debug.WriteLine("should be here");
  44.                 CompanyName = clientService.CurrentUser().CompanyName;
  45.                 FullName = clientService.CurrentUser().FullName;
  46.                 RaisePropertyChanged("CompanyName");
  47.                 RaisePropertyChanged("FullName");
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement