public void LoadListSites(string waferName)
        {
            ExistingData.Clear();
            var dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\SPSProbes";

            if (Directory.Exists(dir) == false)
            {
                Directory.CreateDirectory(dir);
            }

            var filename = dir + "\\" + waferName + ".csv";

            var addData = new List <ProbeSite>();
            var inText  = File.ReadAllLines(filename);

            Canvas.LoadLayerActivation(inText[1]);
            for (int lineI = 3; lineI < inText.Length; lineI++)
            {
                var parts    = inText[lineI].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                var newPoint = new ProbeSite {
                    JunctionName = parts[0], Function = parts[1], Position = new Point(int.Parse(parts[2]), int.Parse(parts[3]))
                };
                ExistingData.Add(newPoint);
                addData.Add(newPoint);
            }
            foreach (var point in addData)
            {
                Canvas.AddListSite(point.Position.X, point.Position.Y);
            }
        }
        public void LoadListSitesCloud(string waferName)
        {
            ExistingData.Clear();
            var dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\SPSProbes";

            if (Directory.Exists(dir) == false)
            {
                Directory.CreateDirectory(dir);
            }

            var filename = dir + "\\" + waferName + ".dxf";

            var dxf = (WebHost + "WaferPlanDXFView?WaferName=" + waferName).WithHeader("Authorization", Form1.pass).WithHeader("x-user", "probe").GetStreamAsync().Result;

            using (var fileStream = File.Create(filename))
            {
                dxf.CopyTo(fileStream);
            }
            Canvas.LoadFile(filename);

            var result = (WebHost + "WaferTestSiteView?WaferName=" + waferName).WithHeader("Authorization", Form1.pass).WithHeader("x-user", "probe").GetJsonAsync <WaferInfo>().Result;


            var jsonS = JsonConvert.SerializeObject(result);

            File.WriteAllText(@"S:\Research\ProbeStation\WaferPlans\" + waferName + ".json", jsonS);

            var addData = new List <ProbeSite>();

            Canvas.LoadLayerActivation(result.activeLayer.Replace("||", " "));

            if (result.probes != null)
            {
                for (int lineI = 0; lineI < result.probes.Length; lineI++)
                {
                    var newPoint = result.probes[lineI];
                    ExistingData.Add(newPoint);
                    addData.Add(newPoint);
                }
                foreach (var point in addData)
                {
                    Canvas.AddListSite(point.Position.X, point.Position.Y);
                }
            }
        }
        public string LoadListSitesLV(string waferName, string dxfFile, string waferTestInfos)
        {
            ExistingData.Clear();
            var dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\SPSProbes";

            if (Directory.Exists(dir) == false)
            {
                Directory.CreateDirectory(dir);
            }

            var filename = dir + "\\" + waferName + ".dxf";

            File.WriteAllText(filename, dxfFile);
            Canvas.LoadFile(filename);

            var result = JsonConvert.DeserializeObject <WaferInfo>(waferTestInfos);

            var addData = new List <ProbeSite>();

            Canvas.LoadLayerActivation(result.activeLayer.Replace("||", " "));

            if (result.probes != null)
            {
                for (int lineI = 0; lineI < result.probes.Length; lineI++)
                {
                    var newPoint = result.probes[lineI];
                    ExistingData.Add(newPoint);
                    addData.Add(newPoint);
                }
                foreach (var point in addData)
                {
                    Canvas.AddListSite(point.Position.X, point.Position.Y);
                }
            }
            return(filename);
        }