예제 #1
0
        //NOTE: Don't use IoC to avoid additional dependencies.
        private void InitializePresenters(bool isRunOnStartup)
        {
            NavigationWindow navigationWindow = new NavigationWindow(new PresentationService());

            MainWindow = navigationWindow;

            IRegistryService    registryService    = new RegistryService();
            ISettingsSerializer settingsSerializer = new SettingsSerializer(registryService);

            IPresenter navigationPresenter = new NavigationPresenter(navigationWindow,
                                                                     settingsSerializer,
                                                                     new KeyboardListener(),
                                                                     new MatchModelMapper(),
                                                                     new PresentationService(),
                                                                     new NavigationServiceBuilder(isRunOnStartup));

            TrayView   trayView      = new TrayView();
            IPresenter trayPresenter = new TrayIconPresenter(trayView, settingsSerializer);

            SettingsWindow settingsWindow    = new SettingsWindow();
            IPresenter     settingsPresenter = new SettingsPresenter(settingsWindow, settingsSerializer);

            List <IPresenter> presenters = new List <IPresenter> {
                navigationPresenter, trayPresenter, settingsPresenter
            };

            _presenterManager         = new PresenterManager(presenters);
            _presenterManager.Exited += HandleExited;
        }
예제 #2
0
 public void Init()
 {
     _fakeView           = Substitute.For <ISettingsView>();
     _fakeModel          = Substitute.For <ISettingsModel>();
     _fakeUserPreference = Substitute.For <IUserPreference>();
     _uut = new SettingsPresenter(_fakeView, _fakeModel, _fakeUserPreference);
 }
예제 #3
0
        public MainViewTests()
        {
            ErrorMessageView  errorMessageView  = new ErrorMessageView();
            DeleteConfirmView deleteConfirmView = new DeleteConfirmView();

            mainView = new MainView(errorMessageView);

            SettingsPresenter settingsPresenter = new SettingsPresenter(new SettingsUC(errorMessageView), errorMessageView);
            StoreFacade       facade            = ServicesInitialiser.facade;

            UnitsService         unitsService         = ServicesInitialiser.unitsService;
            UnitsDetailUC        unitsDetailUC        = new UnitsDetailUC(errorMessageView);
            UnitsDetailPresenter unitsDetailPresenter = new UnitsDetailPresenter(unitsDetailUC, facade);
            UnitsPresenter       unitsPresenter       = new UnitsPresenter(new UnitsUC(errorMessageView), facade, unitsDetailPresenter, deleteConfirmView, errorMessageView);

            SuppliersService         supplierService          = ServicesInitialiser.suppliersService;
            SuppliersDetailUC        suppliersDetailUC        = new SuppliersDetailUC(errorMessageView);
            SuppliersDetailPresenter suppliersDetailPresenter = new SuppliersDetailPresenter(suppliersDetailUC, facade);
            SuppliersPresenter       suppliersPresenter       = new SuppliersPresenter(new SuppliersUC(errorMessageView), suppliersDetailPresenter, facade, deleteConfirmView, errorMessageView);

            ProductsService         productsService         = ServicesInitialiser.productsService;
            ProductsDetailUC        productsDetailUC        = new ProductsDetailUC(errorMessageView);
            ProductsDetailPresenter productsDetailPresenter = new ProductsDetailPresenter(productsDetailUC, facade);
            ProductsPresenter       productsPresenter       = new ProductsPresenter(new ProductsUC(errorMessageView), productsDetailPresenter,
                                                                                    facade, deleteConfirmView, errorMessageView);

            ParametersService         parametersService         = ServicesInitialiser.parametersService;
            ParametersDetailUC        parametersDetailUC        = new ParametersDetailUC(errorMessageView);
            ParametersDetailPresenter parametersDetailPresenter = new ParametersDetailPresenter(parametersDetailUC, facade);
            ParametersPresenter       parametersPresenter       = new ParametersPresenter(new ParametersUC(errorMessageView),
                                                                                          parametersDetailPresenter, facade, deleteConfirmView, errorMessageView);

            ImagesService         imagesService         = ServicesInitialiser.imagesService;
            ImagesDetailUC        imagesDetailUC        = new ImagesDetailUC(errorMessageView);
            ImagesDetailPresenter imagesDetailPresenter = new ImagesDetailPresenter(imagesDetailUC, facade);
            ImagesPresenter       imagesPresenter       = new ImagesPresenter(new ImagesUC(errorMessageView), imagesDetailPresenter, ServicesInitialiser.facade, deleteConfirmView, errorMessageView);

            GroupsService         groupsService         = ServicesInitialiser.groupsService;
            GroupsDetailUC        groupsDetailUC        = new GroupsDetailUC(errorMessageView);
            GroupsDetailPresenter groupsDetailPresenter = new GroupsDetailPresenter(groupsDetailUC, ServicesInitialiser.facade);
            GroupsPresenter       groupsPresenter       = new GroupsPresenter(new GroupsUC(errorMessageView), groupsDetailPresenter, ServicesInitialiser.facade, deleteConfirmView, errorMessageView);

            CategoriesService         categoriesService         = ServicesInitialiser.categoriesService;
            CategoriesDetailUC        categoriesDetailUC        = new CategoriesDetailUC(errorMessageView);
            CategoriesDetailPresenter categoriesDetailPresenter = new CategoriesDetailPresenter(categoriesDetailUC, facade);
            CategoriesPresenter       categoriesPresenter       = new CategoriesPresenter(new CategoriesUC(errorMessageView), categoriesDetailPresenter, facade, deleteConfirmView, errorMessageView);


            mainPresenter = new MainPresenter(mainView,
                                              settingsPresenter,
                                              unitsPresenter, unitsDetailPresenter,
                                              suppliersPresenter, suppliersDetailPresenter,
                                              productsPresenter, productsDetailPresenter,
                                              parametersPresenter, parametersDetailPresenter,
                                              imagesPresenter, imagesDetailPresenter,
                                              groupsPresenter, groupsDetailPresenter,
                                              categoriesPresenter, categoriesDetailPresenter,
                                              facade, deleteConfirmView);
        }
