コード例 #1
0
        public WorkspaceViewModel(ProtoBridge bridge, StaffAccountBLL currUser)
        {
            _bridge = bridge;
            _currentUser = currUser;

            _activeScreen = new HomeScreenViewModel(bridge, currUser);
            _activeScreen.ScreenTransition += OnTransition;
            _activeScreen.LoggedOut += OnLoggedOut;
            _activeScreen.LoggedIn += OnLoggedIn;
            ActiveLayer = _activeScreen;
            PassiveLayer = null;

            DisplayName = _activeScreen.DisplayName;
        }
コード例 #2
0
        private void OnTransition(TransitionPath path, StaffAccountBLL currUser)
        {
            ScreenBaseViewModel scr = null;

            //ALT: Use a Dictionary if this becomes too large
            switch (path.To)
            {
                case LibraryScreens.SEARCH:
                    scr = new SearchHostScreenViewModel(_bridge, currUser);
                    break;

                case LibraryScreens.HOME:
                    scr = new HomeScreenViewModel(_bridge, currUser);
                    break;

                    //FIXME:Add the proper 4 extra manip enum vals & modify
                    //transition stuff accordingly
                case LibraryScreens.MANIPULATE_RECORDS:
                    scr = new ManipBookDetailsViewModel(_bridge, currUser);
                    break;

                case LibraryScreens.TRANSACTIONS_ENTERID:
                    scr = new EnterMemberIdViewModel(_bridge, currUser);
                    break;

                case LibraryScreens.TRANSACTIONS:
                    scr = new MemberAccountViewModel(_bridge, currUser);
                    break;
                    //etc...
            }

            //Set active and passive layers for animation and inform
            //listener(view) that animation can be performed
            PassiveLayer = _activeScreen;
            PassiveLayer.ScreenTransition -= OnTransition;
            PassiveLayer.LoggedOut -= OnLoggedOut;
            PassiveLayer.LoggedIn -= OnLoggedIn;

            _activeScreen = scr;
            ActiveLayer = _activeScreen;
            ActiveLayer.ScreenTransition += OnTransition;
            ActiveLayer.LoggedOut += OnLoggedOut;
            ActiveLayer.LoggedIn += OnLoggedIn;

            if (_screenDepthMap[path.To] >= _screenDepthMap[path.From])
                InitiateTransitionFSTInwards(this, EventArgs.Empty);
            else
                InitiateTransitionFSTOutwards(this, EventArgs.Empty);
        }