예제 #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 AmbiguousSeqTest_WordInitial()
        {
            m_ambigSeqList.Add("\u1D50b");
            _prj.AmbiguousSequences.AddRange(m_ambigSeqList);

            string[] result = Parse("\u1D50bai", true, true, out uncertainties);
            Assert.AreEqual(3, result.Length);
            Assert.AreEqual("\u1D50b", result[0]);
        }