示例#1
0
        public FormMain(log4net.ILog logger, IDirectoryLocator directoryLocator, PluginLoader pluginLoader, IController controller, Updater updater, IDriveDetector driveDetector)
        {
            InitializeComponent();

            Load += OnLoad;

            _logger = logger;
            _directoryLocator = directoryLocator;
            _pluginLoader = pluginLoader;
            _controller = controller;
            _updater = updater;
            _driveDetector = driveDetector;

            _progressBarToolTip = new ToolTip();
            _progressBarToolTip.SetToolTip(progressBar, null);

            _taskbarItem = new WindowsTaskbarItemFactory().GetInstance(Handle);

            progressBar.UseCustomColors = true;
            progressBar.GenerateText = percentComplete => string.Format("{0}: {1:0.00}%", _state, percentComplete);

            playlistListView.ItemSelectionChanged += PlaylistListViewOnItemSelectionChanged;
            playlistListView.ShowAllChanged += PlaylistListViewOnShowAllChanged;
            playlistListView.PlaylistReconfigured += PlaylistListViewOnPlaylistReconfigured;

            tracksPanel.PlaylistReconfigured += TracksPanelOnPlaylistReconfigured;

            mediaPanel.SelectedMediaChanged += MediaPanelOnSelectedMediaChanged;
            mediaPanel.Search = ShowMetadataSearchWindow;

            _updater.IsPortable = _directoryLocator.IsPortable;

            var updateObserver = new FormMainUpdateObserver(this, checkForUpdatesToolStripMenuItem, null);
            updateObserver.BeforeInstallUpdate += update => DisableUpdates();
            var currentVersion = AppUtils.AppVersion;
            _updateHelper = new UpdateHelper(_updater, currentVersion);
            _updateHelper.RegisterObserver(updateObserver);
            SystemEvents.SessionEnded += (sender, args) => DisableUpdates();

            FormClosing += OnFormClosing;
        }
示例#2
0
        public FormMain(ILog logger, IDirectoryLocator directoryLocator, IPreferenceManager preferenceManager,
                        PluginLoader pluginLoader, IPluginRepository pluginRepository, IController controller,
                        IDriveDetector driveDetector, ITaskbarItemFactory taskbarItemFactory,
                        INetworkStatusMonitor networkStatusMonitor, Updater updater)
        {
            InitializeComponent();

            Load += OnLoad;

            _logger = logger;
            _directoryLocator = directoryLocator;
            _preferenceManager = preferenceManager;
            _pluginLoader = pluginLoader;
            _pluginRepository = pluginRepository;
            _controller = controller;
            _driveDetector = driveDetector;
            _taskbarItem = taskbarItemFactory.GetInstance(Handle);
            _networkStatusMonitor = networkStatusMonitor;

            _updater = updater;
            _updater.IsPortable = _directoryLocator.IsPortable;
            _updateHelper = new UpdateHelper(_updater, AppUtils.AppVersion) { AllowDownload = false };

            _progressBarToolTip = new ToolTip();
            _progressBarToolTip.SetToolTip(progressBar, null);

            progressBar.UseCustomColors = true;
            progressBar.GenerateText = percentComplete => string.Format("{0}: {1:0.00}%", _state, percentComplete);

            playlistListView.ItemSelectionChanged += PlaylistListViewOnItemSelectionChanged;
            playlistListView.ShowAllChanged += PlaylistListViewOnShowAllChanged;
            playlistListView.PlaylistReconfigured += PlaylistListViewOnPlaylistReconfigured;

            tracksPanel.PlaylistReconfigured += TracksPanelOnPlaylistReconfigured;

            mediaPanel.SelectedMediaChanged += MediaPanelOnSelectedMediaChanged;
            mediaPanel.Search = ShowMetadataSearchWindow;

            var updateObserver = new FormMainUpdateObserver(this,
                                                            checkForUpdatesToolStripMenuItem,
                                                            updateToolStripMenuItem,
                                                            downloadUpdateToolStripMenuItem);
            updateObserver.BeforeInstallUpdate += update => DisableUpdates();
            SystemEvents.SessionEnded += (sender, args) => DisableUpdates();
            _updateHelper.RegisterObserver(updateObserver);

            FormClosing += OnFormClosing;

            var recentFiles = _preferenceManager.Preferences.RecentFiles;
            if (recentFiles.RememberRecentFiles && recentFiles.RecentBDROMPaths.Any())
            {
                textBoxInput.Text = recentFiles.RecentBDROMPaths.First();
            }

            InitSystemMenu();
        }