public MdiMain() { Data = "MdiMain"; IsMdiContainer = true; workerApp = new WorkerApp() { Visible = false }; menu = new MenuBar(new MenuBarItem [] { new MenuBarItem("_Options", new MenuItem [] { new MenuItem("_Run Worker", "", () => workerApp.RunWorker(), null, null, Key.CtrlMask | Key.R), new MenuItem("_Cancel Worker", "", () => workerApp.CancelWorker(), null, null, Key.CtrlMask | Key.C), null, new MenuItem("_Quit", "", () => Quit(), null, null, Key.CtrlMask | Key.Q) }), new MenuBarItem("_View", new MenuItem [] { }), new MenuBarItem("_Window", new MenuItem [] { }) }); menu.MenuOpening += Menu_MenuOpening; Add(menu); var statusBar = new StatusBar(new [] { new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Exit", () => Quit()), new StatusItem(Key.CtrlMask | Key.R, "~^R~ Run Worker", () => workerApp.RunWorker()), new StatusItem(Key.CtrlMask | Key.C, "~^C~ Cancel Worker", () => workerApp.CancelWorker()) }); Add(statusBar); Activate += MdiMain_Activate; Deactivate += MdiMain_Deactivate; Closed += MdiMain_Closed; Application.Iteration += () => { if (canOpenWorkerApp && !workerApp.Running && Application.MdiTop.Running) { Application.Run(workerApp); } }; }
private void SignInButton_Click(object sender, RoutedEventArgs e) { if ((LoginField.Text != "") && (PasswordField.Password != "")) { if (dBRepository.GetAllBosses().Exists(a => a.Email == LoginField.Text && a.Password == PasswordField.Password)) { Hide(); var bossApp = new BossApp(dBRepository, dBRepository.GetAllBosses().Find(a => a.Email == LoginField.Text && a.Password == PasswordField.Password)); bossApp.ShowDialog(); Show(); } else if (dBRepository.GetAllExecutors().Exists(a => a.Email == LoginField.Text && a.Password == PasswordField.Password)) { Hide(); var workerApp = new WorkerApp(dBRepository, dBRepository.GetAllExecutors().Find(a => a.Email == LoginField.Text && a.Password == PasswordField.Password)); workerApp.ShowDialog(); Show(); } } }
public void LargeSimulation_All_In_Memory_ScaleOut() { var scenario = new Scenario(Output); scenario.Start(50); // create a three node cluster where the first one is what the client will interoperate with, // but the other 2 will actually own the resources var masterNode = scenario.Containers[0]; var workerPool = scenario.Containers.Skip(1).ToList(); // every node BUT the master // first, create a key_value DB on the dbNode // this is where the data will be stored, and the work of the worker node will be stored // the worker node, will be completely dumb var workerQueueApp = new WorkerQueueApp(); masterNode.Launch(workerQueueApp).GetAwaiter().GetResult(); // now the master, will queue up a bunch of work..and the worker nodes, will pick up the work, and start doing the work, and sending the results to the specified key var random = new Random(123_321); var allTestCases = new Dictionary <double, double>(); workerQueueApp.EnqueueTasks(500, () => { var seed = random.Next(); var seedSquared = Math.Pow(seed, 2); allTestCases.Add(seed, seedSquared); return(seed, seedSquared); }); // the master node has queued up a bunch of work, let the workers start processing it // start a bunch of workers foreach (var container in workerPool) { var workerApp = new WorkerApp(); workerApp.WorkQueueName = "workQueue"; workerApp.PollTimeInMS = 100; container.Launch(workerApp).GetAwaiter().GetResult(); } }