Esempio n. 1
0
        private void Save(string strFileName)
        {
            Polygon2D polygon = null;

            if (StatusController.availablePartition == Partition.Left)
            {
                polygon = this.FirstPolygon;
                this.FileName1 = strFileName;
            }
            else
            {
                polygon = this.SecondPolygon;
                this.FileName2 = strFileName;
            }

            string[] s = strFileName.Split('.');

            if (s[s.Length - 1] != "xwf")
            {
                WFParser wfParser = new WFParser(strFileName);
                bool isWritable = false;

                while (!isWritable)
                {
                    try
                    {
                        wfParser.Write(polygon);
                        isWritable = true;
                    }
                    catch (IOException)
                    {
                    }
                }
            }

            else
            {
                XWFParser xwfParser = new XWFParser(strFileName);
                bool isWritable = false;

                while (!isWritable)
                {
                    try
                    {
                        xwfParser.Write(polygon);
                        isWritable = true;
                    }
                    catch (IOException)
                    {
                    }
                }
            }
        }
Esempio n. 2
0
        private void Open(string strFileName)
        {
            WFParser wfParser = new WFParser(strFileName);

            Polygon2D polygon = wfParser.Read();

            if (StatusController.availablePartition == Partition.Left)
            {
                this.LeftPolygon = new Polygon2DAdorner(polygon);
                this.FileName1 = strFileName;
            }
            else
            {
                this.RightPolygon = new Polygon2DAdorner(polygon);
                this.FileName2 = strFileName;
            }
            this.LeftPolygon.ShowIndices = this.showIndicesMenuItem.Checked;
            this.RightPolygon.ShowIndices = this.showIndicesMenuItem.Checked;
        }