Пример #1
0
 public CreateUserPresenter(ICreateUserView view)
 {
     if (view == null)
     {
         throw new Exception("Niew³aœciwy widok");
     }
     this.view    = view;
     this.service = new CreateUserTask();
     subscribeToEvents();
 }
Пример #2
0
 public void Init()
 {
     _fakeView  = Substitute.For <ICreateUserView>();
     _fakeModel = Substitute.For <ICreateUserModel>();
     _uut       = new CreateUserPresenter(_fakeView, _fakeModel);
 }
Пример #3
0
 public CreateUserPresenter(ICreateUserView view, ICreateUserModel model)
 {
     _view  = view;
     _model = model;
 }
Пример #4
0
        public ParentPresenter(IDataModel dataModel, IParentView parentView, ILoginUserView loginUserView, ICreateUserView createUserView, IWallView wallView, ISettingsView settingView, IAboutView aboutView)
        {
            serverRequest = new MyServerRequest();

            this.dataModel = dataModel;

            this.parentView = parentView;
            this.parentView.InvertVisibility += this.OnInvertVisibility;
            this.parentView.SettingsClicked += this.OnSettingsClicked;
            this.parentView.AboutClicked += this.OnAboutClicked;
            this.parentView.ExitClicked += this.OnExitClicked;

            this.loginUserView = loginUserView;
            this.loginUserView.LoginUserClicked += this.OnLoginUserClicked;
            this.loginUserView.LoginUserOfflineClicked += this.OnLoginUserOfflineClicked;
            this.loginUserView.GoToCreateUserClicked += this.OnGoToCreateUserClicked;
            this.loginUserView.LoginUsernameChanged += this.OnLoginUsernameChanged;

            this.createUserView = createUserView;
            this.createUserView.CreateUserClicked += this.OnCreateUserClicked;
            this.createUserView.GoToLoginUserClicked += this.OnGoToLoginUserClicked;

            this.wallView = wallView;
            this.wallView.NewWallClicked += this.OnNewWallClicked;
            this.wallView.NewMessageClicked += this.OnNewMessageClicked;
            this.wallView.NewWallSelected += this.OnNewWallSelected;
            this.wallView.RefreshWallsClicked += this.OnRefreshWallsClicked;
            this.wallView.WallsAutoRefresh += this.OnRefreshWallsClicked;

            this.settingView = settingView;
            this.settingView.ShowNotificationChanged += this.OnShowNotificationChanged;
            this.settingView.RefreshMinutesChanged += this.OnRefreshMinutesChanged;
            this.settingView.RefreshSecondsChanged += this.OnRefreshSecondsChanged;
            this.settingView.GoToPreviousView += this.OnGoToPreviousView;

            this.aboutView = aboutView;
            this.aboutView.GoToPreviousView += this.OnGoToPreviousView;
            this.aboutView.AuthorWebLinkClicked += this.OnAuthorWebLinkClicked;
            this.aboutView.CodeWebLinkClicked += this.OnCodeWebLinkClicked;

            //load model data
            dataModel.LoadDataModel();

            //set settings on loginView
            if (dataModel.Settings.RememberUser)
            {
                loginUserView.RememberUser = true;
                if (!string.IsNullOrEmpty(dataModel.User.username))
                {
                    loginUserView.Username = dataModel.User.username;
                    loginUserView.LoginOfflineVisible = true;
                    loginUserView.SetPasswordFocus();
                }
                else
                {
                    loginUserView.SetUsernameFocus();
                }
            }
            else
            {
                loginUserView.RememberUser = false;
                loginUserView.SetUsernameFocus();
            }

            //load loginUSerView
            parentView.CurrentChildView = this.loginUserView;
        }