예제 #1
0
        private void OpenProject(String Path)
        {
            if (!IO.File.Exists(Path))
            {
                ErrorDialog.Show("File does not exist.");
                return;
            }

            this.AddProjectRecent(Path);

            var ProjPath = IO.Path.ChangeExtension(Path, "omproj");
            var ProjOpened = false;
            if (IO.File.Exists(ProjPath))
            {
                try
                {
                    using (var File = IO.File.Open(ProjPath, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read))
                    {
                        this.Project = (Project)Formatter.Deserialize(File);
                    }
                    this.Project.ProjectFilePath = Path;
                    ProjOpened = true;
                }
                catch (Exception ex)
                {
                    ErrorDialog.Show("Could not read project file.", ex, new StackTrace(true));
                }
            }
            if (!ProjOpened)
            {
                this.Project =
                    new Project()
                    {
                        InputFileTypeKey = ShapeFileFormatKeys[0],
                        OutputFileTypeKey = ShapeFileFormatKeys[1]
                    };
                this.Project.ProjectFilePath = Path;
                this.SaveProject();
            }

            this.RefreshFilesList();
            this.tableLayoutPanel2.Enabled = true;
        }
예제 #2
0
        private void InitTab2()
        {
            this.shapeTreeViewer2.ShowMoveButtons = false;
            this.shapeDrawingPane2.IsInteractive = false;

            //this.shapeDrawingPane2.ShapeDrawer.BoardBounds = Rectangle.FromCornerSize(new PointF(), this.shapeDrawingPane2.Size.ToPointF());
            //this.shapeDrawingPane2.ShapeDrawer.ResetView();

            foreach (var i in ShapeFileFormats)
            {
                this.comboBox1.Items.Add(i.Key);
                this.comboBox2.Items.Add(i.Key);
            }

            this.Project =
                new Project()
                {
                    InputFileTypeKey = ShapeFileFormatKeys[0],
                    OutputFileTypeKey = ShapeFileFormatKeys[1]
                };
            this.CloseProject();
        }