Esempio n. 1
0
        public ScreenSwitcher(AuthorityController ac)
        {
            this.ac = ac;

            // диалоги

            SubscribeForSendOpenDialog();

            // экраны

            AuthorityController.LoggedIn += (s, e) =>
            {
                if (e.user is Admin)
                {
                    OpenScreen(Screen.Doctors);
                }
                else if (e.user is Doctor)
                {
                    OpenScreen(Screen.Patients);
                }
            };
            AuthorityController.LoggedOut += (s, e) =>
            {
                OpenScreen(Screen.Login);
            };

            SubscribeForOpenInCard();
            SubscribeForOpenInCriteria();

            // closing screen

            this.Subscribe(Event.Shutdown, (e) =>
            {
                if (CurrentView != null)
                {
                    CurrentView.Dispose();
                }
            });
            this.Subscribe(Event.NewSession, (e) =>
            {
                AuthorityController.Default.LogOut();
            });
        }