public GraphicsViewWorker(GraphicsCallback dataFromService, WhatServiceWork numberOfService, UIColor colorservice, CGRect frame, UIView views) { Frame = frame; BackgroundColor = UIColor.Clear; ClearsContextBeforeDrawing = false; UserInteractionEnabled = true; Opaque = true; this._color = colorservice; this._mainFrameHeight = CountFrameHeight(this.Layer.Frame.Height); this._oSyStep = CountOsyStep(this.Layer.Frame.Height); this._points = CreatePoints(dataFromService, numberOfService); DeleteTouchView(); this.parentView = views; }
private CGPoint[] CreatePoints(GraphicsCallback data, WhatServiceWork service) { nfloat xFirstStep = 40f; nfloat xStep = (_osXLength - 10) / (nfloat)(data.Resource.Count - 1); List <Tuple <nfloat, nfloat> > listOfData = new List <Tuple <nfloat, nfloat> > (); string numberOfEnum = service.ToString(); var keyNumber = (int)((WhatServiceWork)Enum.Parse(typeof(WhatServiceWork), numberOfEnum)); string key = keyNumber.ToString(); foreach (var keys in data.Resource) { listOfData.Add(Tuple.Create(xFirstStep, _mainFrameHeight - _oSyStep * ((nfloat)(Convert.ToInt32(keys.Value [key]))))); xFirstStep += xStep; } nint c = 0; CGPoint[] points = new CGPoint[listOfData.Count]; foreach (var item in listOfData) { points [c] = new CGPoint(item.Item1, item.Item2); c = c + 1; } return(points); }