예제 #4
0
        public SettingsDialog(SettingsPresenter presenter, ISettingsRepository model)
        {
            InitializeComponent();
            DataContext = this;

            this.presenter = presenter;
            this.model = model;
        }
예제 #5
0
        public void ShowSettings()
        {
            var view      = new Settings(this);
            var model     = new SettingsModel(session);
            var presenter = new SettingsPresenter(model, view);

            ShowControl(view);
        }
예제 #6
0
        public SettingsForm()
        {
            InitializeComponent();
            IApplicationSettings settings = new ApplicationSettings();

            _presenter = new SettingsPresenter(this, settings);
            _presenter.Initialize();
        }
예제 #7
0
        public void ChangePasswordCatchesException()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _mockedDummy.error = true;
            Assert.Throws <Exception>(() => _profileScreenPresenter.ChangePassword("1234", "122343", "1234"));
        }
예제 #8
0
        public FrmTheme()
        {
            InitializeComponent();
            setFormTheme();
            settingsPresenter = new SettingsPresenter();

            checkDarkMode.Checked  = settingsPresenter.getCurrentMode();
            cmbTheme.SelectedIndex = cmbTheme.FindStringExact(settingsPresenter.getCurrentTheme());
        }
예제 #9
0
        public void ChangeLastNameChanges()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _profileScreenPresenter.ChangeLastName("MasterGigo");

            Assert.AreEqual("MasterGigo", _profileScreen.LastName);
        }
예제 #10
0
        public void ChangeGenderCatchesException()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _mockedDummy.error = true;
            _profileScreenPresenter.ChangeGender("F");
            Assert.AreNotEqual("F", _profileScreen.Gender);
        }
예제 #11
0
        public void ChangeAgeChanges()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _profileScreenPresenter.ChangeAge(2);

            Assert.AreEqual(2, _profileScreen.Age);
        }
예제 #12
0
        public void ChangeGenderChanges()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _profileScreenPresenter.ChangeGender("F");

            Assert.AreEqual("F", _profileScreen.Gender);
        }
예제 #13
0
        public void ChangeEmailCatchesException()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _mockedDummy.error = true;
            _profileScreenPresenter.ChangeEmail("*****@*****.**");
            Assert.AreNotEqual("*****@*****.**", _profileScreen.Email);
        }
예제 #14
0
        public void ChangePasswordChanges()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _profileScreenPresenter.ChangePassword("1234", "12234", "1234");

            Assert.AreEqual("12234", _mockedDummy._user.password);
        }
