Exemplo n.º 1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            Points.Clear();
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = Application.StartupPath;
            dialog.RestoreDirectory = true;
            dialog.Filter           = "text file|*.txt";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                using (StreamReader sr = new StreamReader(dialog.FileName))
                {
                    while (sr.Peek() >= 0)
                    {
                        string   line   = sr.ReadLine();
                        string[] splits = line.Split(',');
                        Points.Add(new CGPoint()
                        {
                            id = int.Parse(splits[1]),
                            x  = int.Parse(splits[2]),
                            y  = int.Parse(splits[3]),
                        });
                    }
                    sr.Close();
                }
            }
            Draw.DrawPoints(Points, true);
        }
Exemplo n.º 2
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            var ret         = CGUtils.CreateInputBoxDialogue("Input points number: ");
            int pointsCount = 0;

            if (int.TryParse(ret, out pointsCount))
            {
                WinManager.Instance.CreateRandomPoints(pointsCount);
                Draw.DrawPoints(Points, true);
            }
        }