SnapDotNet.Apps.ViewModels.SignedIn.MainViewModel.MainViewModel C# (CSharp) Method

MainViewModel() public method

public MainViewModel ( ) : System
return System
        public MainViewModel()
        {
            if (App.SnapChatManager.Account == null) return;

            RecentSnaps = new ObservableCollection<Snap>();

            #region Commands

            SignOutCommand = new RelayCommand(async () =>
            {
                await App.LogoutAsync();
            });

            ViewSnapsCommand = new RelayCommand(() => App.CurrentFrame.Navigate(typeof (SnapsPage)));

            #endregion

            RecentSnaps = new ObservableCollection<Snap>(App.SnapChatManager.Account.Snaps.Take(MaximumRecentSnaps));
            GetFriends();

            App.SnapChatManager.PropertyChanged += delegate
            {
                if (App.SnapChatManager.Account != null)
                {
                    RecentSnaps = new ObservableCollection<Snap>(App.SnapChatManager.Account.Snaps.Take(MaximumRecentSnaps));
                    GetFriends();
                }
            };
            App.SnapChatManager.Account.PropertyChanged += delegate
            {
                RecentSnaps = new ObservableCollection<Snap>(App.SnapChatManager.Account.Snaps.Take(MaximumRecentSnaps));
                GetFriends();
            };

            App.SnapChatManager.Account.Snaps.CollectionChanged += delegate
            {
                RecentSnaps = new ObservableCollection<Snap>(App.SnapChatManager.Account.Snaps.Take(MaximumRecentSnaps));
            };
        }