예제 #15
0
        public void ChangeLastNameCatchesException()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _mockedDummy.error = true;
            _profileScreenPresenter.ChangeLastName("MasterGigo");
            Assert.AreNotEqual("MasterGigo", _profileScreen.LastName);
        }
예제 #16
0
        public void ChangeEmailChanges()
        {
            MockedDummyProfileScreenSettingsService _mockedDummy = new MockedDummyProfileScreenSettingsService();
            IProfileScreen     _profileScreen          = new MockedDummyProfileScreenView();
            ISettingsPresenter _profileScreenPresenter = new SettingsPresenter(_profileScreen, _mockedDummy._profileScreenSettingsService);

            _profileScreenPresenter.ChangeEmail("*****@*****.**");

            Assert.AreEqual("*****@*****.**", _profileScreen.Email);
        }
예제 #17
0
 private void setFormTheme()
 {
     th = new ThemeHelper();
     settingsPresenter = new SettingsPresenter();
     th.setFormColor(this);
     th.setPanelColor(panelTop);
     th.setGroupBoxColor(groupSecurity);
     th.setGroupBoxColor(groupTheme);
     th.setButtonColor(btnSecurityApply);
     th.setButtonColor(btnThemeApply);
 }
예제 #18
0
        internal void DataBind(SettingsPresenter presenter)
        {
            if (presenter != null)
            {
                settingsName.DataSource = presenter.SettingsNames;

                settingsName.DataBindings.Add("SelectedItem", presenter, "SettingsNameSelected", true, DataSourceUpdateMode.OnValidation);
                settingsName.SelectedIndexChanged += (s, args) => settingsName.DataBindings["SelectedItem"].WriteValue();
                settingsValue.DataBindings.Add("Text", presenter, "SettingsValue", true, DataSourceUpdateMode.OnPropertyChanged);
            }
        }
예제 #19
0
        public void ConfigIsSavedOnSave()
        {
            //arrange
            var presenter = new SettingsPresenter(_view.Object, _configService.Object, _folderBrowserFactory.Object);

            //act
            //simulate Update button click
            _view.Raise(v => v.Save += null, EventArgs.Empty);

            //assert
            _configService.Verify(s => s.SaveConfiguration(_config));
        }
예제 #20
0
        protected override void Context()
        {
            _subPresenterManager     = SubPresenterHelper.Create <ISettingsItemPresenter>();
            _userSettings            = _subPresenterManager.CreateFake(SettingsItems.UserGeneralSettings);
            _appSettings             = _subPresenterManager.CreateFake(SettingsItems.ApplicationSettings);
            _userDisplayUnitSettings = _subPresenterManager.CreateFake(SettingsItems.UserDisplayUnitsSettings);

            _dialogCreator = A.Fake <IDialogCreator>();
            _workspace     = A.Fake <ICoreWorkspace>();
            _view          = A.Fake <ISettingsView>();
            sut            = new SettingsPresenter(_view, _subPresenterManager, _dialogCreator, _workspace);
        }
예제 #21
0
        public void ViewIsPopulatedOnRefresh()
        {
            //arrange
            var presenter = new SettingsPresenter(_view.Object, _configService.Object, _folderBrowserFactory.Object);

            //act
            presenter.RefreshView();

            //assert
            Assert.AreEqual(Name, _view.Object.UserName, "Name");
            Assert.AreEqual(Email, _view.Object.EmailAddress, "Email");
            Assert.AreEqual(RepoLocation, _view.Object.DefaultRepositoryLocation, "Default Repo Location");
        }
예제 #22
0
        public Setting(UserInfObject _userInfObject, MainPage _mainPage)
        {
            InitializeComponent();

            name_txt.Text       = _userInfObject.getName();
            this._userInfObject = _userInfObject;
            userName_txt.Text   = _userInfObject.getUsername();
            Id_txt.Text         = _userInfObject.getId().ToString();
            passwordHide();
            this._mainPage = _mainPage;

            presenter = new SettingsPresenter(this);
        }
