ATML1671Reader.reader.ATMLReader.OpenReaderDocument C# (CSharp) Méthode

OpenReaderDocument() public méthode

public OpenReaderDocument ( ) : void
Résultat void
        public void OpenReaderDocument()
        {
            try
            {
                OnBeginOpenDocument();
                //edtReaderInput.Text = getTPSIFile(out documentName);
                if (OpenInputFile(out _fileInfo, out _content))
                {
                    _documentName = _fileInfo.Name;
                    _extension = _fileInfo.Extension.ToLower();
                    bool ok2Open = true;

                    if (IsNavigatable())
                        OnNavigatableInputDocument();

                    if (IsParsible())
                    {
                        string tpsName = GetTPSName();
                        if (!string.IsNullOrEmpty(tpsName))
                        {
                            //Check to see if there is an open project
                            if (ProjectManager.HasOpenProject())
                            {
                                string projectName = ProjectManager.ProjectName;
                                if (projectName == tpsName)
                                {
                                }
                                else
                                {
                                    //If the project does not match the tps name ask user
                                    //  if they would like to create a new project or add the
                                    ProjectInfo pi = new ProjectInfo();
                                    pi.ProjectName = tpsName;
                                    ProjectManager.CreateProject(pi);
                                }
                                //Check to see if the project name matches the tps name
                                //  document to the current project if one is open
                            }
                            else
                            {
                                //If no project exists create one
                                if (ProjectManager.HasProject(tpsName))
                                {
                                    ProjectManager.OpenProject(tpsName);
                                }
                                else
                                {
                                    ProjectInfo pi = new ProjectInfo();
                                    pi.ProjectName = tpsName;
                                    ProjectManager.CreateProject(pi);
                                }
                            }
                        }
                    }

                    //------------------------------------------------------------------------------//
                    //--- Check if the document is in the current test set, if not ask to add it ---//
                    //------------------------------------------------------------------------------//
                    bool hasReaderDocument = ProjectManager.HasReaderDocument(_documentName);
                    if (hasReaderDocument)
                    {
                        ok2Open = false;
                        if (DialogResult.Yes ==
                            MessageBox.Show(
                                @"This file already exists as a reader document. Would you like to replace it?",
                                @"V E R I F Y",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question))
                        {
                            ok2Open = true;
                        }
                    }
                    if (ok2Open)
                    {
                        if (!hasReaderDocument && DialogResult.Yes ==
                            MessageBox.Show(
                                string.Format(
                                    @"Would you like store this document as a reader document in the {0} project?",
                                    ProjectManager.ProjectName),
                                @"V E R I F Y",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question))
                        {
                            ProjectManager.SaveReaderDocument(_documentName, _content);
                        }
                        OnOpenInputDocument(_fileInfo, _content);
                        if (IsParsible())
                            OnParseableInputDocument();
                    }
                }

                LogManager.SourceTrace( SOURCE, "Reader Input File \"{0}\" opened. ", _documentName);
            }
            catch (Exception err)
            {
                LogManager.SourceError(SOURCE, err);
            }
        }