Пример #1
0
        private void LoadEepromCommand_Execute()
        {
            try
            {
                var dlg = new OpenFileDialogViewModel
                {
                    Title    = "Load EEPROM",
                    Filter   = "EEPROM files (*.eep)|*.eep|All files (*.*)|*.*",
                    FileName = "*.eep",
                };

                if (dlg.Show(this.Dialogs))
                {
                    BreakAllCommand_Execute();

                    var bytes = String.Join(" ", File.ReadAllLines(dlg.FileName))
                                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                .Select(x => Convert.ToInt32(x, 16))
                                .ToArray();

                    for (int i = 0; i < Math.Min(bytes.Length, 1024); i++)
                    {
                        AtmelContext.EEPROM[i] = bytes[i] & 0xff;
                    }
                }
            }
            catch (Exception e)
            {
                new MessageBoxViewModel("Error loading eeprom: " + e.Message, "Error").Show(this.Dialogs);
            }
        }
Пример #2
0
        private void OnSelectImgFile()
        {
            var dlg = new OpenFileDialogViewModel
            {
                Title       = "Select IMG file for SD Card emulation",
                Filter      = "IMG files (*.img)|*.img|All files (*.*)|*.*",
                FileName    = "*.IMG",
                Multiselect = false
            };

            if (dlg.Show(this.MainWindowViewModel.Dialogs))
            {
                this.ImgFile = dlg.FileName;
            }
        }
Пример #3
0
        private void LoadCommand_Execute()
        {
            var dlg = new OpenFileDialogViewModel
            {
                Title       = "Select game file to load",
                Filter      = "HEX files (*.hex)|*.hex|All files (*.*)|*.*",
                FileName    = "*.HEX",
                Multiselect = false
            };

            if (dlg.Show(this.Dialogs))
            {
                Load(dlg.FileName);
            }
        }
Пример #4
0
        private void OnOpen()
        {
            CancelCurrentTrace();
            var dlg = new OpenFileDialogViewModel
            {
                Title       = "Load Perfy Layout",
                Filter      = "Perfy files (*.pfp)|*.pfp|All files (*.*)|*.*",
                FileName    = "*.pfp",
                Multiselect = false
            };

            if (dlg.Show(this.Dialogs))
            {
                this.Caption      = CaptionPrefix + " - " + Path.GetFileName(dlg.FileName);
                this.LastFilename = dlg.FileName;
                Load(dlg.FileName);
            }
        }
Пример #5
0
        public string OpenFileDialog()
        {
            // TODO: Реализовать передачу Filter по типу загружаемого файла.
            var openFileDialog = new OpenFileDialogViewModel()
            {
                Title       = "Открытие файал",
                Filter      = "All files (*.*)|*.*",
                Multiselect = false
            };


            if (openFileDialog.Show(_dialogs))
            {
                return(openFileDialog.FileName);
            }

            else
            {
                return(null);
            }
        }