Esempio n. 1
0
        public SignInWindow()
        {
            InitializeComponent();

            App app = ((App)Application.Current);

            if (app.CurrentUser != null)
            {
                // Already signed in
                var chatListWindow = new ChatListWindow();
                chatListWindow.Show();
                Close();
                return;
            }

            var signInViewModel = new SignInViewModel();

            signInViewModel.RequestClose            += CloseOrListChatsIfSignedIn;
            signInViewModel.RequestLoader           += OnRequestLoader;
            signInViewModel.RequestVisibilityChange += (x) => Visibility = x;
            DataContext = signInViewModel;
        }
Esempio n. 2
0
        private void CloseOrListChatsIfSignedIn(bool isQuitApp)
        {
            App app = ((App)Application.Current);

            if (!isQuitApp)
            {
                if (app.CurrentUser != null)
                {
                    var chatListWindow = new ChatListWindow();
                    chatListWindow.Show();
                    Close();
                    return;
                }
            }

            if (!isQuitApp)
            {
                Close();
            }
            else
            {
                app.ShutDown(0);
            }
        }