예제 #23
0
파일: TestSuiteView.cs 프로젝트: ywscr/NBi
        public TestSuiteView()
        {
            State = new TestSuiteState();
            TestCasesPresenter = new TestCasesPresenter(new RenameVariableWindow(), new FilterWindow(), new ConnectionStringWindow(), new TestCaseCollectionManager(), State.TestCases, State.Variables, State.ConnectionStringNames);
            TemplatePresenter  = new TemplatePresenter(new TemplateManager(), State.Template);
            SettingsPresenter  = new SettingsPresenter(new SettingsManager(), State.Settings);
            TestListPresenter  = new TestListPresenter(new TestListManager(), State.Tests, State.TestCases, State.Variables, State.Template, State.GlobalVariables);
            TestSuitePresenter = new TestSuitePresenter(new TestSuiteManager(), State.Tests, State.Settings);
            MacroPresenter     = new MacroPresenter();

            InitializeComponent();
            DeclareBindings();
            BindPresenter();
        }
예제 #24
0
        public void OnBrowserDefaultRepoLocation_WhenUserCancels_ViewRemainsUnchanged()
        {
            //arrange
            _view.Object.DefaultRepositoryLocation = RepoLocation;
            _folderBrowser.Object.SelectedPath     = OtherRepoLocation;
            _folderBrowser.Setup(f => f.ShowDialog()).Returns(DialogResult.Cancel);

            var presenter = new SettingsPresenter(_view.Object, _configService.Object, _folderBrowserFactory.Object);

            //act
            _view.Raise(v => v.BrowseDefaultRepositoryLocation += null, EventArgs.Empty);

            //assert
            Assert.AreEqual(RepoLocation, _view.Object.DefaultRepositoryLocation);
        }
예제 #25
0
파일: TestSuiteView.cs 프로젝트: ywscr/NBi
        protected void DeclareBindings()
        {
            testCasesControl.DataBind(TestCasesPresenter);
            settingsControl.DataBind(SettingsPresenter);
            templateControl.DataBind(TemplatePresenter);
            testListControl.DataBind(TestListPresenter);

            TemplatePresenter.PropertyChanged += (sender, e) => TestListPresenter.Template = TemplatePresenter.Template;
            TestListPresenter.PropertyChanged += (sender, e) => TestSuitePresenter.RefreshCommands();

            TestSuitePresenter.TestSuiteLoaded += (sender, e) =>
            {
                SettingsPresenter.Refresh();
                TestListPresenter.Refresh();
            };
        }
예제 #26
0
        public void ConfigIsPopulatedFromViewOnSave()
        {
            //arrange
            var presenter = new SettingsPresenter(_view.Object, _configService.Object, _folderBrowserFactory.Object);

            //simulate user input
            _view.Object.UserName     = OtherName;
            _view.Object.EmailAddress = OtherEmail;
            _view.Object.DefaultRepositoryLocation = OtherRepoLocation;

            //simulate Update button click
            _view.Raise(v => v.Save += null, EventArgs.Empty);

            //assert
            Assert.AreEqual(OtherName, _config.UserName, "Name");
            Assert.AreEqual(OtherEmail, _config.EmailAddress, "Email");
            Assert.AreEqual(OtherRepoLocation, _config.DefaultRepositoryLocation, "Default Repo Location");
        }
예제 #27
0
        public void ChangesToViewAreRevertedOnCancel()
        {
            //arrange
            var presenter = new SettingsPresenter(_view.Object, _configService.Object, _folderBrowserFactory.Object);

            //simulate user input
            _view.Object.UserName     = OtherName;
            _view.Object.EmailAddress = OtherEmail;
            _view.Object.DefaultRepositoryLocation = OtherRepoLocation;

            //act
            //simulate Cancel button click
            _view.Raise(v => v.Cancel += null, EventArgs.Empty);

            //assert
            Assert.AreEqual(Name, _view.Object.UserName, "Name");
            Assert.AreEqual(Email, _view.Object.EmailAddress, "Email");
            Assert.AreEqual(RepoLocation, _view.Object.DefaultRepositoryLocation, "Default Repo Location");
        }
    public void Start()
    {
        _items        = GetComponentInChildren <InventoryPresenter>();
        _interface    = GetComponentInChildren <PauseInterface>();
        _presenter    = GetComponentInChildren <PausePresenter>();
        _settings     = GetComponentInChildren <SettingsPresenter>();
        _member       = GetComponentInChildren <MemberStatPresenter>();
        _equipment    = GetComponentInChildren <EquipmentPresenter>();
        _magic        = GetComponentInChildren <MagicPresenter>();
        _memberSelect = GetComponentInChildren <MemberSelectPresenter>();

        _party     = PartyManager.Instance;
        _controls  = ControlManager.Instance;
        _inventory = InventoryManager.Instance;

        if (_interface == null)
        {
            DebugMessage("Could not find a Pause Interface in the children of " + gameObject.name + "!", LogLevel.Warning);
        }

        if (_presenter == null)
        {
            DebugMessage("Could not find a Pause Presenter in the children of " + gameObject.name + "!", LogLevel.Warning);
        }

        if (_settings == null)
        {
            DebugMessage("Could not find a Settings Presenter in the children of " + gameObject.name + "!", LogLevel.Warning);
        }

        if (_equipment == null)
        {
            DebugMessage("Could not find an Equipment Presenter in the children of " + gameObject.name + "!", LogLevel.Warning);
        }

        if (_magic == null)
        {
            DebugMessage("Could not find an Magic Presenter in the children of " + gameObject.name + "!", LogLevel.Warning);
        }
    }
