コード例 #1
0
ファイル: IOManager.cs プロジェクト: KiselevKN/BootMega
 private bool ShowDialog(NotificationViewModel vm)
 {
     var v = new NotificationView(vm);
     v.Owner = Application.Current.MainWindow;
     return (bool)v.ShowDialog();
 }
コード例 #2
0
 private void OnOpenFile()
 {
     var dlg = new OpenFileDialog();
     dlg.Filter = "Hex files (*.hex) | *.hex";
     if (dlg.ShowDialog().GetValueOrDefault())
     {
         try
         {
             long size = (settings.MemoryType == MemoryType.FLASH)
                 ? settings.SettingsInfo.Processor.FlashSize
                 : settings.SettingsInfo.Processor.EepromSize;
             IMemory memory = new Memory(size);
             hexFileManager.OpenFile(dlg.FileName, memory);
             var hfvm = new HexFileViewModel(memory, dlg.FileName, this);
             _files.Add(hfvm);
             ActiveDocument = hfvm;
         }
         catch (Exception ex)
         {
             NotificationOpenViewModel vm = new NotificationOpenViewModel(ex.Message);
             NotificationView v = new NotificationView(vm);
             v.Owner = Application.Current.MainWindow;
             v.ShowDialog();
         }
         RaiseCanExecuteChanged();
     }
 }