Beispiel #1
0
 private void DeleteProgFile()
 {
     if (SelectedMeasProg == null)
     {
         return;
     }
     MeasProgs.Remove(SelectedMeasProg);
 }
        public void DeleteMeasProg(int id)
        {
            MeasProg mp = null;

            try
            {
                mp = MeasProgs.Where(p => p.Id == id).Single();
                MeasProgs.Remove(mp);
            }
            catch (Exception)
            {
            }
        }
        public void AddMeasProg(int id, string fileName)
        {
            bool has = MeasProgs.Any(p => p.Id == id);

            if (has)
            {
                return;
            }
            MeasProgs.Add(new MeasProg()
            {
                Id = id, FileName = fileName
            });
        }
Beispiel #4
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);
        }