예제 #1
0
        /// ------------------------------------------------------------------------------------
        protected override bool SaveChanges()
        {
            if (!AmbiguousSequencesChanged)
            {
                _grid.IsDirty = false;
                return(false);
            }

            var ambigSeqList = new AmbiguousSequences();

            foreach (var row in _grid.GetRows().Where(r => r.Index != _grid.NewRowIndex))
            {
                var phone    = row.Cells["seq"].Value as string;
                var basechar = row.Cells["base"].Value as string;

                // Don't bother saving anything if there isn't
                // a phone (sequence) or base character.
                if (phone != null && phone.Trim().Length > 0 &&
                    basechar != null && basechar.Trim().Length > 0)
                {
                    var seq = new AmbiguousSeq(phone.Trim());
                    seq.BaseChar    = basechar.Trim();
                    seq.Convert     = (row.Cells["convert"].Value != null && (bool)row.Cells["convert"].Value);
                    seq.IsGenerated = (bool)row.Cells["generated"].Value;
                    ambigSeqList.Add(seq);
                }
            }

            App.MsgMediator.SendMessage("BeforeAmbiguousSequencesSaved", ambigSeqList);
            _project.SaveAndLoadAmbiguousSequences(ambigSeqList);
            App.MsgMediator.SendMessage("AfterAmbiguousSequencesSaved", ambigSeqList);
            _project.ReloadDataSources();
            return(true);
        }
 public void TestSetup()
 {
     m_ambigSeqList = new AmbiguousSequences();
     _prj.AmbiguousSequences.Clear();
     _prj.TranscriptionChanges.Clear();
     //App.IPASymbolCache.UndefinedCharacters = new UndefinedPhoneticCharactersInfoList();
     _prj.PhoneticParser.LogUndefinedCharactersWhenParsing = true;
     _prj.PhoneticParser.ResetAmbiguousSequencesForTests();
 }
예제 #3
0
        /// ------------------------------------------------------------------------------------
        private void MigrateAmbiguousSequences()
        {
            var filepath = AmbiguousSequences.GetFileForProject(_projectPathPrefix);

            if (!File.Exists(filepath))
            {
                return;
            }

            var error = TransformFile(filepath, "SIL.Pa.Model.Migration.UpdateAmbiguousSequenceFile.xslt");

            if (error != null)
            {
                throw error;
            }
        }