예제 #29
0
        private void SettingsViewLoad(object sender, EventArgs e)
        {
            if (_settingsPresenter == null) {
                _settingsPresenter = _presentersFactory.CreateSettingsPresenter(this);
                _settingsViewModel = _settingsPresenter.Initialize();

                _serverNameTextBox.Text = _settingsViewModel.ServerAddress;
                _accountTextBox.Text = _settingsViewModel.Username;
                _passwordTextBox.Text = _settingsViewModel.Password;
                _batchSizeTextBox.Text =
                    _settingsViewModel.SynchronizationBatchSize.ToString(CultureInfo.InvariantCulture);
                _versionValueLabel.Text = _settingsViewModel.Version;
                _languagesComboBox.DataSource = _settingsPresenter.GetAvailableLanguages();
                _languagesComboBox.SelectedItem = _settingsPresenter.GetSelectedLocalization();
                _languagesComboBox.SelectedValueChanged += _languagesComboBox_SelectedValueChanged;

                ViewContainer.RegisterLeftAction(new Save(_settingsPresenter));
                ViewContainer.RegisterRightAction(new Cancel(_settingsPresenter));
            }
        }
예제 #30
0
        public SettingsPresenter LoadViewSettings()
        {
            if (settingsPresenter == null)
            {
                settingsPresenter = new SettingsPresenter(Instance.appParams.getView("Settings"), settingsRepository);
            }

            settingsPresenter.InitializeView(MainWindow);

            return settingsPresenter;
        }
예제 #31
0
        public Settings()
        {
            InitializeComponent();

            presenter = new SettingsPresenter(this);
        }
예제 #32
0
 public AddReferenceCommand(SettingsPresenter presenter, NewReferenceWindow window)
 {
     this.presenter = presenter;
     this.window    = window;
 }
예제 #33
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            setPresenter = new SettingsPresenter(this);
            linkPresenter = new LinkgrabberPresenter(this);
            dlPresenter = new DownloaderPresenter(this);

            listViewDL.View = View.Details;
            listViewDL.FullRowSelect = true;
            listViewDL.Columns.Add("Filename", -2, HorizontalAlignment.Left);
            listViewDL.Columns.Add("Status", -2, HorizontalAlignment.Left);
            listViewDL.Columns.Add("Progress", -2, HorizontalAlignment.Left);
            listViewDL.Columns.Add("Filesize", -2, HorizontalAlignment.Left);
            listViewDL.Columns.Add("FileURL", -2, HorizontalAlignment.Left);
        }
예제 #34
0
 public SettingsDebug(SettingsPresenter presenter, ISettingsRepository model)
 {
     this.presenter = presenter;
     this.model = model;
     model.PropertyChanged += new PropertyChangedEventHandler(model_PropertyChanged);
 }
예제 #35
0
 public Save(SettingsPresenter presenter)
 {
     _presenter = presenter;
 }
예제 #36
0
 public RemoveReferenceCommand(SettingsPresenter presenter)
 {
     this.presenter = presenter;
 }
예제 #37
0
 public Cancel(SettingsPresenter presenter)
 {
     _presenter = presenter;
 }