public OpenProjectMenuItem(IFileOpener<IProject> projectFileOpener, IOpenFileDialog<IProject> openFileDialog,
     IProjectLoader projectLoader)
 {
     this.projectFileOpener = projectFileOpener;
     this.openFileDialog = openFileDialog;
     this.projectLoader = projectLoader;
 }
Exemple #2
0
 public ProductPresenter()
 {
     view = new Form1();
     view.Initialize(this);
     repository     = new ProductRepository();
     openFileDialog = new OpenFileDialogWrapper();
 }
Exemple #3
0
        public override async Task InitializeNonSerializedMembers(object param)
        {
            _key = param as byte[];

            while (!File.Exists(_realPath))
            {
                MessageBoxResult result = Mvx.IoCProvider.Resolve <IMessageBoxService>().Show(
                    $"Album {Name} does not exist. Would you like to update its path?",
                    "Album not found",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Question,
                    MessageBoxResult.Yes);
                if (result == MessageBoxResult.Yes)
                {
                    IOpenFileDialog dialog = Mvx.IoCProvider.Resolve <IFileDialogService>().GetOpenFileDialog();
                    dialog.RestoreDirectory = true;
                    if (dialog.ShowDialog() == OpenFileDialogResult.Ok)
                    {
                        _realPath = dialog.FileName;
                    }
                }
                else
                {
                    return;
                }
            }

            using (var fs = new FileStream(_realPath, FileMode.Open))
            {
                Album = await Mvx.IoCProvider.Resolve <ICryptographyService>().DeserializeAsync <Album>(fs, _key);

                Album.InitializeNonSerializedMembers(_key, _realPath);
            }
        }
        public SettingsPanelViewModel(
            IConfigProvider <SourceControlSettings> configService,
            IFolderBrowserFactory folderBrowserFactory,
            IOpenFileDialog openFileDialog)
        {
            _configService        = configService;
            _folderBrowserFactory = folderBrowserFactory;
            _config = _configService.Create();

            _openFileDialog                 = openFileDialog;
            _openFileDialog.Filter          = "Executables (*.exe)|*.exe|All files (*.*)|*.*";
            _openFileDialog.Multiselect     = false;
            _openFileDialog.ReadOnlyChecked = true;
            _openFileDialog.CheckFileExists = true;

            UserName     = _config.UserName;
            EmailAddress = _config.EmailAddress;
            DefaultRepositoryLocation = _config.DefaultRepositoryLocation;
            CommandPromptLocation     = _config.CommandPromptLocation;

            _showDefaultRepoFolderPickerCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowDefaultRepoFolderPicker());
            _showCommandPromptExePickerCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowCommandPromptExePicker());
            _cancelSettingsChangesCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CancelSettingsChanges());
            _updateSettingsCommand    = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => UpdateSettings());
            _showGitIgnoreCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowGitIgnore(), _ => Provider != null);
            _showGitAttributesCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowGitAttributes(), _ => Provider != null);
        }
Exemple #5
0
        /// <summary>
        /// Shows the OpenFileDialog.
        /// </summary>
        /// <param name="ownerViewModel">
        /// A ViewModel that represents the owner window of the dialog.
        /// </param>
        /// <param name="openFileDialog">The interface of a open file dialog.</param>
        /// <returns>
        /// DialogResult.OK if successful; otherwise DialogResult.Cancel.
        /// </returns>
        public DialogResult ShowOpenFileDialog(object ownerViewModel, IOpenFileDialog openFileDialog)
        {
            Contract.Requires(ownerViewModel != null);
            Contract.Requires(openFileDialog != null);

            return(default(DialogResult));
        }
Exemple #6
0
 public ProductPresenter(IProductView view, IProductRepository repository, IOpenFileDialog openFileDialog)
 {
     this.view = view;
     view.Initialize(this);
     this.repository = repository;
     this.openFileDialog = openFileDialog;
 }
        private static Mock <IFileSystemBrowserFactory> FileSystemBrowserMock(IOpenFileDialog fileDialog, string newIgnoredFilename = null)
        {
            var mock = new Mock <IFileSystemBrowserFactory>();

            mock.Setup(m => m.CreateOpenFileDialog()).Returns(fileDialog);
            return(mock);
        }
