Ejemplo n.º 1
0
 public void SetView(ProjectModule module, LayoutSimulation sim)
 {
     if (module.Implementation is LayoutModel)
     {
         LayoutModel      layoutModel = (LayoutModel)module.Implementation;
         LayoutSimulation layoutSim;
         if (sim != null)
         {
             layoutSim = sim;
             moduleSimulations[module] = sim;
         }
         else if (!moduleSimulations.TryGetValue(module, out layoutSim))
         {
             SimulationModel simModel = new SimulationModel();
             layoutSim = new LayoutSimulation(simModel, layoutModel);
             moduleSimulations[module] = layoutSim;
         }
         SimulationThread newThread = new SimulationThread(layoutSim.SimulationModel);
         newThread.Start();
         SimulationThread oldThread = simThread;
         simThread = newThread;
         if (oldThread != null)
         {
             oldThread.RequestStop();
         }
         this.CurrentModule = module;
         ToolboxModel.UpdateCurrent(module);
         LayoutCanvas.SetView(layoutModel, layoutSim);
     }
     else
     {
         throw new InvalidOperationException("cannot view this module type");
     }
 }
Ejemplo n.º 2
0
 public void Dispose()
 {
     simThread.RequestStop();
 }