コード例 #1
0
        /// ------------------------------------------------------------------------------------
        protected override bool SaveChanges()
        {
            foreach (var pageContent in GetTabPageContents())
            {
                pageContent.Save();
            }

            m_project.Save();
            Properties.Settings.Default.Save();
            return(true);
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        public void ApplyFilter(Filter filter, bool forceReapplication)
        {
            if (m_project.RecordCache == null || (CurrentFilter == filter && !forceReapplication))
            {
                return;
            }

            CurrentFilter = filter;
            m_project.RecordCache.BuildFilteredWordCache();
            m_project.Save();
            App.MsgMediator.SendMessage("DataSourcesModified", m_project);
            App.MsgMediator.SendMessage("FilterChanged", filter);
        }
コード例 #3
0
        /// ------------------------------------------------------------------------------------
        private void WriteRoot()
        {
            ProcessHelper.WriteStartElementWithAttrib(_writer, "inventory", "version", kVersion);
            WriteRootAttributes();

            ProcessHelper.WriteMetadata(_writer, _project, true);

            XmlSerializationHelper.SerializeDataAndWriteAsNode(_writer, _project.TranscriptionChanges);
            XmlSerializationHelper.SerializeDataAndWriteAsNode(_writer, _project.AmbiguousSequences);

            if (_project.IgnoredSymbolsInCVCharts.Count > 0)
            {
                ProcessHelper.WriteStartElementWithAttrib(_writer, "symbols", "class", "ignoredInChart");
                foreach (var symbol in _project.IgnoredSymbolsInCVCharts)
                {
                    ProcessHelper.WriteStartElementWithAttribAndEmptyValue(_writer, "symbol", "literal", symbol);
                }

                _writer.WriteEndElement();
            }
            else
            {
                if (!File.Exists(_project.CssFileName.Replace(".css", ".PhoneticInventory.xml")))
                {
                    ProcessHelper.WriteStartElementWithAttrib(_writer, "symbols", "class", "ignoredInChart");
                    ProcessHelper.WriteStartElementWithAttribAndEmptyValue(_writer, "symbol", "literal", "̩");
                    _writer.WriteEndElement();

                    _project.IgnoredSymbolsInCVCharts = new List <string> {
                        "̩"
                    };
                    _project.Save();
                    ProjectInventoryBuilder.Process(_project);
                }
            }

            _writer.WriteStartElement("segments");
            WritePhones();
            _writer.WriteEndElement();

            // Close inventory
            _writer.WriteEndElement();
        }
コード例 #4
0
        /// ------------------------------------------------------------------------------------
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            Properties.Settings.Default.UndefinedPhoneticCharactersDlgCharsGrid = GridSettings.Create(m_gridChars);
            Properties.Settings.Default.UndefinedPhoneticCharactersDlgWhereGrid = GridSettings.Create(m_gridWhere);
            Properties.Settings.Default.UndefinedPhoneticCharactersDlgSplitLoc  = splitContainer1.SplitterDistance;

            if (m_project != null)
            {
                if (m_project.ShowUndefinedCharsDlg != chkShowUndefinedCharDlg.Checked ||
                    m_project.IgnoreUndefinedCharsInSearches != chkIgnoreInSearches.Checked)
                {
                    m_project.ShowUndefinedCharsDlg          = chkShowUndefinedCharDlg.Checked;
                    m_project.IgnoreUndefinedCharsInSearches = chkIgnoreInSearches.Checked;
                    m_project.Save();
                }
            }

            base.OnFormClosing(e);
        }
コード例 #5
0
        /// ------------------------------------------------------------------------------------
        private void Initialize(PaDataSource ds)
        {
            if (ds.Type == DataSourceType.FW && ds.FwSourceDirectFromDB)
            {
                CheckExistenceOfFwDatabase(ds);
            }
            else if (ds.Type == DataSourceType.FW7)
            {
                if (File.Exists(ds.FwDataSourceInfo.Name))
                {
                    if (!File.Exists(ds.FwDataSourceInfo.Name))
                    {
                        var oldProjectFolder   = Path.GetDirectoryName(Path.GetDirectoryName(ds.FwDataSourceInfo.Name));
                        var newFwProjectFolder = Utils.FwProjectsPath;
                        if (newFwProjectFolder != null)
                        {
                            if (oldProjectFolder != null)
                            {
                                ds.FwDataSourceInfo.Name = ds.FwDataSourceInfo.Name.Replace(oldProjectFolder, newFwProjectFolder).Replace(@"\\", @"\");
                            }
                        }
                        if (!File.Exists(ds.FwDataSourceInfo.Name))
                        {
                            App.NotifyUserOfProblem(LocalizationManager.GetString(
                                                        "Miscellaneous.Messages.DataSourceReading.FieldWorks7DataMissingMsg",
                                                        "FieldWorks 7.0 (or later) data is missing. It must be acquired in order for Phonology Assistant to read the data source '{0}'. This data source will be skipped."),
                                                    ds.FwDataSourceInfo.Name);

                            ds.SkipLoadingBecauseOfProblem = true;
                            return;
                        }
                    }
                }
            }
            else if (!File.Exists(ds.SourceFile))
            {
                if (!Path.IsPathRooted(ds.SourceFile))
                {
                    ds.SourceFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ds.SourceFile);
                }
                if (!File.Exists(ds.SourceFile))
                {
                    string newPath = GetMissingDataSourceAction(ds.SourceFile);
                    if (newPath == null)
                    {
                        ds.SkipLoadingBecauseOfProblem = true;
                        return;
                    }

                    ds.SourceFile = newPath;
                }
                m_project.Save();
            }

            if (ds.SkipLoadingBecauseOfProblem)
            {
                return;
            }

            if (ds.Type != DataSourceType.XML && ds.Type != DataSourceType.Unknown)
            {
                m_dataSources.Add(ds);
            }

            if (!ds.VerifyMappings())
            {
                App.NotifyUserOfProblem(LocalizationManager.GetString(
                                            "Miscellaneous.Messages.DataSourceReading.MarkersMissingFromDataSourceMsg",
                                            "The data source file '{0}' is missing some standard format markers that were " +
                                            "assigned to Phonology Assistant fields. Those assignments have been removed. To verify the " +
                                            "assignment of markers to fields, go to the project settings dialog box, select " +
                                            "the data source and click 'Properties'."), ds.SourceFile);
            }
        }