Exemple #1
0
        private static LoginResult LoginFlowExperiment()
        {
SelectSession:
            //session
            var sessionDlg = new LoginSessionDlg();

            sessionDlg.ShowDialog();
            if (sessionDlg.SelectedSession == null)
            {
                return(null);
            }

SelectSeat:
            //seat
            var seatDlg = new LoginSeatSelectorDlg();

            seatDlg.ShowDialog();

            if (seatDlg.BackClicked)
            {
                goto SelectSession;
            }

            if (seatDlg.SelectedSeat == null)
            {
                return(null);
            }

            if (placeAlreadyBusy(sessionDlg.SelectedSession, seatDlg.SelectedSeat))
            {
                MsgPlaceReserved();
                goto SelectSession;
            }

            //EnterName:
            //name
            var nameDlg = new LoginName(seatDlg.SelectedSeat);

            nameDlg.ShowDialog();
            if (nameDlg.BackClicked)
            {
                goto SelectSeat;
            }

            if (nameDlg.EnteredName == null)
            {
                return(null);
            }

            //if (!NameUnique(nameDlg.EnteredName, sessionDlg.SelectedSession))
            //{
            //    MsgNameRegistered();
            //    goto EnterName;
            //}

            //discussion selector
            var discussionDlg = new LoginDiscussionDlg(nameDlg.EnteredName);

            discussionDlg.ShowDialog();

            if (discussionDlg.BackClicked)
            {
                goto SelectSeat;
            }

            if (discussionDlg.SelectedDiscussion == null)
            {
                MsgParticipantsShouldSelectDiscussion();
                return(null);
            }

            //final checks and build login result
            if (placeAlreadyBusy(sessionDlg.SelectedSession, seatDlg.SelectedSeat))
            {
                MsgPlaceReserved();
                goto SelectSession;
            }
            //if (!NameUnique(nameDlg.EnteredName, sessionDlg.SelectedSession))
            //{
            //    MsgNameRegistered();
            //    goto EnterName;
            //}

            //register user and build result
            var res = new LoginResult();

            if (discussionDlg.SelectedDiscussion != LoginDiscussionDlg.DummyDiscussion)
            {
                res.discussion = discussionDlg.SelectedDiscussion;
            }

            res.session = sessionDlg.SelectedSession;

            res.person = RegisterOrLogin(nameDlg.EnteredName,
                                         discussionDlg.SelectedDiscussion,
                                         sessionDlg.SelectedSession,
                                         seatDlg.SelectedSeat);

            return(res);
        }
Exemple #2
0
        private static LoginResult LoginFlowExperiment()
        {
            SelectSession:
            //session
            var sessionDlg = new LoginSessionDlg();
            sessionDlg.ShowDialog();
            if (sessionDlg.SelectedSession == null)
                return null;

            SelectSeat:
            //seat 
            var seatDlg = new LoginSeatSelectorDlg();
            seatDlg.ShowDialog();

            if (seatDlg.BackClicked)
                goto SelectSession;

            if (seatDlg.SelectedSeat == null)
                return null;

            if (placeAlreadyBusy(sessionDlg.SelectedSession, seatDlg.SelectedSeat))
            {
                MsgPlaceReserved();
                goto SelectSession;
            }

            //EnterName:
            //name
            var nameDlg = new LoginName(seatDlg.SelectedSeat);
            nameDlg.ShowDialog();
            if (nameDlg.BackClicked)
                goto SelectSeat;

            if (nameDlg.EnteredName == null)
                return null;

            //if (!NameUnique(nameDlg.EnteredName, sessionDlg.SelectedSession))
            //{
            //    MsgNameRegistered();
            //    goto EnterName;
            //}

            //discussion selector
            var discussionDlg = new LoginDiscussionDlg(nameDlg.EnteredName);
            discussionDlg.ShowDialog();

            if (discussionDlg.BackClicked)
                goto SelectSeat;

            if (discussionDlg.SelectedDiscussion == null)
            {
                MsgParticipantsShouldSelectDiscussion();
                return null;
            }

            //final checks and build login result
            if (placeAlreadyBusy(sessionDlg.SelectedSession, seatDlg.SelectedSeat))
            {
                MsgPlaceReserved();
                goto SelectSession;
            }
            //if (!NameUnique(nameDlg.EnteredName, sessionDlg.SelectedSession))
            //{
            //    MsgNameRegistered();
            //    goto EnterName;
            //}

            //register user and build result
            var res = new LoginResult();
            if (discussionDlg.SelectedDiscussion != LoginDiscussionDlg.DummyDiscussion)
                res.discussion = discussionDlg.SelectedDiscussion;

            res.session = sessionDlg.SelectedSession;

            res.person = RegisterOrLogin(nameDlg.EnteredName,
                                         discussionDlg.SelectedDiscussion,
                                         sessionDlg.SelectedSession,
                                         seatDlg.SelectedSeat);

            return res;
        }