Exemple #8
0
        /// <summary>
        /// Runs a common dialog box with the specified owner.
        /// </summary>
        /// <param name="owner">
        /// Any object that implements System.Windows.Forms.IWin32Window that represents the top-level
        /// window that will own the modal dialog box.
        /// </param>
        /// <returns>
        /// System.Windows.Forms.DialogResult.OK if the user clicks OK in the dialog box; otherwise,
        /// System.Windows.Forms.DialogResult.Cancel.
        /// </returns>
        public DialogResult ShowDialog(IOpenFileDialog openFile)
        {
            this.openFileDialog = openFile;

            // Create concrete OpenFileDialog
            concreteOpenFileDialog = new WinFormsOpenFileDialog
            {
                AddExtension     = openFileDialog.AddExtension,
                CheckFileExists  = openFileDialog.CheckFileExists,
                CheckPathExists  = openFileDialog.CheckPathExists,
                DefaultExt       = openFileDialog.DefaultExt,
                FileName         = openFileDialog.FileName,
                Filter           = openFileDialog.Filter,
                InitialDirectory = openFileDialog.InitialDirectory,
                Multiselect      = openFileDialog.Multiselect,
                Title            = openFileDialog.Title
            };
            DialogResult result = concreteOpenFileDialog.ShowDialog();

            // Update ViewModel
            openFileDialog.FileName  = concreteOpenFileDialog.FileName;
            openFileDialog.FileNames = concreteOpenFileDialog.FileNames;

            return(result);
        }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductPresenter" /> class.
 /// </summary>
 /// <param name="productView">The product view.</param>
 /// <param name="productRepository">The product repository.</param>
 /// <param name="openFileDialog">The open file dialog.</param>
 public ProductPresenter(IProductView productView, IProductRepository productRepository, IOpenFileDialog openFileDialog)
 {
     this.productView       = productView;
     this.productRepository = productRepository;
     this.openFileDialog    = openFileDialog;
     this.productView.Initialize(this); //connecting presenter with the ui
 }
 public ProductPresenter(IProductView view, IProductRepository repository, IOpenFileDialog openFileDialog)
 {
     this.view = view;
     view.Initialize(this);
     this.repository     = repository;
     this.openFileDialog = openFileDialog;
 }
        public MainWindowViewModel(WindowSettingsViewModel windowSettingsViewModel, InputTextBoxViewModel inputTextBoxViewModel, StatusBarViewModel statusBarViewModel, IFontDialog fontDialog,
                                   IFindDialog findDialog, IColorDialog colorDialog, IAboutDialog aboutDialog, IMessageDialog messageDialog, IReplaceDialog replaceDialog, IOpenFileDialog openFileDialog,
                                   ISaveFileDialog saveFileDialog, IGoToLineDialog goToLineDialog, ITextFileWriter textFileWriter, ITextFileReader textFileReader, IDocInfoService docInfoService,
                                   IFindNextAndReplaceConditionsService findNextSearchConditionsService)
        {
            _fontDialog     = fontDialog;
            _findDialog     = findDialog;
            _colorDialog    = colorDialog;
            _aboutDialog    = aboutDialog;
            _messageDialog  = messageDialog;
            _replaceDialog  = replaceDialog;
            _openFileDialog = openFileDialog;
            _saveFileDialog = saveFileDialog;
            _goToLineDialog = goToLineDialog;
            _textFileWriter = textFileWriter;
            _textFileReader = textFileReader;
            _docInfoService = docInfoService;
            _findNextSearchConditionsService = findNextSearchConditionsService;

            StatusBarViewModel      = statusBarViewModel;
            InputTextBoxViewModel   = inputTextBoxViewModel;
            WindowSettingsViewModel = windowSettingsViewModel;

            InitMessengerRegistrations();
        }
        /// <summary>
        /// Runs a common dialog box with the specified owner.
        /// </summary>
        /// <param name="owner">
        /// Any object that implements System.Windows.Forms.IWin32Window that represents the top-level
        /// window that will own the modal dialog box.
        /// </param>
        /// <returns>
        /// System.Windows.Forms.DialogResult.OK if the user clicks OK in the dialog box; otherwise,
        /// System.Windows.Forms.DialogResult.Cancel.
        /// </returns>
        public DialogResult ShowDialog(IOpenFileDialog openFile)
        {
            this.openFileDialog = openFile;

            // Create concrete OpenFileDialog
            concreteOpenFileDialog = new WinFormsOpenFileDialog
            {
                AddExtension = openFileDialog.AddExtension,
                CheckFileExists = openFileDialog.CheckFileExists,
                CheckPathExists = openFileDialog.CheckPathExists,
                DefaultExt = openFileDialog.DefaultExt,
                FileName = openFileDialog.FileName,
                Filter = openFileDialog.Filter,
                InitialDirectory = openFileDialog.InitialDirectory,
                Multiselect = openFileDialog.Multiselect,
                Title = openFileDialog.Title
            };
            DialogResult result = concreteOpenFileDialog.ShowDialog();

            // Update ViewModel
            openFileDialog.FileName = concreteOpenFileDialog.FileName;
            openFileDialog.FileNames = concreteOpenFileDialog.FileNames;

            return result;
        }
 public MainViewModel(
     IFileReaderProvider fileReaderProvider,
     ICoverMatrixManager coverMatrixManager,
     IExcelWriter excelWriter,
     IValidateService validateService,
     IGroupingManager groupingManager,
     ITxtExporter txtExporter,
     IFileChecker fileChecker,
     IFileReader fileReader,
     IOpenFileDialog openFileDialog) : base(validateService)
 {
     Progress              = new ProgressBarModel();
     _txtExportert         = txtExporter;
     _fileChecker          = fileChecker;
     _fileReader           = fileReader;
     _openFileDialog       = openFileDialog;
     _fileReaderProvider   = fileReaderProvider;
     _coverMatrixManager   = coverMatrixManager;
     _excelWriter          = excelWriter;
     RunIndicatorVisible   = false;
     ExcelIndicatorVisible = false;
     CmdCancelComputeData  = new DelegateCommand(async() => await CancelComputeData(), () => CancelEnabled);
     CmdComputeData        = new DelegateCommand(async() => await ComputeData(), RunEnableCheck);
     CmdReadFile           = new DelegateCommand(ReadFile, () => RunButtonIndicatorVisible);
     CmdExportToExcel      = new DelegateCommand(async() => await ExportToExcel(), () => CanEnable);
     CmdExportTstToTxt     = new DelegateCommand(async() => await ExportToTxt(CoverResult.TestMatrix, "_Obiekty_testowe"), () => CanEnable);
     CmdExportTrnToTxt     = new DelegateCommand(async() => await ExportToTxt(CoverResult.DataMatrix, "_Obiekty_treningowe"), () => CanEnable);
     MethodsDelegates      = groupingManager.GetGroupingMethods();
     SelectedMethod        = MethodsDelegates.FirstOrDefault();
 }
 protected virtual void SetupContext()
 {
     // Arrange
     repository = MockRepository.GenerateMock <IProductRepository>();
     view       = MockRepository.GenerateMock <IProductView>();
     dialog     = MockRepository.GenerateMock <IOpenFileDialog>();
     presenter  = new ProductPresenter(view, repository, dialog);
 }
