public void SetData(object data) { var dataProcessor = data as IDataProcessor; _dataProcessor = dataProcessor ?? throw new InvalidOperationException($"Аргумент {nameof(data)} должен наследовать интерфейс {nameof(IDataProcessor)}"); _dataProcessorInfo = new DataProcessorInfo(dataProcessor); _dataProcessor.Awake(); if (_dataProcessorInfo.Outputs.Count > 1) { throw new NotImplementedException(); } var output = _dataProcessorInfo.Outputs.Single(); _outputDataRenderer = DataRendererUtil.GetRendererFor(output.Type); _outputDataRenderer.OnUpdateRequest += RequestUpdate; _outputDataRenderer.UpdateControlsRequest += () => UpdateControlsRequest?.Invoke(); var outputObject = output.Get(); if (outputObject != null) { _outputDataRenderer.SetData(outputObject); } _dataProcessor.Updated += DataProcessorUpdated; }
public void SetData(object data) { var renderer = DataRendererUtil.GetRendererFor(data.GetType()); if (renderer == null) { return; } renderer.SetData(data); SetRenderer(renderer); containerHeader1.Text = $"[{renderer.GetType().Name} - {renderer.GetData().GetType().Name}] {renderer.GetTitle()}"; Redraw(); }