public override void DrawFigure(ISimpleCanvas canvas, IParameters parameters) { var x1 = (int)parameters.GetParameter("X1"); var y1 = (int)parameters.GetParameter("Y1"); var x2 = (int)parameters.GetParameter("X2"); var y2 = (int)parameters.GetParameter("Y2"); var frameThickness = (int)parameters.GetParameter("FrameThickness"); for (var i = 0; i < frameThickness; i++) { canvas.DrawFrame(x1 + i, y1 + i, x2 - i, y2 - i); } }
public FileCalculation(FileQueue fileQueue, IParameters parameters) { if (fileQueue == null) throw new ArgumentNullException("fileQueue", "Queue can't be null"); if (parameters == null) throw new ArgumentNullException("parameters", "Parameters can't be null"); Queue = fileQueue; Parameters = parameters; var statisticLog = System.IO.Path.Combine(Parameters.GetParameter("CalculationLogs"), "log.xml"); if (System.IO.File.Exists(statisticLog)) { List<FileCalculationInfo> res = null; typeof(List<FileCalculationInfo>).DeserializeFromXML(System.IO.File.ReadAllText(statisticLog), out res); if (res != null) infoLog.AddRange(res); infoLog.ForEach(il => { if (il.Status == FileCalculationStatus.InAction) { il.Error = "Задание прервано"; il.Status = FileCalculationStatus.Error; } }); } }
private void Init(IParameters parameters) { this.Controls.Clear(); //this.Height = 10 + 30 * parameters.Count + 100; this.Height = 10 + 30 * parameters.Count; int x = 10; int y = 10; for (int i = 0; i < parameters.Count; i++) { IParameter param = parameters.GetParameter(i); Label lb = new Label(); lb.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); lb.Location = new Point(x, y); lb.Text = param.Caption; lb.RightToLeft = RightToLeft.Yes; this.Controls.Add(lb); IParameterControl paramcontrol = ParameterControlFactory.Create(param); this.parameterControls.Add(paramcontrol); Control control = paramcontrol.GetControl(); control.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); control.Width = 150; control.Location = new Point(x + 120, y); this.Controls.Add(control); y += 30; } }