Exemple #15
0
 public void OpenFile(IOpenFileDialog openFileDialog)
 {
     openFileDialog = openFileDialog ?? this.openFileDialog;
     if (openFileDialog?.ShowDialog() == true)
     {
         Source = openFileDialog.FileName;
     }
 }
Exemple #16
0
        /// <summary>
        /// Shows the OpenFileDialog.
        /// </summary>
        /// <param name="ownerViewModel">
        /// A ViewModel that represents the owner window of the dialog.
        /// </param>
        /// <param name="openFileDialog">The interface of a open file dialog.</param>
        /// <returns>DialogResult.OK if successful; otherwise DialogResult.Cancel.</returns>
        public DialogResult ShowOpenFileDialog(object ownerViewModel, IOpenFileDialog openFileDialog)
        {
            // Create OpenFileDialog with specified ViewModel
            var dialog = new OpenFileDialog(openFileDialog);

            // Show dialog
            return(dialog.ShowDialog(new WindowWrapper(FindOwnerWindow(ownerViewModel))));
        }
        public MainWindowViewModel(IOpenFileDialog openFileDialog)
        {
            var fileConverter    = new FileConverter();
            var projectConverter = new ProjectConverter();

            Settings = new SettingsViewModel();
            File     = new ConvertFileViewModel(fileConverter, Settings);
            Project  = new ConvertProjectViewModel(fileConverter, projectConverter, openFileDialog, File, Settings, this);
        }
        /// <summary>
        /// Shows a dialog to open a csv file.
        /// </summary>
        public void LoadCSVFileDialog()
        {
            IOpenFileDialog ofd = _windowManager.CreateOpenFileDialog();

            ofd.Filter = "CSV Files|*.csv";
            if (ofd.ShowDialog())
            {
                CSVFilePath = ofd.FileName;
            }
        }
 public OpenFileCommand(MainWindowViewModel callerViewModel, IMessageDialog messageDialog, ISaveFileDialog saveFileDialog, IOpenFileDialog openFileDialog,
                        IDocInfoService docInfoService, ITextFileWriter textFileWriter, ITextFileReader textFileReader) : base(callerViewModel)
 {
     _messageDialog  = messageDialog;
     _saveFileDialog = saveFileDialog;
     _openFileDialog = openFileDialog;
     _docInfoService = docInfoService;
     _textFileWriter = textFileWriter;
     _textFileReader = textFileReader;
 }
