public void TestBuildsInsertCoinButtonPanelWithCorrectInsertCoinButtons() { Form mainForm = new Form(); Button expectedInsertPennyButton = new Button { Name = "InsertPennyButton" }; Button expectedInsertNickelButton = new Button { Name = "InsertNickelButton" }; Button expectedInsertDimeButton = new Button { Name = "InsertDimeButton" }; Button expectedInsertQuaterButton = new Button { Name = "InsertQuarterButton" }; mainForm.Controls.Add(expectedInsertPennyButton); mainForm.Controls.Add(expectedInsertNickelButton); mainForm.Controls.Add(expectedInsertDimeButton); mainForm.Controls.Add(expectedInsertQuaterButton); MainFormController mainFormController = new MainFormController(mainForm); IInsertCoinButtonPanel insertCoinButtonPanel = mainFormController.InsertCoinButtonPanel; Assert.AreSame(expectedInsertPennyButton, insertCoinButtonPanel.InsertPennyButton); Assert.AreSame(expectedInsertNickelButton, insertCoinButtonPanel.InsertNickelButton); Assert.AreSame(expectedInsertDimeButton, insertCoinButtonPanel.InsertDimeButton); Assert.AreSame(expectedInsertQuaterButton, insertCoinButtonPanel.InsertQuarterButton); }
public frmMedicalExamination(MainFormController controller, MedicalFindingFormController medicalController, IWaitingRoomController inWaitingRoomController) { _controller = medicalController; _mainController = controller; _waitingRoomController = inWaitingRoomController; InitializeComponent(); }
public void TestBaseProperties() { Form expectedForm = new Form(); MainFormController mainFormController = new MainFormController(expectedForm); Assert.AreSame(expectedForm, mainFormController.MainForm); }
public AppForm() { InitializeComponent(); this.Controller = new MainFormController(this); lblMemory.Text = string.Format("Used Memory {0} Bytes", ApplicationContext.Instance.Application.UsedMemory); }
public void TestBuildsInsertCoinButtonPanel() { Form mainForm = new Form(); MainFormController mainFormController = new MainFormController(mainForm); Assert.IsInstanceOf(typeof(IInsertCoinButtonPanel), mainFormController.InsertCoinButtonPanel); }
public void TestCorrectlyBuildsCoinFactory() { MainFormController mainFormController = new MainFormController(new Form()); ICoinFactory coinFactory = mainFormController.CoinFactory; Assert.IsInstanceOf(typeof(ICoinFactory), coinFactory); }
public void TestCorrectlyBuildsCoinReturn() { MainFormController mainFormController = new MainFormController(new Form()); ICoinReturn coinPurse = mainFormController.CoinReturn; Assert.IsInstanceOf(typeof(ICoinReturn), coinPurse); }
public MainForm() { InitializeComponent(); SetupServer(); _controller = new MainFormController(); _logController = new LogController(); dgBitacora.DataSource = _logController.GetAll(); }
static void Main() { WindowFormsFactory formsFactory = new WindowFormsFactory(); MainFormController mainController = new MainFormController(formsFactory, UserRepository.getInstance(), RecordRepository.getInstance(), CurrentUserRepository.getInstance()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new RegistrationForm(mainController)); }
private void addButton_Click(object sender, EventArgs e) { if (tabControl1.SelectedTab == taskTabPage) { //get task name Add input = new Add(); input.ShowDialog(); string task; if (input.s != null) { task = isSameName(input.s); //AddTask(); UserOperation.GetInstance().Add("ADD_TASK", task); if (UserOperation.GetInstance().count() == 1) { long id = IDGenerator.generateID(); if (MainFormController.AddTask(task, id)) { UserOperation.GetInstance().Remove(); TreeNode node = new TreeNode(); node.Text = task; node.Tag = id; taskTreeView.Nodes.Add(node); } } } } if (tabControl1.SelectedTab == ePlanTabPage) { //get plan name Add input = new Add(); input.ShowDialog(); //AddPlan(); string plan; if (input.s != null) { plan = isSameName(input.s); UserOperation.GetInstance().Add("ADD_EPLAN", plan); if (UserOperation.GetInstance().count() == 1) { long id = IDGenerator.generateID(); if (MainFormController.AddPlan(plan, id)) { UserOperation.GetInstance().Remove(); TreeNode node = new TreeNode(); node.Text = plan; node.Tag = id; planTreeView.Nodes.Add(node); } } } } }
public void TestCorrectlyBuildsInsertCoinButtonPanelController() { MainFormController mainFormController = new MainFormController(new Form()); InsertCoinButtonPanelController insertCoinButtonPanelController = mainFormController.InsertCoinButtonPanelController; Assert.IsInstanceOf(typeof(InsertCoinButtonPanelController), insertCoinButtonPanelController); Assert.AreSame(mainFormController.CoinAccepter, insertCoinButtonPanelController.CoinAccepter); Assert.AreSame(mainFormController.InsertCoinButtonPanel, insertCoinButtonPanelController.InsertCoinButtonPanel); }
public FormBase(IFormController _controller) { if (_controller == null) { string msg = "The FormBase() constructor requires an IFormController object."; LogHelper.LogFatal(msg); throw new ArgumentNullException(msg); } this.Controller = _controller as MainFormController; }
public void TestCorrectlyBuildsCoinAccepter() { MainFormController mainFormController = new MainFormController(new Form()); ICoinAccepter coinAccepter = mainFormController.CoinAccepter; Assert.IsInstanceOf(typeof(ICoinAccepter), coinAccepter); Assert.AreSame(mainFormController.CoinFactory, coinAccepter.CoinFactory); Assert.AreSame(mainFormController.CoinPurse, coinAccepter.CoinPurse); Assert.AreSame(mainFormController.CoinReturn, coinAccepter.CoinReturn); }
static void Main() { IWindowFormsFactory formsFactory = new WindowFormsFactory(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var mainController = new MainFormController(formsFactory); Application.Run(new Login(mainController)); }
static void Main() { WindowFormsFactory _formsFactory = new WindowFormsFactory(); RepositoryFactory _repositoryFactory = new RepositoryFactory(); ServiceFactory _serviceFactory = new ServiceFactory(_repositoryFactory); MainFormController mainController = new MainFormController(_formsFactory, _serviceFactory); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new PresentationLayer.frmMainWindow(mainController)); }
private void RemoveStatsWithNoFile(List <ImageStat> imageStats, MainFormController mainFormController) { foreach (var stat in imageStats) { if (!File.Exists(stat.ImagePath)) { Messaging.Talk($"No physical file {stat.ImagePath}..."); mainFormController.DeleteImageStatById(stat.Id); imageStats = imageStats.Where(s => s.Id != stat.Id).ToList(); } } }
public NewProjectDialog(MainFormController controller) { InitializeComponent(); _controller = controller; foreach (LanguageSettings language in _controller.GetLanguages()) { languagesCombo.Items.Add(language.Language); } languagesCombo.SelectedIndex = 0; projectType.SelectedIndex = 0; }
static void Main() { IWindowFormsFactory WindowsFormsFactory = new WindowFormsFactory(); UserRepository UserRepository = new UserRepository(); AdRepository AdRepository = new AdRepository(); MainFormController MainController = new MainFormController(WindowsFormsFactory, UserRepository, AdRepository); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new WalkMyDog.PresentationLayer.MainForm(MainController)); }
static void Main() { WindowsFormsFactory formsFactory = new WindowsFormsFactory(); MainFormController mainController = new MainFormController(formsFactory, BoardGameRepository.GetInstance(), MemberRepository.GetInstance(), UserRepository.GetInstance(), RentalRepository.GetInstance()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmLogin(mainController)); }
private void BindEvents() { this.barItem_Logout.ItemClick += delegate(object sender, ItemClickEventArgs e) { _isLogout = false; if (MessageBox.Show("是否注销当前用户?", "系统提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { string str = "run.exe"; string path = Path.Combine(Application.StartupPath, str); if (File.Exists(path)) { Process.Start(path); } Application.Exit(); } _isLogout = true; }; this.barItem_Home.ItemClick += delegate(object sender, ItemClickEventArgs e) { MainFormController controller = (MainFormController)this._formController; if (this._currentEventHandler == null) { this._currentEventHandler = controller.quickChanelEventHandler; } object currentHomeMain = controller.CurrentHomeMain; if (currentHomeMain == null) { currentHomeMain = controller.GenerateMainControl(); } e.Item.Tag = currentHomeMain; this._currentEventHandler(e.Item.Tag, e); }; //this.barItem_Message.ItemClick += delegate (object sender, ItemClickEventArgs e) { // using (MailMessageMainFrm frm = new MailMessageMainFrm()) // { // if (frm.ShowDialog() == DialogResult.Yes) // { // } // } //}; //this.barItem_Parameter.ItemClick += delegate (object sender, ItemClickEventArgs e) { // using (BaseParameterSettingFrm frm = new BaseParameterSettingFrm()) // { // if (frm.ShowDialog() == DialogResult.Yes) // { // } // } //}; }
public MainForm( MainFormController mainFormController, LoginFormController loginFormController, CourseFormController courseFormController, UserFormController userFormController) { _mainFormController = mainFormController; _loginFormController = loginFormController; _courseFormController = courseFormController; _userFormController = userFormController; InitializeComponent(); populateCoursesListBox(); }
static void Main() { ISessionFactory sessionFactory = NHibernateService.OpenSessionFactory(); //NHibernateService. WindowFormsFactory formsFactory = new WindowFormsFactory(); IRepositoryFactory repositoryFactory = new RepositoryFactory(sessionFactory); MainFormController mainController = new MainFormController(formsFactory, repositoryFactory); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMainWindow(mainController)); }
public void TestCorrectlyBuildsDisplayController() { Form mainForm = new Form(); TextBox expectedDisplayTextBox = new TextBox(); expectedDisplayTextBox.Name = "DisplayTextBox"; mainForm.Controls.Add(expectedDisplayTextBox); MainFormController mainFormController = new MainFormController(mainForm); VendingDisplayController displayController = mainFormController.DisplayController; Assert.IsInstanceOf(typeof(VendingDisplayController), displayController); Assert.AreSame(expectedDisplayTextBox, displayController.Display); Assert.AreSame(mainFormController.CoinPurse, displayController.CoinPurse); }
public static void Main() { WindowFormsFactory _formsFactory = new WindowFormsFactory(); ReadRepository _readRepo = new ReadRepository(); TBRRepository _tbrRepo = new TBRRepository(); OwnedRepository _ownedRepo = new OwnedRepository(); LibraryRepository _libraryRepo = new LibraryRepository(); WishlistRepository _wishlistRepo = new WishlistRepository(); MainFormController mainController = new MainFormController(_formsFactory, _readRepo, _tbrRepo, _ownedRepo, _libraryRepo, _wishlistRepo); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new BookNook.PresentationLayer.frmMainWindow(mainController)); }
public MainForm() { InitializeComponent(); controller = new MainFormController(); LocalizationService = ServiceLocator.GetInstance<ILocalizationService>(); settingsService = ServiceLocator.GetInstance<ISettingsService>(); LocalizationService.LanguageChanged += LanguageChanged; Localize(); ToogleControls(); SetStatusMessage(); settings = settingsService.LoadSettings(); SetGlobalPaletteMode(); SetLanguage(); controller.UpdateOnStartup(settings); }
public void TestCorrectlyBuildsCoinReturnDisplayController() { Form mainForm = new Form(); TextBox expectedTextBox = new TextBox() { Name = "CoinReturnDisplayTextBox" }; mainForm.Controls.Add(expectedTextBox); MainFormController mainFormController = new MainFormController(mainForm); CoinReturnDisplayController coinReturnDisplayController = mainFormController.CoinReturnDisplayController; Assert.IsInstanceOf(typeof(CoinReturnDisplayController), coinReturnDisplayController); Assert.AreEqual(expectedTextBox, coinReturnDisplayController.Display); Assert.AreEqual(mainFormController.CoinReturn, coinReturnDisplayController.CoinReturn); }
public void TestCorrectlyBuildsChangeReturnButtonController() { Form mainForm = new Form(); Button expectedChangeReturnButton = new Button() { Name = "ChangeReturnButton" }; mainForm.Controls.Add(expectedChangeReturnButton); MainFormController mainFormController = new MainFormController(mainForm); ReturnChangeButtonController returnChangeButtonController = mainFormController.ReturnChangeButtonController; Assert.IsInstanceOf(typeof(ReturnChangeButtonController), returnChangeButtonController); Assert.AreSame(expectedChangeReturnButton, returnChangeButtonController.Button); Assert.AreSame(mainFormController.CoinPurse, returnChangeButtonController.CoinPurse); Assert.AreSame(mainFormController.CoinReturn, returnChangeButtonController.CoinReturn); }
public MainForm() { try { InitializeComponent(); Dispatcher = new MenuDispatcher(this); Controller = new MainFormController(this); this.Load += (s, e) => Controller.InitializeForm(); Current = this; } catch (Exception ex) { ex.ShowMessageBox(); } }
public MetroMainForm(MainFormController controller, DataGridViewService dataGridViewService, ImageStatService imageStatService, FormSettingsService formSettingsService) { _controller = controller; _dataGridViewService = dataGridViewService; _imageStatService = imageStatService; _formSettingsService = formSettingsService; InitializeComponent(); _progressBarWidget = new MetroProgressBarWidget(metroProgressBar1, progressPercent, progressLabel); // metroStyleManager1.Theme = metroStyleManager1.Theme == MetroThemeStyle.Light ? MetroThemeStyle.Dark : MetroThemeStyle.Light; // this.Theme = metroStyleManager1.Theme; // this.Refresh(); // dependencies // handlers Messaging.OnTalk += OnTalkHandler; Messaging.OnProgress += OnProgressHandler; FormClosing += Form1_FormClosing; Load += form_Load; stopButton.Click += stopButton_Click; startbutton.Click += startbutton_Click; metroButton1.Click += cleanSetsButton_Click; analyseButton.Click += analyseButton_Click; extraSetAnalysisCheckbox.CheckedChanged += extraSetAnalysisCheckbox_CheckedChanged; statsAnalysisRange.ValueChanged += statsAnalysisRange_ValueChanged; minSimilarityScoreNumericUpDown.ValueChanged += minSimilarityScoreNumericUpDown_ValueChanged; imageSetsListbox.SelectedIndexChanged += imageSetsListbox_SelectedIndexChanged; imagesGridView.Click += imagesGridView_Click; imagesGridView.DoubleClick += imagesGridView_DoubleClick; // start methods _controller.TestConnection(); SetImageCountText(); imageSetsListbox.Items.Clear(); LoadUiFromSavedOptions(); // hacks for visual performance MakeDoubleBufferedHack(this, true); MakeDoubleBufferedHack(imagesGridView, true); }
public void TestCorrectlyBuildsClearCoinReturnButtonController() { Form mainForm = new Form(); Button expectedClearCoinReturnButton = new Button() { Name = "ClearCoinReturnButton" }; mainForm.Controls.Add(expectedClearCoinReturnButton); MainFormController mainFormController = new MainFormController(mainForm); ClearCoinReturnButtonController clearCoinReturnButtonController = mainFormController.ClearCoinReturnButtonController; Assert.IsInstanceOf(typeof(ClearCoinReturnButtonController), clearCoinReturnButtonController); Assert.AreEqual(expectedClearCoinReturnButton, clearCoinReturnButtonController.Button); Assert.AreEqual(mainFormController.CoinReturn, clearCoinReturnButtonController.CoinReturn); Assert.NotNull(clearCoinReturnButtonController.DialogService); Assert.IsInstanceOf(typeof(DialogService), clearCoinReturnButtonController.DialogService); }
static void Main() { SetupLogger(); // if (!Debugger.IsAttached) // { Application.ThreadException += (sender, e) => HandleError(e.Exception); //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException, true); AppDomain.CurrentDomain.UnhandledException += (sender, e) => HandleError((Exception)e.ExceptionObject); // } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainFormController mainFormController = new MainFormController(); Application.Run(mainFormController.Run()); }
static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm view = new MainForm(); view.Visible = false; MainFormController controller = new MainFormController(view); controller.PrepareView(view); controller.PrepareConfigTab(view); Application.Run(view); } catch (Exception e) { MessageBox.Show("Wystąpił błąd i aplikacja zostanie zamknięta. " + e.Message + "," + e.StackTrace + ((e.InnerException != null) ? e.InnerException.Message + e.InnerException.StackTrace : "")); } }
public void SetUp() { mockProjectMonitor = new Mock <IProjectMonitor>(MockBehavior.Strict); projectMonitor = (IProjectMonitor)mockProjectMonitor.Object; mockConfiguration = new Mock <ICCTrayMultiConfiguration>(); configuration = (ICCTrayMultiConfiguration)mockConfiguration.Object; ISingleServerMonitor[] serverMonitors = new ISingleServerMonitor[0]; mockConfiguration.Setup(_configuration => _configuration.GetServerMonitors()).Returns(serverMonitors); mockConfiguration.Setup(_configuration => _configuration.GetProjectStatusMonitors(It.IsAny <ISingleServerMonitor[]>())).Returns(new IProjectMonitor[0]); mockConfiguration.SetupGet(_configuration => _configuration.Icons).Returns(new Icons()); mockConfiguration.SetupGet(_configuration => _configuration.FixUserName).Returns("John"); GrowlConfiguration growlConfig = new GrowlConfiguration(); mockConfiguration.SetupGet(_configuration => _configuration.Growl).Returns(growlConfig); eventCount = 0; controller = new MainFormController(configuration, null, null); }
public MainForm(MainFormController controller, ConnectionControl connectionControl) { if (controller == null) { throw new ArgumentNullException("controller"); } this.InitializeComponent(); this.Controller = controller; this.Controller.Register(this); this.Controller.Register(connectionControl.Controller); // TODO: View initialization code here this.filterTreeView.ExpandAll(); this.InitializeNotifyIcon(); connectionControl.Dock = DockStyle.Fill; this.myVerticalSplitContainer.Panel2.Controls.Add(connectionControl); this.connectionsGridView.AutoGenerateColumns = false; }
public void SetUp() { mockProjectMonitor = new DynamicMock(typeof(IProjectMonitor)); mockProjectMonitor.Strict = true; projectMonitor = (IProjectMonitor)mockProjectMonitor.MockInstance; mockConfiguration = new DynamicMock(typeof(ICCTrayMultiConfiguration)); configuration = (ICCTrayMultiConfiguration)mockConfiguration.MockInstance; ISingleServerMonitor[] serverMonitors = new ISingleServerMonitor[0]; mockConfiguration.SetupResult("GetServerMonitors", serverMonitors); mockConfiguration.SetupResult("GetProjectStatusMonitors", new IProjectMonitor[0], typeof(ISingleServerMonitor[])); mockConfiguration.SetupResult("Icons", new Icons()); mockConfiguration.SetupResult("FixUserName", "John"); GrowlConfiguration growlConfig = new GrowlConfiguration(); mockConfiguration.SetupResult("Growl", growlConfig); eventCount = 0; controller = new MainFormController(configuration, null, null); }
public void SetAdapter(MainFormController controller) { _controller = controller; // Classical .NET controls like a WinForm button // expose event delegates, like a ".Load or .Click event", that you can subscribe to. // We subscribe to some of those low-level .NET events here and convert them into // more meaningful "UI domain" events that we care about. // We then send/publish them to our own custom event handling system // (to our in-memory queue->to potentially the UI message bus, etc.). Load += (sender, args) => _controller.Publish(new FormLoading()); _menuCaptureThought.Click += (sender, args) => _controller.Publish(new UI.AddStuffClicked()); _menuDefineProject.Click += (sender, args) => _controller.Publish(new UI.DefineProjectClicked()); _menuGoToInbox.Click += (sender, args) => _controller.Publish(new UI.DisplayInbox()); _filter.SelectedIndexChanged += (sender, args) => { var item = (FilterDisplay) _filter.SelectedItem; _controller.Publish(new UI.ActionFilterChanged(item.Criteria)); }; }