public AppControllerTests() { _amazonLogService = A.Fake<IAmazonLogService>(); _amazonAnalyticsService = A.Fake<IAmazonAnalyticsService>(); _siteSettings=new SiteSettings(){DefaultPageSize = 10}; _appController = new AppController(_amazonLogService, _amazonAnalyticsService, _siteSettings); }
protected override void OnLaunched(LaunchActivatedEventArgs e) { // smooth merchant thumbnail image resizing new BitmapTransform().InterpolationMode = BitmapInterpolationMode.Cubic; Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { var navigationService = new NavigationService(rootFrame); var loginPageViewModel = new LoginPageViewModel(); var accountPageViewModel = new AccountPageViewModel(); var schedulerService = new SchedulerService(); var mondoAuthorizationClient = new MondoAuthorizationClient("YOUR_CLIENT_ID_HERE", "YOUR_CLIENT_SECRET_HERE", "https://production-api.gmon.io"); var appController = new AppController(navigationService, mondoAuthorizationClient, loginPageViewModel, accountPageViewModel, schedulerService); appController.Start(); rootFrame.Navigate(typeof (LoginPage), e.Arguments); rootFrame.DataContext = loginPageViewModel; } Window.Current.Activate(); }
public static AppController GetInstance() { if (_appController == null) { _appController = new AppController(); } return _appController; }
public override void OnCreate() { base.OnCreate(); // Setup Application //AppController.EnableSettings(new AdMaiora.AppKit.Data.UserSettingsPlatformAndroid()); AppController.EnableUtilities(new AdMaiora.AppKit.Utils.ExecutorPlatformAndroid()); //AppController.EnableFileSystem(new AdMaiora.AppKit.IO.FileSystemPlatformAndroid()); //AppController.EnableDataStorage(new AdMaiora.AppKit.Data.DataStoragePlatformAndroid()); //AppController.EnableServices(new AdMaiora.AppKit.Services.ServiceClientPlatformAndroid()); }
public MainWindow() { InitializeComponent(); newCostumer = new User(); newInvoice = new Invoice(); app = new AppController(); app.addCostumer(newCostumer); Application.Current.Properties["ApplicationController"] = app; }
private static int Main(string[] args) { var fileSystem = new FileSystem(); var consoleAdapter = new ConsoleAdapter(); var commandLineParser = new CommandLineParser(); var excludeFileParser = new ExcludeFileParser(fileSystem); var appController = new AppController(fileSystem, consoleAdapter, commandLineParser, excludeFileParser); return(appController.Main(args)); }
// Start is called before the first frame update void Start() { anchorConverter = FindObjectOfType <AnchorConverter>(); aRRaycastManager = GetComponent <ARRaycastManager>(); aRAnchorManager = GetComponent <ARAnchorManager>(); eventSystem = FindObjectOfType <EventSystem>(); anchorManager = FindObjectOfType <AnchorManager>(); appController = FindObjectOfType <AppController>(); materialSwitcher = FindObjectOfType <MaterialSwitcher>(); anchorLerper = FindObjectOfType <AnchorLerper>(); }
private void FrmViewInvoice_Load(object sender, EventArgs e) { //Initialize Controller m_AppController = new AppController(); /* Note that the DataProvider class is static, so it doesn't * get instantiated. */ //Get Customer List CommandGettingOutlet getOutlets = new CommandGettingOutlet(); m_Outlet = (outletList)m_AppController.ExecuteCommand(getOutlets); // Get invoices List CommandGetInvoices getInvoices = new CommandGetInvoices(); m_Invoices = (InvoiceList)m_AppController.ExecuteCommand(getInvoices); invoiceItemBindingSource.DataSource = m_Invoices; #region [ CardView... ] //card.CaptionField = "OUTLETCODE"; //card.CardSpacingWidth = 10; //card.CardSpacingHeight = 10; //card.MaxCardCols = 5; //card.CaptionHeight = 35; //card.CardBackColor = Color.Lavender; //card.WireGrid(this.gridDataBoundGrid1); #endregion //Assumes this.dataTable is a DataTable object with at least 2 columns named "id" and "display". //Sets the style properties. GridStyleInfo style = this.gridDataBoundGrid1.GridBoundColumns[3].StyleInfo; style.CellType = "ComboBox"; style.DataSource = m_Outlet; //Displays in the grid cell. style.DisplayMember = "OutletName"; //Values in the grid cell. style.ValueMember = "OutletCode"; style.DropDownStyle = GridDropDownStyle.AutoComplete; }
private void UploadArchiveButton_Click(object sender, EventArgs e) { DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) { archivePath = openFileDialog1.FileName; AppController appCtrl = new AppController((Form1)FindForm()); appCtrl.StartExtractDataFromArchive(); } }
private void FormMain_Load(object sender, EventArgs e) { AppController.mainForm = this; this.Icon = Properties.Resources.nsharp; AppController.Startup(); RefreshComPorts(); labelAppStatus.ForeColor = Color.LightGreen; LoadFromSettings(); labelAppStatus.Text = "Ready"; this.Enabled = true; }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); }
public void Index() { // Arrange AppController controller = new AppController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void Run_NoMatchingWorkflowWasFound_ReturnsExitCode1() { var appController = new AppController( () => new Dictionary <string, IWorkflow>(), () => { }, _ => { }); int exitCode = appController.Run(new string[0]); exitCode.Should().Be(1); }
static void Main(string[] args) { AppController controller = new AppController(); controller.Begin(); controller.WriteNodes(); controller.OrderAll(); controller.CreateGraph(); controller.DoWork(); controller.WriteOrder(); controller.WriteMachines(); }
private void Awake() { if (_instance != null) { Destroy(gameObject); return; } _instance = this; DontDestroyOnLoad(gameObject); Application.targetFrameRate = 60; SetupFirebase(); }
public void ReadData() { //create instance of database object based on string, pull data from begin to end AppController controller = new AppController(); //give data to view for use with graph - currently placeholders // def wrong ViewResult result = controller.ReadData("mysql", DateTime.Now, DateTime.Now, "Data") as ViewResult; //Assert Assert.IsNotNull(result.Model); }
public void OnClick_Login() { if (AppController.localUser.isLoggedIn) { AppController.LogOut(); } else { // Open login screen for user to log in FlexAS.Demo.LoginScreen.Create(); } }
public Routes() { var controller = new AppController(this); Get["/"] = _ => controller.Home(); Get["/status"] = _ => controller.Status(); Get["/analyse/{idType}/{id}"] = parameters => controller.Analyse(parameters); Get["/chrometise/{idType}/{id}"] = parameters => controller.Chrometise(parameters, true); Get["/chrometise/{idType}/{id}/old"] = parameters => controller.Chrometise(parameters, false); Get["/hexercise/{idType}/{id}"] = parameters => controller.Hexercise(parameters); Get["/survey"] = _ => controller.Survey(); }
public void Draw(int x, Transform parent) { Vector3 lastPos = AppController.LastEnd; lastPos.x += x; Vector3 scale = AppController.TreePrefab.transform.localScale; scale *= actualScale; lastPos.y += scale.y * 5.0f; this.tree = AppController.Draw(AppController.TreePrefab, lastPos, scale, parent); this.initPosition = lastPos; }
public ConversationHub(AppDbContext db, IHostingEnvironment env) { _db = db; _env = env; _uploadFolder = AppController.GetUploadFolder(string.Empty, _env.WebRootPath); if (!Directory.Exists(_uploadFolder)) { Directory.CreateDirectory(_uploadFolder); } }
protected virtual void OnEditItem(TreeViewNode <SubscriptionItemViewModelBase> item) { if (item.Data is SubscriptionViewModel subVM) { AppController.EditSubscription(subVM.Subscription); } else if (item.Data is SubscriptionFolderViewModel subFolderVM) { AppController.EditSubscription(subFolderVM.Folder); } }
public static void StartSerial() { serialThread = new Thread(LoopSerial); serialThread.IsBackground = true; if (portOpen) { AppController.Log("Error: Serial already running.", Constants.Enums.LogMessageType.Error); return; } AppController.Log("Starting Serial port on " + portNameNew + " ....", Constants.Enums.LogMessageType.Basic); serialThread.Start(); }
protected override void InitializeAppController() { _configurationFactoryMock = new Mock <IConfigurationFactory>(); _appController = new AppController( null, null, _desktopStateMock.Object, _configurationControllerMock.Object, _configurationFactoryMock.Object); }
void Awake() { foreach (var c in categories) { GameObject cGO = new GameObject(c); cGO.SetActive(false); cGO.transform.parent = transform; categoryWorlds.Add(c, cGO); } Instance = this; }
public void CreateShouldReturnTheCorrectView() { //ARRANGE var controller = new AppController(null); //ACT var result = controller.Create() as ViewResult; //ASSERT Assert.NotNull(result); Assert.That(result.ViewName, Is.EqualTo("Create")); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); AppController appController = (AppController)target; GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) { margin = { left = (int)(EditorGUIUtility.labelWidth + 15) }, }; if (GUILayout.Button("Optimize", buttonStyle, GUILayout.Width(100))) { appController.StartOptimization(); } if (GUILayout.Button("Reset", buttonStyle, GUILayout.Width(100))) { appController.ResetSolution(); } if (GUILayout.Button("Init Fake Model", buttonStyle, GUILayout.Width(100))) { appController.InitFakeViewModel(); } if (GUILayout.Button("Eval opti", buttonStyle, GUILayout.Width(100))) { appController.EvalOptimization(); } GUIStyle labelStyle = new GUIStyle(GUI.skin.label) { contentOffset = new Vector2(0, 18) }; GUILayout.Label("Selected Solution", labelStyle); GUIStyle sliderStyle = new GUIStyle(GUI.skin.horizontalSlider) { margin = { left = (int)(EditorGUIUtility.labelWidth + 15) }, alignment = TextAnchor.MiddleRight, }; var newSelectedSolution = Mathf.RoundToInt(GUILayout.HorizontalSlider(appController.AppModel.SelectedSolution, 0, appController.AppModel.CurrentNumSolutions - 1, sliderStyle, GUI.skin.horizontalSliderThumb)); if (!CalcUtil.AreEqual(appController.AppModel.SelectedSolution, newSelectedSolution)) { appController.SelectSolution(newSelectedSolution); } }
private void Awake() { if (instance == null) { instance = this; } else { Debug.Log("Instance already exists, destroying object!"); Destroy(this); } }
/// <summary> /// The main entry point for the application. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Application_Startup(object sender, StartupEventArgs e) { // Get the command line arguments and check // if the current session is a restart or // a minimized start string[] args = Environment.GetCommandLineArgs(); if (args.Any(arg => arg == $"{AppController.ParameterPrefix}restart")) { isRestarted = true; } if (args.Any(arg => arg == $"{AppController.ParameterPrefix}minimized")) { startMinimized = true; } // Make sure only one instance is running // if the application is not currently restarting Mutex mutex = new Mutex(true, "GTAWAssistant", out bool isUnique); if (!isUnique && !isRestarted) { MessageBox.Show(Localization.Strings.OtherInstanceRunning, Localization.Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error); Current.Shutdown(); return; } // Initialize the controllers and // display the server picker on the // first start, or the main window // on subsequent starts LocalizationController.InitializeLocale(); AppController.InitializeServerIp(); if (!Settings.Default.HasPickedLanguage) { LanguagePickerWindow languagePicker = new LanguagePickerWindow(); languagePicker.Show(); } else { MainWindow mainWindow = new MainWindow(startMinimized); if (!startMinimized) { mainWindow.Show(); } } // Don't let the garbage // collector touch the Mutex GC.KeepAlive(mutex); }
public async Task TestAdd() { var appService = new Mock <IAppService>(); var logService = new Mock <ISysLogService>(); var ctl = new AppController(appService.Object, logService.Object); Assert.ThrowsException <ArgumentNullException>(() => { ctl.Add(null).GetAwaiter().GetResult(); }); appService.Setup(s => s.GetAsync("01")).ReturnsAsync(new App()); var result = await ctl.Add(new AppVM { Id = "01" }); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(JsonResult)); var jr = result as JsonResult; Assert.IsNotNull(jr.Value); Assert.IsTrue(jr.Value.ToString().Contains("应用Id已存在,请重新输入")); App nullApp = null; appService.Setup(s => s.GetAsync("02")).ReturnsAsync(nullApp); appService.Setup(s => s.AddAsync(It.IsAny <App>())).ReturnsAsync(false); result = await ctl.Add(new AppVM { Id = "02" }); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(JsonResult)); jr = result as JsonResult; Assert.IsNotNull(jr.Value); Assert.IsTrue(jr.Value.ToString().Contains("新建应用失败,请查看错误日志")); appService.Setup(s => s.AddAsync(It.IsAny <App>())).ReturnsAsync(true); appService.Setup(s => s.AddAsync(It.IsAny <App>(), It.IsAny <List <AppInheritanced> >())).ReturnsAsync(true); result = await ctl.Add(new AppVM { Id = "02" }); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(JsonResult)); jr = result as JsonResult; Assert.IsNotNull(jr.Value); Assert.IsFalse(jr.Value.ToString().Contains("新建应用失败,请查看错误日志")); }
private void OnOverrideDialogResponse(bool didConfirm) { if (didConfirm) { // Override maintenance AppController.Login(OnLoginResponse, m_InputUserName.text, m_InputPassword.text, Application.version, m_RememberMe.isOn, true); } else { // Restore login m_LoginCanvasGroup.interactable = true; } }
static void Main(string[] args) { // Creating new instances of view, controller and model //var memberDAL = new MemberDAL(); var AppView = new AppView(); var BoatView = new BoatView(); var MemberView = new MemberView(); var MenuView = new MenuView(); var appController = new AppController(AppView, BoatView, MemberView, MenuView); // Launching controller method. appController.doControll(); }
public override void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } base.Awake(); }
public ConfirmationOrderWindow() { InitializeComponent(); invoice = new Invoice(); app = (AppController)Application.Current.Properties["ApplicationController"]; costumer = app.getCostumer(); invoice = costumer.getInvoice(); this.LabelTotalPrice.Content = "Rp. " + invoice.getTotalPrice(); displayDataIntoListview(); }
private static void InvokeErrorAction(HttpContext httpContext, Exception exception) { var routeData = new RouteData(); routeData.Values["controller"] = "app"; routeData.Values["action"] = "error"; routeData.Values["exception"] = exception; using (var controller = new AppController()) { ((IController)controller).Execute(new RequestContext(new HttpContextWrapper(httpContext), routeData)); } }
public void Initialize(string assemblyFile) { Assembly asm = Assembly.LoadFile(assemblyFile); var q = from t in asm.GetTypes() where t.GetInterfaces().Contains(typeof(AppController)) && !t.IsAbstract && t.IsClass select t; foreach (Type t in q) { _AppController = (AppController)Activator.CreateInstance(t); } }
public void Start() { AppController.instance = this; StringTable.loadFile(); int disableAds = PlayerPrefs.GetInt(DISABLE_ADS); print ("PlayerPrefs.GetInt(DISABLE_ADS) = " + disableAds); AppController.showAds = disableAds == 0; if(AppController.showAds) { print("Creating ad banner on bottom"); AdBinding.createAdBanner( true ); } if(Screen.width > 320) { onIPad = true; guiRect.x = Screen.width/2 -160; guiRect.y = Screen.height/2 - 240; } cameraMgr.updateCamera(); }
/// <summary> /// Either shows the application's main window or inits the application in the system tray. /// </summary> private void OnStartup(object sender, StartupEventArgs args) { Thread.CurrentThread.Name = "Main"; Thread.CurrentThread.SetApartmentState(ApartmentState.STA); // Parse command line options var mpOptions = new CommandLineOptions(); var parser = new CommandLine.Parser(with => with.HelpWriter = Console.Out); parser.ParseArgumentsStrict(args.Args, mpOptions, () => Environment.Exit(1)); // Check if another instance is already running // If new instance was created by UacHelper previous one, assume that previous one is already closed. if (SingleInstanceHelper.IsAlreadyRunning(MUTEX_ID, out _mutex)) { _mutex = null; // Set focus on previously running app SingleInstanceHelper.SwitchToCurrentInstance(SingleInstanceHelper.SHOW_MP2_SERVICEMONITOR_MESSAGE ); // Stop current instance Console.Out.WriteLine("Application already running."); Environment.Exit(2); } // Make sure we're properly handling exceptions DispatcherUnhandledException += OnUnhandledException; AppDomain.CurrentDomain.UnhandledException += LauncherExceptionHandling.CurrentDomain_UnhandledException; var systemStateService = new SystemStateService(); ServiceRegistration.Set<ISystemStateService>(systemStateService); systemStateService.SwitchSystemState(SystemState.Initializing, false); #if !DEBUG string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"Team MediaPortal\MP2-ServiceMonitor\Log"); #endif try { ILogger logger = null; try { ApplicationCore.RegisterVitalCoreServices(); ApplicationCore.RegisterCoreServices(); logger = ServiceRegistration.Get<ILogger>(); logger.Debug("Starting Localization"); Localization localization = new Localization(); ServiceRegistration.Set<ILocalization>(localization); localization.Startup(); //ApplicationCore.StartCoreServices(); logger.Debug("UiExtension: Registering ISystemResolver service"); ServiceRegistration.Set<ISystemResolver>(new SystemResolver()); logger.Debug("UiExtension: Registering IServerConnectionManager service"); ServiceRegistration.Set<IServerConnectionManager>(new ServerConnectionManager()); #if !DEBUG logPath = ServiceRegistration.Get<IPathManager>().GetPath("<LOG>"); #endif } catch (Exception e) { if (logger != null) logger.Critical("Error starting application", e); systemStateService.SwitchSystemState(SystemState.ShuttingDown, true); ServiceRegistration.IsShuttingDown = true; ApplicationCore.DisposeCoreServices(); throw; } var appController = new AppController(); ServiceRegistration.Set<IAppController>(appController); // Start the application logger.Debug("Starting application"); try { ServiceRegistration.Get<IServerConnectionManager>().Startup(); appController.StartUp(mpOptions); } catch (Exception e) { logger.Critical("Error executing application", e); systemStateService.SwitchSystemState(SystemState.ShuttingDown, true); ServiceRegistration.IsShuttingDown = true; } } catch (Exception ex) { #if DEBUG var log = new ConsoleLogger(LogLevel.All, false); log.Error(ex); #else ServerCrashLogger crash = new ServerCrashLogger(logPath); crash.CreateLog(ex); #endif systemStateService.SwitchSystemState(SystemState.Ending, false); Current.Shutdown(); } }
public NuGetContext(AppController ctrl) { Config = Container.Kernel.TryGet<ConfigurationService>(); _currentUser = new Lazy<User>(() => ctrl.OwinContext.GetCurrentUser()); }
void Start() { m_InitScale = m_Text.gameObject.transform.localScale; m_AppController = GameObject.Find("SceneObjects").GetComponent<AppController>() as AppController; }
public NuGetContext(AppController ctrl) { Config = DependencyResolver.Current.GetService<ConfigurationService>(); _currentUser = new Lazy<User>(() => ctrl.OwinContext.GetCurrentUser()); }
public void saveUserData(AppController appController) { setUsername(appController.getUsername()); setMajor(appController.getMajor()); setYear(appController.getYear()); setLoggedIn(appController.getLoggedIn()); setCreatedAccount(appController.getCreatedAccount()); setIAExp(appController.getIAExp()); setGAExp(appController.getGAExp()); setSCExp(appController.getSCExp()); setPPEExp(appController.getPPExp()); setWBExp(appController.getWBExp()); setAllOpportunities(appController.getAllOpportunities()); setUsersSelectedOpportunities(appController.getUsersSelectedOpportunities()); setUsersCompletedOpportunities(appController.getUsersCompletedOpportunities()); setOpportunityIndex(appController.getOpportunityFeedIndex()); setUsersSelectedOpportunityIndex(appController.getUsersSelectedOpportunityIndex()); setUsersCompletedOpportunityIndex(appController.getUsersCompletedOpportunityIndex()); setOpportunityFeedPageNumber(appController.getOpportunityFeedPageNumber()); setUsersOpportunitiesPageNumber(appController.getUsersOpportunitiesPageNumber()); }
public void loadUserData(AppController appController) { appController.setUsername(getUsername()); appController.setMajor(getMajor()); appController.setYear(getYear()); appController.setLoggedIn(getLoggedIn()); appController.setCreatedAccount(getCreatedAccount()); appController.setIAExp(getIAExp()); appController.setGAExp(getGAExp()); appController.setSCExp(getSCExp()); appController.setPPExp(getPPEExp()); appController.setWBExp(getWBexp()); List<Opportunity> allOpps = getAllOpportunities(); List<Opportunity> usersSelectedOpps = getUsersSelectedOpportunities(); List<Opportunity> usersCompletedOpps = getUsersCompletedOpportunities(); appController.setAllOpportunities(allOpps == null? new List<Opportunity>() : allOpps); appController.setUsersSelectedOpportunities(usersSelectedOpportunities == null ? new List<Opportunity>() : usersSelectedOpportunities); appController.setUsersCompletedOpportunities(usersCompletedOpportunities == null ? new List<Opportunity>() : usersCompletedOpportunities); appController.setOpportunityFeedIndex(getOpportunityIndex()); appController.setUsersSelectedOpportunityIndex(getUsersSelectedOpportunityIndex()); appController.setUsersCompletedOpportunityIndex(getUsersCompletedOpportunityIndex()); appController.setOpportunityFeedPageNumber(getOpportunityFeedPageNumber()); appController.setUsersOpportunitiesPageNumber(getUsersOpportunitiesPageNumber()); }
void Awake() { if (appController == null) { DontDestroyOnLoad(gameObject); setAllOpportunities(new List<Opportunity>()); setUsersSelectedOpportunities(new List<Opportunity>()); setUsersCompletedOpportunities(new List<Opportunity>()); setIAExp(0); setGAExp(0); setSCExp(0); setPPExp(0); setWBExp(0); appController = this; } else if (appController != this) { Destroy(gameObject); } }
void Start() { _appController = this; DontDestroyOnLoad(gameObject); LoadScene(Constants.SCENE_MENU); }
public ViewController(AppController app) { this.app = app; }
void Awake() { m_AppController = GameObject.Find( "SceneObjects" ).GetComponent<AppController>() as AppController; }
static void Main() { // this Client App uses a standard "Windows Forms" application as its host Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #region This WinForms host uses its own in-memory message bus to manage the UI... // It uses this in-memory bus to wire user-interface "UI" elements ("controls") to the // logic (in controllers) that will be triggered when the user interacts with those elements. // This allows us to send messages to the uiBus so that interested UI classes can // subscribe to the messages they care about, and react to them // when the bus publishes the messages to tell the UI controls what happened. #endregion var uiBus = new InMemoryBus("UI"); // .dat file to write Domain Events to this session var fileToStoreEventsIn = new FileAppendOnlyStore(new DirectoryInfo(Directory.GetCurrentDirectory())); fileToStoreEventsIn.Initialize(); // provide serialization stuff for our file storage var messageStore = new MessageStore(fileToStoreEventsIn); messageStore.LoadDataContractsFromAssemblyOf(typeof(ActionDefined)); // this WinForm App's own local file-based event storage var appEventStore = new AppEventStore(messageStore); #region Does App care about this msg? This class controls the App's "main message loop"... // It reads all msgs from in-memory queue (mainQueue below) and determines which messages // the App will/will not handle at a given time (based on specific app state). // For each queued message that it determines should be handled by // uiBus subscribers, it passes the messages through to our in-memory uiBus, // so bus subscribers can be called to react to the current message when the bus publishes it. #endregion var appController = new AppController(uiBus, appEventStore); #region In-memory structure that all events we defined will go through... // All domain & system messages we defined are captured // and accumulated in this queue until some code picks up // each message and processes it. // (ex: AppController, declared above, will do that processing in this case). #endregion var mainQueue = new QueuedHandler(appController, "Main Queue"); appController.SetMainQueue(mainQueue); appEventStore.SetDispatcher(mainQueue); var provider = new ClientPerspective(); ClientModelController.WireTo(appEventStore, provider, uiBus, mainQueue); // create services and bind them to the bus // we wire all controls together in a native way. // then we add adapters on top of that var form = new MainForm(); var navigation = new NavigationView(); form.NavigationRegion.RegisterDock(navigation, "nav"); form.NavigationRegion.SwitchTo("nav"); LogController.Wire(form, uiBus); #region View Controllers - Decoupling (UI) Views from their Controllers... // The intent with this design was to enable us to // write components or UI elements in a separated manner. // Provide the ability to develop new functionality independently and // it will sit in its own kind of "sandbox" so you can work on your stuff // without impacting everyone else. // It also sets us up for potential controller/code reuse and sharing in the future. // The UI is broken down into kinda "SEDA standalone controllers" // that communicate with each other via events. This event-driven // separation allows for cleanly implementing logic like: // "If the Inbox is selected, then only display these two menu items, // but if a project is displayed, then display these additional menu items." // See the Handle methods inside of MainFormController.cs for an example. // Event-centric approaches are one of the nicest ways to build // plug-in systems because plug-ins have services and contracts which are linked // to behaviors (and in our case, these are events). // Example: All CaptureThoughtController knows is that it gets handed a View // that it controls (CaptureThoughtForm) and then it has two other injections points, // a Bus and a MainQueue. // See CaptureThoughtController for more comments on how this design works. // The big idea here is that in the future, a controller can be passed an // INTERFACE (say, ICaptureThoughtForm) INSTEAD OF a concrete Windows Forms // implementation (CaptureThoughtForm) like it currently uses. // So we may have a WPF form in the future that implements ICaptureThoughtForm // and we could use that View implementation with the SAME CONTROLLER we already have. // Very similar to how you could use the MVVM pattern with MvvmCross to // reuse common code from the ViewModel down, but implement // platform-specific Views on top of that common/shared code. #endregion #region Wiring up our Views to Controllers... // A "Controller" or "Service" in this client-side ecosystem would usually // define at least two parameters: // MainQueue // and // "Bus" // MainQueue is the place where it would send events that happen inside of it. // Bus is what it subscribes to so that it will be called when specifc events happen. // "Wire" is a static method defined on these controllers that our setup // can call to let them know which form they control, // the bus they can use as a source to subscribe to UI events to react to, // and the target queue that they can use tell the rest of the world about events they generate. #endregion MainFormController.Wire(form, mainQueue, uiBus); AddStuffToInboxController.Wire(new AddStuffToInboxForm(form), uiBus, mainQueue); AddActionToProjectController.Wire(new AddActionToProjectForm(form),uiBus, mainQueue ); DefineProjectController.Wire(new DefineProjectForm(form), uiBus, mainQueue); InboxController.Wire(form.MainRegion, mainQueue, uiBus, provider); NavigationController.Wire(navigation, mainQueue, uiBus, provider); ProjectController.Wire(form.MainRegion, mainQueue, uiBus, provider); NavigateBackController.Wire(uiBus, mainQueue, form); mainQueue.Enqueue(new AppInit()); mainQueue.Start(); Application.Run(form); }
public static AppController Fixture() { AppController controller = new AppController(new AppRepository()); return controller; }
public AppControllerTest() { IUnitOfWork uow = new UnitOfWork(); _controller = new AppController(uow); }