Exemple #20
0
 public ZustellSettingsViewModel(IUnityContainer uc, IDialogService dialog, IOpenFileDialog openFileDialog, IFolderBrowserDialog folderBrowser)
 {
     _uc               = uc;
     _dlg              = dialog;
     _openFile         = openFileDialog;
     _folderBrowser    = folderBrowser;
     _exeFileName      = PlugInSettings.Default.DeliveryExePath;
     _arguments        = PlugInSettings.Default.DeliveryArgs;
     _workingDirectory = PlugInSettings.Default.DeliveryWorkDir;
 }
Exemple #21
0
        private async Task AddMediaFromFileSystem()
        {
            IOpenFileDialog dialog = Mvx.IoCProvider.Resolve <IFileDialogService>().GetOpenFileDialog();

            dialog.RestoreDirectory = true;
            dialog.Multiselect      = true;
            if (dialog.ShowDialog() == OpenFileDialogResult.Ok)
            {
                await Album.AddMedia(new List <string>(dialog.FileNames));
            }
        }
        public CodeExplorer_ImportCommand(IOpenFileDialog openFileDialog)
        {
            _openFileDialog = openFileDialog;

            _openFileDialog.AddExtension       = true;
            _openFileDialog.AutoUpgradeEnabled = true;
            _openFileDialog.CheckFileExists    = true;
            _openFileDialog.Multiselect        = true;
            _openFileDialog.ShowHelp           = false; // we don't want 1996's file picker.
            _openFileDialog.Filter             = @"VB Files|*.cls;*.bas;*.frm";
            _openFileDialog.CheckFileExists    = true;
        }
Exemple #23
0
 public OpenCommand(ICanFileEdit scriptingCodeEditor, ICanFileEdit customFunctionsCodeEditor, ISharedViewState sharedViewState, IOpenFileDialog openFileDialog)
 {
     Icon                           = Resources.openToolStripButtonImage;
     Text                           = MenuStrings.openToolStripButton_Text;
     ToolTip                        = MenuStrings.openToolStripButton_Text;
     ShortcutKeyString              = "Ctrl+O";
     this.scriptingCodeEditor       = scriptingCodeEditor;
     this.customFunctionsCodeEditor = customFunctionsCodeEditor;
     _sharedViewState               = sharedViewState;
     _openFileDialog                = openFileDialog;
     _openFileDialog.Filter         = HandledFilesInformation.TslFilesFIlter;
 }
        public MenuVM(
            IOpenFileDialog openFileDialog,
            IDictionaryImporter dictionaryImporter,
            IRepository dictionaryRepository)
        {
            _openFileDialog        = openFileDialog;
            _dictionaryImporter    = dictionaryImporter;
            _dictionaryRepository  = dictionaryRepository;
            _openFileDialog.Filter = "Comma separated files (*.csv)|*.csv|All files (*.*)|*.*";

            AvailableDictionaries = new ObservableCollection <Dictionary>();
        }
        public MenuVM(
            IOpenFileDialog openFileDialog,
            IDictionaryImporter dictionaryImporter,
            IRepository dictionaryRepository)
        {
            _openFileDialog = openFileDialog;
            _dictionaryImporter = dictionaryImporter;
            _repository = dictionaryRepository;
            _openFileDialog.Filter = "Comma separated files (*.csv)|*.csv|All files (*.*)|*.*";

            AvailableDictionaries = new ObservableCollection<Dictionary>();
        }
Exemple #26
0
        public ImportCommand(IVBE vbe, IOpenFileDialog openFileDialog) : base(LogManager.GetCurrentClassLogger())
        {
            _vbe            = vbe;
            _openFileDialog = openFileDialog;

            _openFileDialog.AddExtension       = true;
            _openFileDialog.AutoUpgradeEnabled = true;
            _openFileDialog.CheckFileExists    = true;
            _openFileDialog.Multiselect        = true;
            _openFileDialog.ShowHelp           = false; // we don't want 1996's file picker.
            _openFileDialog.Filter             = @"VB Files|*.cls;*.bas;*.frm";
            _openFileDialog.CheckFileExists    = true;
        }
