コード例 #1
0
 public ImageFileManagerViewModel()
 {
     ImageFileViewModelList = ToImageFileViewModels(Properties.Settings.Default.FileHistory);
     CurrentImageFile       = ImageFileViewModelList.FirstOrDefault(i => i.FullPath == Properties.Settings.Default.LastFilename);
     if (!CurrentImageFile.IsNull)
     {
         CurrentImageFile.BaseAddress = Properties.Settings.Default.BaseAddress;
     }
 }
コード例 #2
0
        private void BrowseForImageFile()
        {
            OpenFileDialog openDlg = new OpenFileDialog();

            //openDlg.Filter = "Kinetis Update image files (*.bin, *.srec, *.sb, *.hex, *.elf)|*.bin;*.srec;*.sb;*.hex;*.elf|All files(*.*)|*.*";
            openDlg.Filter          = "Kinetis Update image files (*.bin, *.sb)|*.bin;*.sb|All files(*.*)|*.*";
            openDlg.CheckFileExists = true;

            if (openDlg.ShowDialog() == true)
            {
                ImageFileViewModelList.Remove(ImageFileViewModelList.FirstOrDefault(i => i.FullPath == openDlg.FileName));
                ImageFileViewModelList.Insert(0, new ImageFileViewModel(openDlg.FileName));
                CurrentImageFile = ImageFileViewModelList[0];
                while (ImageFileViewModelList.Count > 10)
                {
                    ImageFileViewModelList.RemoveAt(10);
                }
                Properties.Settings.Default.FileHistory = ToStringCollection(ImageFileViewModelList);
            }
        } // BrowseForImageFile()