public void Simulation1() { form = new SimulationForm(); form.Init = Init; form.Render = Render; form.Move = Move; }
public virtual void ShowSimulationWindow(string tabName) { if (Specification != null) { if (Specification.GetProcessNames().Count > 0) { SimulationForm SimulationForm = InstanciateSimulationForm(); try { if (SimulationForm != null) { SimulationForm.SetSpec(tabName, Specification); SimulationForm.Show(); } else { MessageBox.Show(Resources.ModuleFacadeBase_ShowSimulationWindow_Simulation_is_not_supported_in_this_module_, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { SimulationForm.Close(); } } else { MessageBox.Show(Resources.Please_input_at_least_one_runnable_process__process_with_no_parameters__, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LoggerSetup(); EntityLoader loader = new EntityLoader(); loader.LoadFromFile(filePath); List <DisplayableElement> displayableGrid = EntityDisplayConverter.ToDisplayableElements(loader.grid.SelectMany(node => node).ToList <IPosition>()); List <DisplayableElement> displayableRooms = EntityDisplayConverter.ToDisplayableElements(loader.rooms.ToList <IPosition>()); SimulationForm simulationForm = new SimulationForm(displayableGrid, displayableRooms); SimulationController controller = new SimulationController(simulationForm, loader.grid, loader.movableEntities, loader.rooms); Console.WriteLine("Starting Setup:"); Console.WriteLine("Seed file: {0}", filePath); Console.WriteLine("Simulation with {0} people", loader.movableEntities.Count); // close event from the GUI simulationForm.onCloseEvent += (object sender, EventArgs e) => controller.Dispose(); // close event from the console AppDomain.CurrentDomain.ProcessExit += new EventHandler((object sender, EventArgs e) => controller.Dispose()); Thread controllerThread = new Thread(controller.start); simulationForm.onShowEvent += new EventHandler((object sender, EventArgs e) => controllerThread.Start()); Application.Run(simulationForm); }
public ActionResult Calculator(string region) { SimulationForm form = new SimulationForm(); form.Region = region; form.IsAuthenticated = false; if (User.Identity.IsAuthenticated) { form.IsAuthenticated = true; form.BattleTag = UserBattletag; } return(View(form)); }
public ActionResult Progress(string sim) { if (string.IsNullOrWhiteSpace(sim) || !sim.Contains(";") || !sim.Contains("_")) { return(RedirectToAction("Calculator")); } List <CharacterDefinition> toons = new List <CharacterDefinition>(); var simParts = sim.Split(';'); var region = simParts[0]; var serverGroups = simParts[1].Split('|'); foreach (var serverGrp in serverGroups) { var serverParts = serverGrp.Split('_'); var server = serverParts[0]; var toonList = serverParts[1].Split('~'); foreach (var t in toonList) { toons.Add(new CharacterDefinition() { Server = server, Region = region, Name = t }); } } if (toons == null || toons.Count < 1) { return(RedirectToAction("Calculator")); } SimulationForm form = new SimulationForm(); form.Region = region; form.Toons = toons; form.IsAuthenticated = false; if (User.Identity.IsAuthenticated) { form.IsAuthenticated = true; form.BattleTag = UserBattletag; } return(View(form)); }
private void Button_Compare_Click(object sender, System.EventArgs e) { Debug.Assert(this.CheckedListBox_Forms.CheckedItems.Count == 2); SimulationForm FirstGraph = Common.Ultility.Ultility.SimulationForms[this.CheckedListBox_Forms.CheckedIndices[0]]; SimulationForm SecondGraph = Common.Ultility.Ultility.SimulationForms[this.CheckedListBox_Forms.CheckedIndices[1]]; if (FirstGraph.SimulatorViewer.Graph != null && SecondGraph.SimulatorViewer.Graph != null) { DifferenceDisplayForm form = new DifferenceDisplayForm(FirstGraph.SimulatorViewer.Graph, SecondGraph.SimulatorViewer.Graph, FirstGraph.Spec, SecondGraph.Spec); form.Text = form.Text + " (" + this.CheckedListBox_Forms.CheckedItems[0].ToString() + " vs " + this.CheckedListBox_Forms.CheckedItems[1].ToString() + ")"; form.Show(this.Parent); this.Close(); } }
public ActionResult Sim(SimulationForm sim) { if (sim == null || sim.Toons == null || sim.Toons.Count < 1) { return(RedirectToAction("Calculator", new { region = sim.RegionLink })); } else { string progressString = string.Join("|", from t in sim.Toons group t by t.Server into serverGrp select serverGrp.Key + "_" + string.Join("~", serverGrp.Select(x => x.Name))); return(RedirectToAction("Progress", new { sim = sim.Toons[0].Region + ";" + progressString })); } }
public void TestifSimulationFormIsNotNull() { //arrange SimulationForm SimulationFormTest; string path; Settings SettingsTest; //act SettingsTest = new Settings(); path = (Directory.GetCurrentDirectory() + @"..\..\..\HotelTestLayout.layout"); SimulationFormTest = new SimulationForm(path, SettingsTest); //assert Assert.IsNotNull(SimulationFormTest); }
public SimulationController(SimulationForm simulationForm, List <List <Node> > grid, List <Person> movableEntities, List <Room> rooms) { this.simulationForm = simulationForm; this.movableEntities = movableEntities; this.rooms = rooms; this.tickCount = 0; this.pathFinder = new PathFinder(grid); this.statsAggregator = new StatsAggregator(); timer = new System.Timers.Timer(TICK_SPEED_MS); timer.Elapsed += OnTimedEvent; logger.Info("Started new simulation"); }
public void TestIfReceptionScreenIsWorking() { //arrange SimulationForm SimulationFormTest; string path; Settings SettingsTest; ReceptionScreen receptionScreenTest; //act SettingsTest = new Settings(); path = (Directory.GetCurrentDirectory() + @"..\..\..\HotelTestLayout.layout"); SimulationFormTest = new SimulationForm(path, SettingsTest); receptionScreenTest = new ReceptionScreen(SimulationFormTest); //assert Assert.IsNotNull(receptionScreenTest); }
public void TestIfEditScreenIsWorking() { //arrange SimulationForm SimulationFormTest; string path; Settings SettingsTest; EditScreen EditScreenTest; //act SettingsTest = new Settings(); path = (Directory.GetCurrentDirectory() + @"..\..\..\HotelTestLayout.layout"); SimulationFormTest = new SimulationForm(path, SettingsTest); EditScreenTest = new EditScreen(EAreaType.Reception, null, null); //assert Assert.IsNotNull(EditScreenTest); }
public void TestIfLiveStaticticsIsWorking() { //arrange SimulationForm SimulationFormTest; string path; Settings SettingsTest; LiveStatistics LiveStatisticsTest; //act SettingsTest = new Settings(); path = (Directory.GetCurrentDirectory() + @"..\..\..\HotelTestLayout.layout"); SimulationFormTest = new SimulationForm(path, SettingsTest); LiveStatisticsTest = new LiveStatistics(SimulationFormTest); //assert Assert.IsNotNull(LiveStatisticsTest); }
public static SimulationForm CreateSimulationForm <TPlugin, TAgent>(TPlugin simulationPlugin, string pluginName, ISpaceTemplateFactory spaceTemplateFactory, SimulationModelConfiguration modelConfiguration, int animationInterval) where TPlugin : SimulationPlugin <DestructibleInteractiveSpace <CardinalMovementSpace <TAgent>, TAgent>, TAgent> where TAgent : IAnchoredAgent <TAgent>, IInteractiveAgent <CardinalMovement, InteractionResult>, IDestructibleAgent, IGoalAgent { var simulation = new SimulationModel1 <TPlugin, TAgent>(spaceTemplateFactory, simulationPlugin, pluginName, modelConfiguration); var form = new SimulationForm(); form.Simulation = simulation; var width = simulation.Space.InteractiveSpace.Width; var height = simulation.Space.InteractiveSpace.Height; var obstaclesLayer = new BitmapLayer(form.Space, simulation.Space.InteractiveSpace.GetObstacles()); var agentsLayer = new AnimatedLayer(form.Space, width, height); var goalsLayer = new AnimatedLayer(form.Space, width, height); void OnAgentCreated(TAgent agent) { var agentOnLayer = new AgentLayerObject <TAgent>(agent); agentsLayer.Objects.Add(agentOnLayer); goalsLayer.Objects.Add(new GoalLayerObject <TAgent>(agentOnLayer)); } void OnAgentRemoved(TAgent agent) { var agentOnLayer = agentsLayer.Objects.OfType <AgentLayerObject <TAgent> >().FirstOrDefault(o => o.Agent.Equals(agent)); agentsLayer.Objects.Remove(agentOnLayer); var goalOnLayer = goalsLayer.Objects.OfType <GoalLayerObject <TAgent> >().FirstOrDefault(o => o.Agent.Equals(agentOnLayer)); goalsLayer.Objects.Remove(goalOnLayer); } simulation.Agents.ForEach(OnAgentCreated); simulation.AgentCreated += OnAgentCreated; simulation.AgentRemoved += OnAgentRemoved; simulationPlugin.OnSimulationCreated(form, simulation); return(form); }
/// <summary> /// Initialize DockPanel according to DockPanel.config or Default Settings in AppConfig /// </summary> private void InitializeDockPanel() { _readerSettingsForm = new ReaderSettingsForm(this); _tagTableForm = new TagTableForm(); _rssiGraphForm = new RSSIGraphFrom(); _phaseGraphForm = new PhaseGraphForm(); _vitalSignsForm = new VitalSignsForm(this); _sortingBooksForm = new SortingBooksForm(); _linearGuideForm = new LinearGuideForm(); _updateEpcForm = new UpdateEpcForm(); _searchRegionForm = new SearchRegionForm(); _simulationForm = new SimulationForm(this, _linearGuideForm); if (File.Exists(Path.Combine(_filepath, "DockPanel.config"))) { // If DockPanel.config exists, load forms dynamicly this.dockPanelMain.LoadFromXml(Path.Combine(_filepath, "DockPanel.config"), delegate(string persistString) { if (persistString == typeof(ReaderSettingsForm).ToString()) { return(_readerSettingsForm); } if (persistString == typeof(UpdateEpcForm).ToString()) { return(_updateEpcForm); } if (persistString == typeof(TagTableForm).ToString()) { return(_tagTableForm); } if (persistString == typeof(RSSIGraphFrom).ToString()) { return(_rssiGraphForm); } if (persistString == typeof(PhaseGraphForm).ToString()) { return(_phaseGraphForm); } if (persistString == typeof(SearchRegionForm).ToString()) { return(_searchRegionForm); } if (persistString == typeof(SimulationForm).ToString()) { return(_simulationForm); } if (persistString == typeof(LinearGuideForm).ToString()) { return(_linearGuideForm); } if (persistString == typeof(SortingBooksForm).ToString()) { return(_sortingBooksForm); } if (persistString == typeof(VitalSignsForm).ToString()) { return(_vitalSignsForm); } // Undefined forms return(null); }); // Record original DockState if (_readerSettingsForm.DockState != DockState.Unknown && _readerSettingsForm.DockState != DockState.Hidden) { AppConfig.readerSettingsDockState = _readerSettingsForm.DockState; } if (_tagTableForm.DockState != DockState.Unknown && _tagTableForm.DockState != DockState.Hidden) { AppConfig.tagTableDockState = _tagTableForm.DockState; } if (_vitalSignsForm.DockState != DockState.Unknown && _vitalSignsForm.DockState != DockState.Hidden) { AppConfig.vitalSignsDockState = _vitalSignsForm.DockState; } if (_rssiGraphForm.DockState != DockState.Unknown && _rssiGraphForm.DockState != DockState.Hidden) { AppConfig.rssiGraphDockState = _rssiGraphForm.DockState; } if (_phaseGraphForm.DockState != DockState.Unknown && _phaseGraphForm.DockState != DockState.Hidden) { AppConfig.phaseGraphDockState = _phaseGraphForm.DockState; } if (_searchRegionForm.DockState != DockState.Unknown && _searchRegionForm.DockState != DockState.Hidden) { AppConfig.searchRegionDockState = _searchRegionForm.DockState; } if (_updateEpcForm.DockState != DockState.Unknown && _updateEpcForm.DockState != DockState.Hidden) { AppConfig.updateEpcDockState = _updateEpcForm.DockState; } if (_simulationForm.DockState != DockState.Unknown && _simulationForm.DockState != DockState.Hidden) { AppConfig.simulationDockState = _simulationForm.DockState; } if (_linearGuideForm.DockState != DockState.Unknown && _linearGuideForm.DockState != DockState.Hidden) { AppConfig.linearGuideDockState = _linearGuideForm.DockState; } if (_sortingBooksForm.DockState != DockState.Unknown && _sortingBooksForm.DockState != DockState.Hidden) { AppConfig.sortingBooksDockState = _sortingBooksForm.DockState; } } else { // If DockPanel.config does not exists, load forms according to AppConfig _readerSettingsForm = new ReaderSettingsForm(this); _readerSettingsForm.Show(this.dockPanelMain, AppConfig.readerSettingsDockState); _tagTableForm = new TagTableForm(); _tagTableForm.Show(this.dockPanelMain, AppConfig.tagTableDockState); } }
public override void OnSimulationCreated(SimulationForm form, ISimulation <NeuralAgent> simulation) { new AgentViewLayer(form.Space, simulation, Network.InputCoder.ViewRadius); }