Exemple #27
0
        /// <summary>
        /// Shows a file dialog and lets the user
        /// select a database file.
        /// Filter will be applied depending on selected <see cref="MediaPlayerDatabaseType"/>.
        /// </summary>
        public void SelectFile()
        {
            IOpenFileDialog ofd = _windowManager.CreateOpenFileDialog();

            if (MediaPlayerDatabaseType == MediaPlayerDatabaseType.iTunes_Or_Winamp)
            {
                ofd.Filter = "iTunes/Winamp Database XML (*.xml) | *.xml";
            }

            if (ofd.ShowDialog())
            {
                DBFilePath = ofd.FileName;
            }
        }
Exemple #28
0
        public SettingsViewModel(ISettingsHandler settingsHandler, IDisplayHandler displayHandler, IOpenFileDialog openFileDialog)
        {
            _settingsHandler            = settingsHandler ?? throw new ArgumentException("Parameter cannot be null", nameof(settingsHandler));
            _displayHandler             = displayHandler ?? throw new ArgumentException("Parameter cannot be null", nameof(displayHandler));
            _openFileDialog             = openFileDialog ?? throw new ArgumentException("Parameter cannot be null", nameof(openFileDialog));
            _checkInterval              = settingsHandler.GetCheckInterval();
            _autoStart                  = settingsHandler.GetAutoStart();
            _attachLastFileFromLocation = settingsHandler.GetAttachLastFileFromLocation();
            _lastFileToAttachLocation   = settingsHandler.GetLastFileToAttachLocation();
            var displays = _displayHandler.Get().Select(d => new DisplayViewModel(d, SaveDisplaySettings));

            _displays   = new ObservableCollection <DisplayViewModel>(displays);
            _isExpanded = settingsHandler.GetSettingsIsExpanded();
        }
 private static void ConfigureOpenDialog(IOpenFileDialog dialog)
 {
     dialog.AddExtension       = true;
     dialog.AutoUpgradeEnabled = true;
     dialog.CheckFileExists    = true;
     dialog.CheckPathExists    = true;
     dialog.Multiselect        = true;
     dialog.ShowHelp           = false; // we don't want 1996's file picker.
     //TODO - Filter needs descriptions.
     dialog.Filter = string.Concat(RubberduckUI.ImportCommand_OpenDialog_Filter_VBFiles,
                                   @" (*.cls, *.bas, *.frm, *.doccls)|*.cls; *.bas; *.frm; *.doccls|",
                                   RubberduckUI.ImportCommand_OpenDialog_Filter_AllFiles, @" (*.*)|*.*");
     dialog.Title = RubberduckUI.ImportCommand_OpenDialog_Title;
 }
Exemple #30
0
        public ImportCommand(IVBE vbe, IOpenFileDialog openFileDialog) : base(LogManager.GetCurrentClassLogger())
        {
            _vbe            = vbe;
            _openFileDialog = openFileDialog;

            _openFileDialog.AddExtension       = true;
            _openFileDialog.AutoUpgradeEnabled = true;
            _openFileDialog.CheckFileExists    = true;
            _openFileDialog.CheckPathExists    = true;
            _openFileDialog.Multiselect        = true;
            _openFileDialog.ShowHelp           = false; // we don't want 1996's file picker.
            _openFileDialog.Filter             = string.Concat(RubberduckUI.ImportCommand_OpenDialog_Filter_VBFiles, @" (*.cls, *.bas, *.frm, *.doccls)|*.cls; *.bas; *.frm; *.doccls|", RubberduckUI.ImportCommand_OpenDialog_Filter_AllFiles, @" (*.*)|*.*");
            _openFileDialog.Title = RubberduckUI.ImportCommand_OpenDialog_Title;
        }
 bool FileDilogOpen(IOpenFileDialog fd)
 {
     try
     {
         if (fd.Open())
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка выбора файла шаблона. " + ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         FileDilogOpen(fd);
     }
     return(false);
 }
