public void Constructor_InitializesGateway() { var gateway = new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub()); var presenter = new MainViewPresenter(gateway); Assert.AreSame(gateway, presenter.ServiceGateway); }
public FormMain(IEnumerable <IMangaService> mangaServices, WorkerController wc) { InitializeComponent(); MangaServices = mangaServices; worker = wc; Presenter = new MainViewPresenter(this, wc); }
public void MainView_SetNull() { var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub())); presenter.MainView = null; Assert.IsNull(presenter.MainView); }
public override void Show(IMvxTouchView view) { if (view is IMvxModalTouchView) { var controller = view as UIViewController; controller.ModalPresentationStyle = UIModalPresentationStyle.Custom; controller.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve; PresentModalViewController(controller, true); return; } // Check if the MainViewPresenter has been set (i.e. user has logged in) if (MainViewPresenter != null && view != MainViewPresenter) { //EnableSliders = true; // If presenter is set use show on the presenter to show views in the tabs MainViewPresenter.Show(view); return; } // If MainViewPresenter is not set use the default show base.Show(view); }
public void MainView_SetGet() { var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub())); var mainView = new MainViewStub(); presenter.MainView = mainView; Assert.AreSame(mainView, presenter.MainView); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var view = new MainView(); var presenter = new MainViewPresenter(view); Application.Run(view); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var model = new MGBModel(); var mainFormView = new MainFormView(); var mainFormPresenter = new MainViewPresenter(mainFormView, model); Application.Run(mainFormView); }
static void Main() { MainViewPresenter mainPresenter = (MainViewPresenter)StaticFactory.CreateMainViewPresenter(); mainPresenter.ShowMain(); Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); Application.Run(); }
public void ShowEventsClicked_Redirected() { var mainView = new MainViewStub(); var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub())) { MainView = mainView }; AdvAssert.Raises <EventArgs>(() => mainView.ShowEvents(), presenter, "ShowEventsClicked"); }
public void Test_Title_AfterSetup() { // Arrange var presenter = new MainViewPresenter(new MainViewMock(), new MessageManagerMock()); // Act presenter.Setup(); // Assert Assert.AreEqual<string>("Hello World", presenter.Model.Title); }
protected override void OnActivated(EventArgs e) { //model Collection collectionModel = new Collection(); //view MainWindow mainView = Application.Current.MainWindow as MainWindow; //presenter MainViewPresenter presenter = new MainViewPresenter(mainView, collectionModel); base.OnActivated(e); }
public void StoppedEventRaisedOnServiceGatewayViewIsNull() { var serviceGateway = new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub()); var presenter = new MainViewPresenter(serviceGateway) { MainView = new MainViewStub() }; serviceGateway.Start(); presenter.MainView = null; serviceGateway.Stop(); }
public void Test_ButtonClick_Success() { // Arrange var presenter = new MainViewPresenter(new MainViewMock(), new MessageManagerMock()); // Act presenter.Setup(); presenter.Model.Name = "devlights"; presenter.ButtonClicked(); // Assert Assert.AreEqual<string>("MOCK devlights", presenter.Model.Message); }
public Form1() { InitializeComponent(); windowTopLeftY_numericUpDown.Maximum = pictureBox.Size.Height; windowTopLeftX_numericUpDown.Maximum = pictureBox.Size.Width; windowWidth_numericUpDown.Maximum = pictureBox.Size.Width; windowLength_numericUpDown.Maximum = pictureBox.Size.Height; _presenter = new MainViewPresenter(this); _presenter.SetClippingWindow( windowTopLeftX_numericUpDown.Value, windowTopLeftY_numericUpDown.Value, windowWidth_numericUpDown.Value, windowLength_numericUpDown.Value ); _presenter.DisplaySegments(); }
private static void Main() { Logger.Info("> Main()"); var appDomain = AppDomain.CurrentDomain; appDomain.UnhandledException += AppDomain_UnhandledException; FrameworkProvider.Init(Path.Combine(Environment.CurrentDirectory, "Plugins"), Path.Combine(Environment.CurrentDirectory, "MangaRipper.Configuration.json")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var form = new FormMain(); var presenter = new MainViewPresenter(form); Application.Run(form); Logger.Info("< Main()"); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Collection of models var items = new ItemsCollection(); // View var view = new MainView(); // Presenter var presenter = new MainViewPresenter(items, view); Application.Run(view); }
public void Test_Setup_Success() { // Arrange var presenter = new MainViewPresenter(new MainViewMock(), new MessageManagerMock()); // Arrange-Assert Assert.IsNull(presenter.Model.Title); Assert.IsNull(presenter.Model.Name); Assert.IsNull(presenter.Model.Message); // Act presenter.Setup(); // Assert Assert.IsNotNull(presenter.Model.Title); Assert.AreEqual<string>(string.Empty, presenter.Model.Name); Assert.AreEqual<string>(string.Empty, presenter.Model.Message); }
public MainView() { InitializeComponent(); //this.WindowState = FormWindowState.Maximized; Map map = new Map(Map); Presenter = new MainViewPresenter(this, map); Presenter.addPresenter(new DrawingToolsBoxPresenter(this)); Presenter.addPresenter(new GeoCoordinatesPresenter(this)); Presenter.setModel(map); Map.Layers.LayerSelected += handle_Layer_Selected_Changed; this.FormBorderStyle = FormBorderStyle.FixedDialog; InvokeInitialize(new EventArgs()); }
static void Main () { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault( false ); MainForm mainForm = new MainForm(); MainModel mainModel = new MainModel(); IPerformanceCounterService performanceCounterService = new PerformanceCounterService(); IPerformanceCounterInstanceInfoService performanceCounterInstanceInfoService = new PerformanceCounterInstanceInfoService(); IProcessMonitorService processMonitorService = new ProcessMonitorService( performanceCounterService, performanceCounterInstanceInfoService, mainModel); IGnuPlotGeneratorService gnuPlotGenerator = new GnuPlotGeneratorService( mainModel ); IMainModelSerializerService mainModelSerializerService = new MainModelSerializerService(); ILogService logService = new LogService( mainModel ); AboutViewPresenter aboutPresenter = new AboutViewPresenter(new AboutBox()); MainViewPresenter mainViewPresenter = new MainViewPresenter(mainForm, mainModel, mainModelSerializerService, processMonitorService, logService, gnuPlotGenerator, aboutPresenter); Application.Run( mainForm ); }
private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Logger.LoggerProvider.Instance = new FileLogger(@".\logger.txt"); NumbersControlPanelView ncp = new NumbersControlPanelView(); TrackBarControlPanelView tbc = new TrackBarControlPanelView(); FractalDataGridView fdg = new FractalDataGridView(); FractalEditorView fev = new FractalEditorView(); ControlPanelSlimViewValidator validator1 = new ControlPanelSlimViewValidator(tbc); ControlPanelSlimViewValidator validator2 = new ControlPanelSlimViewValidator(ncp); var mainForm = new MainForm2(tbc, ncp, fdg, fev); var boxDimensionCalculatorFactory = new BoxDimensionCalculatorFactory(); var mainPresenter = new MainViewPresenter( mainForm, tbc, ncp, fdg, fev, boxDimensionCalculatorFactory); mainForm.MainViewPresenter = mainPresenter; Application.Run(mainForm); }
public void MainView_AllCountersWillSetZeroWhenGatewayStopped() { var mainView = new MainViewStub { FilesysBlocks = 1, FilesysPermits = 2, RegistryBlocks = 3, RegistryPermits = 4 }; var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub())); // If gateway is stopped, presenter must zero all counters in view. presenter.MainView = mainView; Assert.AreEqual(0u, mainView.FilesysBlocks); Assert.AreEqual(0u, mainView.FilesysPermits); Assert.AreEqual(0u, mainView.RegistryBlocks); Assert.AreEqual(0u, mainView.RegistryPermits); Assert.AreEqual("FileWall is OFF", mainView.StartStopText); Assert.AreEqual(Color.Red, mainView.StartStopColor); Assert.IsTrue(mainView.StartStopEnabled); }
public void MainView_AllCountersWillSetWhenGatewayStarted() { var mainView = new MainViewStub(); var serviceGateway = new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub()); serviceGateway.Start(); serviceGateway.ServiceInterface.FilesysBlocks = 1; serviceGateway.ServiceInterface.FilesysPermits = 2; serviceGateway.ServiceInterface.RegistryBlocks = 3; serviceGateway.ServiceInterface.RegistryPermits = 4; var presenter = new MainViewPresenter(serviceGateway); // If gateway is started, presenter must fetch counters values and refresh view. presenter.MainView = mainView; Assert.AreEqual(1u, mainView.FilesysBlocks); Assert.AreEqual(2u, mainView.FilesysPermits); Assert.AreEqual(3u, mainView.RegistryBlocks); Assert.AreEqual(4u, mainView.RegistryPermits); Assert.AreEqual("FileWall is ON", mainView.StartStopText); Assert.AreEqual(Color.FromArgb(0, 192, 0), mainView.StartStopColor); Assert.IsTrue(mainView.StartStopEnabled); }
public override void Show(IMvxIosView view) { // Modal window presentation styles (modal support is in the base class presenter) if (view is IMvxModalIosView) { var controller = view as UIViewController; controller.ModalPresentationStyle = UIModalPresentationStyle.Custom; controller.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve; base.Show(view); return; } //if (view is MainView) //{ // var navController = new NonTranslucentSlidingPanelsNavigationController(view as UIViewController); // AddPanel(PanelType.LeftPanel, navController, CreatePanelViewController<WhitelabelMenuViewModel>()); // AddPanel(PanelType.RightPanel, navController, CreatePanelViewController<WorkspacesViewModel>()); // navController.CanSwipeToShowPanel = touch => true; // NavController = navController; // base.Show(navController); //} if (view is ChatConversationView) { var visibleController = AppDelegate.MainWindow.RootViewController.VisibleViewController(); var userView = visibleController as UserView; if (userView != null) { CloseModalViewController(); } } // Booking flow completed, pop all other viewcontrollers if (view is RoomIndexView || view is RoomDetailView || view is JobboardView || view is DatePickerView || view is RoomTimeIndexView || view is BookingConfirmedView) { MainViewPresenter.ShowInTab = false; } if (MainViewPresenter != null && view != MainViewPresenter && MainViewPresenter.ShowInTab) // && view is ITabbarView) { // If presenter is set use show on the presenter to show views in the tabs MainViewPresenter.Show(view); return; } if (MainViewPresenter == null) { // If MainViewPresenter is not set use the default show var mainViewPresenterHost = Mvx.Resolve <IMainViewPresenterHost>(); mainViewPresenterHost.EnableSliders = false; } base.Show(view); if (view is BookingConfirmedView && MasterNavigationController.ViewControllers.Length > 3) { var rootVc = MasterNavigationController.ViewControllers[0]; foreach (var uiViewController in MasterNavigationController.ViewControllers) { if (!uiViewController.Equals(rootVc) && !uiViewController.Equals(MasterNavigationController.VisibleViewController)) { // Remove from stack uiViewController.RemoveFromParentViewController(); } } } }
public FormMain(IEnumerable <IPlugin> pluginList, IWorkerController worker, ApplicationConfiguration applicationConfiguration) { InitializeComponent(); this.pluginList = pluginList; Presenter = new MainViewPresenter(this, worker, applicationConfiguration); }