Пример #1
0
        public MainForm(MediaIndex index)
        {
            this.index = index ?? throw new ArgumentNullException(nameof(index));
            this.InitializeComponent();

            this.listView = new VirtualSearchResultsView(index)
            {
                Dock           = DockStyle.Fill,
                Margin         = new Padding(0),
                Name           = "listView",
                SmallImageList = this.fileTypeImages,
                TabIndex       = 4,
                UseCompatibleStateImageBehavior = false,
            };
            this.listView.MouseClick           += this.ListView_MouseClick;
            this.listView.MouseDoubleClick     += this.ListView_DoubleClick;
            this.listView.SelectedIndexChanged += this.ListView_SelectedIndexChanged;

            this.preview = new PreviewControl(index)
            {
                Dock     = DockStyle.Fill,
                Name     = "preview",
                TabIndex = 5,
            };

            this.splitContainer.Panel1.Controls.Add(this.listView);
            this.splitContainer.Panel2.Controls.Add(this.preview);

            this.ApplySettings();
        }
Пример #2
0
        public SlideShowForm(MediaIndex index, IEnumerable <SearchResult> searchResults, bool shuffle = false, bool autoPlay = false)
        {
            this.index = index ?? throw new ArgumentNullException(nameof(index));
            var searchResultsList = searchResults.ToList();

            this.searchResults   = searchResultsList.ToDictionary(r => r.Hash);
            this.playlistManager = PlaylistManager.Create(searchResultsList.Select(r => r.Hash));

            this.preview = new PreviewControl(index)
            {
                Dock     = DockStyle.Fill,
                Name     = "preview",
                TabIndex = 0,
            };
            this.preview.Finished        += this.Preview_Finished;
            this.preview.Paused          += this.Preview_PausedOrScannedBackward;
            this.preview.ScannedBackward += this.Preview_PausedOrScannedBackward;
            this.preview.Stopped         += this.Preview_Stopped;
            this.Controls.Add(this.preview);

            this.InitializeComponent();

            this.LastMouseMove = Stopwatch.StartNew();
            var mouseMoveEvents = new MouseMoveEventFilter();

            mouseMoveEvents.MouseMove += (sender, args) => this.LastMouseMove = Stopwatch.StartNew();
            this.Shown      += (sender, args) => Application.AddMessageFilter(mouseMoveEvents);
            this.FormClosed += (sender, args) => Application.RemoveMessageFilter(mouseMoveEvents);

            this.index.HashPersonAdded   += this.Index_HashPersonAdded;
            this.index.HashPersonRemoved += this.Index_HashPersonRemoved;
            this.index.HashTagAdded      += this.Index_HashTagAdded;
            this.index.HashTagRemoved    += this.Index_HashTagRemoved;

            this.shuffleButton.Checked   = shuffle;
            this.playPauseButton.Checked = !autoPlay;
            if (autoPlay)
            {
                this.PlayPauseButton_Click(this, new EventArgs());
            }
            else
            {
                this.playPauseCancel.Cancel();
            }
        }