Пример #1
0
        public MainForm(IAboutBox aboutBox,
                        ILogger logger,
                        CurrentDataDevice dataDevice,
                        WinformsMainMenuExtender mainMenuExtender,
                        IEnumerable<IStatusbarExtension> statusbarExtensions,
                        IEnumerable<IToolbarExtension> toolbarExtensions)
        {
            _aboutBox = aboutBox;
            _logger = logger;
            _mainMenuExtender = mainMenuExtender;
            _statusbarExtensions = statusbarExtensions;
            _toolbarExtensions = toolbarExtensions;

            _currentDataDevice = dataDevice;
            _currentDataDevice.PropertyChanged += (sender, args) =>
                                                    {
                                                        var oldDataDevice = _dataDevice;
                                                        _dataDevice = _currentDataDevice.CurrentDevice;
                                                        if (_dataDevice != null)
                                                        {
                                                            _dataDevice.PropertyChanged += DataDeviceOnPropertyChanged;
                                                            _dataDevice.DataReceived += DataDeviceOnDataReceived;
                                                        }
                                                        if (oldDataDevice != null)
                                                        {
                                                            oldDataDevice.PropertyChanged -= DataDeviceOnPropertyChanged;
                                                            oldDataDevice.DataReceived -= DataDeviceOnDataReceived;
                                                        }
                                                    };

            _dataDevice = _currentDataDevice.CurrentDevice;

            LogTo.Debug("Mainform object created");
        }
Пример #2
0
        public MainForm(IAboutBox aboutBox,
                        ILogger logger,
                        CurrentDataDevice dataDevice,
                        WinformsMainMenuExtender mainMenuExtender,
                        IEnumerable <IStatusbarExtension> statusbarExtensions,
                        IEnumerable <IToolbarExtension> toolbarExtensions)
        {
            _aboutBox            = aboutBox;
            _logger              = logger;
            _mainMenuExtender    = mainMenuExtender;
            _statusbarExtensions = statusbarExtensions;
            _toolbarExtensions   = toolbarExtensions;

            _currentDataDevice = dataDevice;
            _currentDataDevice.PropertyChanged += (sender, args) =>
            {
                var oldDataDevice = _dataDevice;
                _dataDevice = _currentDataDevice.CurrentDevice;
                if (_dataDevice != null)
                {
                    _dataDevice.PropertyChanged += DataDeviceOnPropertyChanged;
                    _dataDevice.DataReceived    += DataDeviceOnDataReceived;
                }
                if (oldDataDevice != null)
                {
                    oldDataDevice.PropertyChanged -= DataDeviceOnPropertyChanged;
                    oldDataDevice.DataReceived    -= DataDeviceOnDataReceived;
                }
            };

            _dataDevice = _currentDataDevice.CurrentDevice;

            LogTo.Debug("Mainform object created");
        }
Пример #3
0
        /// <summary>
        /// Invokes the command.
        /// </summary>
        public override void Invoke()
        {
            OnInvoking();
            ClientApplication ca       = ClientApplication.Instance;
            IAboutBox         aboutBox = (IAboutBox)ca.GetControl(typeof(IAboutBox));

            aboutBox.ShowSimilizationControl();
            OnInvoked();
        }
        public MainWindowViewModel(IPreviewWindow previewWindow,
                                   ISettingsWindow settingsWindow,
                                   IDuplicateFinder queryService,
                                   IAboutBox aboutWindow,
                                   ISettingsService settingsService,
                                   IMainWindow mainWindow)
        {
            Duplicates         = new ObservableCollection <SingleFileEntry>();
            SelectedDuplicates = new ObservableCollection <SingleFileEntry>();
            CollectionView           view             = (CollectionView)CollectionViewSource.GetDefaultView(Duplicates);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Checksum");

            view.GroupDescriptions.Add(groupDescription);
            browseCommand       = new CommandHandler(() => HandleBrowse(), () => CanExecuteBrowse);
            startCommand        = new CommandHandler(() => HandleStart(), () => CanExecuteStart);
            ExportCommand       = new CommandHandler(() => HandleExport(), () => CanExecuteExport);
            ImportCommand       = new CommandHandler(() => HandleImport(), () => true);
            ShowPreviewCommand  = new CommandHandler(() => HandleShowPreview(), () => CanExecuteShowPreview);
            ShowSettingsCommand = new CommandHandler(() => HandleShowSettings(), () => CanExecuteShowSettings);
            ShowAboutCommand    = new CommandHandler(() => HandleAbout(), () => true);
            CancelCommand       = new CommandHandler(() => HandleCancel(), () => CanExecuteCancel);
            RemoveItemCommand   = new RelayCommand <SingleFileEntry>(HandleRemove, CanExecuteRemove);
            bgw                            = new BackgroundWorker();
            bgw.DoWork                    += DoWorkEvent;
            bgw.ProgressChanged           += ProgressChangedEvent;
            bgw.WorkerReportsProgress      = true;
            bgw.WorkerSupportsCancellation = true;
            progressBar                    = new ProgressBar();
            progressBar.Minimum            = 0;
            progressBar.Maximum            = 100;
            progressBar.Step               = 1;
            progressBar.Visible            = false;
            IsIdle                         = true;
            this.previewWindow             = previewWindow;
            this.settingsWindow            = settingsWindow;
            this.queryService              = queryService;
            this.aboutWindow               = aboutWindow;
            settingsService.SettingsSavedObservable.Subscribe(HandleFilterSaved);
            Filter = settingsService.QuerySettings().Filter;
            mainWindow.DataContext = this;
        }
Пример #5
0
 public AboutMenu(IAboutBox aboutBox)
 {
     _aboutBox = aboutBox;
 }
Пример #6
0
 public MainForm(IAboutBox aboutBox, CurrentDataDevice dataDevice, WinformsMainMenuExtender mainMenuExtender, IEnumerable<IStatusbarExtension> statusbarExtensions)
     : this(aboutBox, null, null, null, dataDevice, mainMenuExtender, statusbarExtensions)
 {
 }