public void DeleteMeasProg(int id)
        {
            MeasProg mp = null;

            try
            {
                mp = MeasProgs.Where(p => p.Id == id).Single();
                MeasProgs.Remove(mp);
            }
            catch (Exception)
            {
            }
        }
Beispiel #2
0
        private void AddProgFile()
        {
            var count = MeasProgs.Where(p => p.Id == Id).Count();

            if (count > 0)
            {
                MessageBox.Show("ID重复", "警告", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
                return;
            }
            MeasProgs.Add(new MeasProg()
            {
                Id = Id, FileName = ProgramFileName
            });
        }
        public string GetMeasProg(int id)
        {
            MeasProg prg        = null;
            string   resultProg = string.Empty;

            try
            {
                prg        = MeasProgs.Where(p => p.Id == id).Single();
                resultProg = prg.FileName;
            }
            catch (Exception)
            {
                throw new FileNotFoundException("测量程序未找到");
            }
            return(resultProg);
        }