Exemple #32
0
        public GameBoyContollerViewModel(IGameBoy gameBoy, IOpenFileDialogFactory fileDialogFactory,
                                         BreakpointsViewModel breakpoints)
        {
            _gameBoy    = gameBoy;
            _fileDialog = fileDialogFactory.Create();
            _fileDialog.OnFileOpened += OnFileOpened;

            audioManager = new AudioManager(gameBoy);

            _breakpoints  = breakpoints;
            _gameBoy      = gameBoy;
            _cpu          = gameBoy.CPU;
            _disassembler = gameBoy.Disassembler;

            _breakpoints.BreakpointChanged += _breakpoints_BreakpointChanged;
        }
        public GameBoyContollerViewModel(IGameBoy gameBoy, IOpenFileDialogFactory fileDialogFactory,
                                         BreakpointsViewModel breakpoints)
        {
            _gameBoy = gameBoy;
            _fileDialog = fileDialogFactory.Create();
            _fileDialog.OnFileOpened += OnFileOpened;

            audioManager = new AudioManager(gameBoy);

            _breakpoints = breakpoints;
            _gameBoy = gameBoy;
            _cpu = gameBoy.CPU;
            _disassembler = gameBoy.Disassembler;

            _breakpoints.BreakpointChanged += _breakpoints_BreakpointChanged;
        }
Exemple #34
0
        public MediaViewModel(IMediaPlayer mediaPlayer, IOpenFileDialog openFileDialog)
        {
            this.mediaPlayer    = mediaPlayer;
            this.openFileDialog = openFileDialog;

            FileOpenCommand       = new RelayCommand <IOpenFileDialog>(OpenFile, CanOpenFile);
            PlaybackSwitchCommand = new RelayCommand(SwitchPlayback, CanSwitchPlayback);
            RewindCommand         = new RelayCommand(Rewind, CanRewind);
            FastForwardCommand    = new RelayCommand(FastForward, CanFastForward);

            mediaPlayer.StateChanged += (s, e) =>
            {
                IsPlaying = mediaPlayer.IsPlaying;
                IsOpened  = mediaPlayer.IsOpened;

                CommandManager.InvalidateRequerySuggested();
            };
        }
Exemple #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenFileDialog"/> class.
        /// </summary>
        /// <param name="openFileDialog">The interface of a open file dialog.</param>
        public OpenFileDialog(IOpenFileDialog openFileDialog)
        {
            Contract.Requires(openFileDialog != null);

            this.openFileDialog = openFileDialog;

            // Create concrete OpenFileDialog
            concreteOpenFileDialog = new WinFormsOpenFileDialog
            {
                AddExtension     = openFileDialog.AddExtension,
                CheckFileExists  = openFileDialog.CheckFileExists,
                CheckPathExists  = openFileDialog.CheckPathExists,
                DefaultExt       = openFileDialog.DefaultExt,
                FileName         = openFileDialog.FileName,
                Filter           = openFileDialog.Filter,
                InitialDirectory = openFileDialog.InitialDirectory,
                Multiselect      = openFileDialog.Multiselect,
                Title            = openFileDialog.Title
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenFileDialog"/> class.
        /// </summary>
        /// <param name="openFileDialog">The interface of a open file dialog.</param>
        public OpenFileDialog(IOpenFileDialog openFileDialog)
        {
            Contract.Requires(openFileDialog != null);

            this.openFileDialog = openFileDialog;

            // Create concrete OpenFileDialog
            concreteOpenFileDialog = new WinFormsOpenFileDialog
            {
                AddExtension = openFileDialog.AddExtension,
                CheckFileExists = openFileDialog.CheckFileExists,
                CheckPathExists = openFileDialog.CheckPathExists,
                DefaultExt = openFileDialog.DefaultExt,
                FileName = openFileDialog.FileName,
                Filter = openFileDialog.Filter,
                InitialDirectory = openFileDialog.InitialDirectory,
                Multiselect = openFileDialog.Multiselect,
                Title = openFileDialog.Title
            };
        }
Exemple #37
0
 public OpenFileDialog(Generator g)
     : base(g, typeof(IOpenFileDialog))
 {
     inner = (IOpenFileDialog)Handler;
 }
 bool FileDilogOpen(IOpenFileDialog fd)
 {
     try
     {
         if (fd.Open())
             return true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка выбора файла шаблона. " + ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         FileDilogOpen(fd);
     }
     return false;
 }
Exemple #39
0
		protected OpenFileDialog (Generator g, Type type, bool initialize = true)
			: base(g, type, initialize)
		{
			handler = (IOpenFileDialog)Handler;
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="OpenFileDialog"/> class.
 /// </summary>
 /// <param name="openFileDialog">The interface of a open file dialog.</param>
 public OpenFileDialog(IOpenFileDialog openFileDialog)
 {
 }