private void InitFromModel(ComputerModel model) { if (_model != null) { Dictionary<string, List<Gate>> oldComposites = _model.CompositeGates; Dictionary<string, List<Gate>> newComposites = model.CompositeGates; foreach (var pair in oldComposites) { if (!newComposites.ContainsKey(pair.Key)) { newComposites[pair.Key] = pair.Value; } } } _model = model; CircuitGrid = new CircuitGridVM(_model); CircuitEvaluator eval = CircuitEvaluator.GetInstance(); _outputModel = eval.InitFromModel(_model); OutputGrid.LoadModel(_model, _outputModel); }
public void Restart(object parameter) { try { _model.CurrentStep = 0; CircuitEvaluator eval = CircuitEvaluator.GetInstance(); _outputModel = eval.InitFromModel(_model); OutputGrid.LoadModel(_model, _outputModel); } catch (Exception e) { PrintException(e); } }
public void LoadModel(ComputerModel model, Output outputModel) { _model = model; _outputModel = outputModel; _outputModel.OutputChanged += _model_OutputChanged; string[] regNames = new string[_model.Registers.Count + 1]; regNames[0] = "root"; for (int i = 1; i < regNames.Length; i++) { regNames[i] = _model.Registers[i - 1].Name; } RegistersNames = regNames; }