Exemplo n.º 1
0
        public void AddFile(CapturedFile capturedFile)
        {
            this.capturedFiles.Add(capturedFile);

            CapturedFileView view = new CapturedFileView(capturedFile);

            view.SelectAsked += View_Clicked;
            view.LaunchAsked += View_LaunchAsked;
            view.LocateAsked += view_LocateAsked;
            view.HideAsked   += View_HideAsked;
            view.DeleteAsked += View_DeleteAsked;

            // If we are still aligned with the first image, we keep updating the first visible,
            // otherwise we keep things as is.
            bool alignedToFirst = capturedFileViews.Count == 0 || first == capturedFileViews.Count - 1;

            capturedFileViews.Add(capturedFile.Time, view);
            this.Controls.Add(view);

            if (alignedToFirst)
            {
                first++;
                spotWidth = view.Width + margin;
            }

            RecomputeSpots();
            LayoutThumbnails();
            Invalidate();
        }
Exemplo n.º 2
0
        private void view_LocateAsked(object sender, EventArgs e)
        {
            CapturedFileView view = sender as CapturedFileView;

            if (view == null || view.CapturedFile == null || string.IsNullOrEmpty(view.CapturedFile.Filepath))
            {
                return;
            }

            FilesystemHelper.LocateFile(view.CapturedFile.Filepath);
        }
Exemplo n.º 3
0
        private void View_LaunchAsked(object sender, EventArgs e)
        {
            CapturedFileView view = sender as CapturedFileView;

            if (view == null || view.CapturedFile == null || string.IsNullOrEmpty(view.CapturedFile.Filepath))
            {
                return;
            }

            VideoTypeManager.LoadVideo(view.CapturedFile.Filepath, -1);
        }
Exemplo n.º 4
0
        private void View_HideAsked(object sender, EventArgs e)
        {
            CapturedFileView view = sender as CapturedFileView;

            if (view == null)
            {
                return;
            }

            HideCapturedFileView(view.CapturedFile);
        }
Exemplo n.º 5
0
        private void View_LaunchWatcherAsked(object sender, EventArgs e)
        {
            CapturedFileView view = sender as CapturedFileView;

            if (view == null || view.CapturedFile == null || string.IsNullOrEmpty(view.CapturedFile.Filepath))
            {
                return;
            }

            // Replace the filename with a wildcard to turn into a replay watcher over that folder.
            string path = Path.Combine(Path.GetDirectoryName(view.CapturedFile.Filepath), "*");

            VideoTypeManager.LoadVideo(path, -1);
        }
Exemplo n.º 6
0
        private void LayoutThumbnails()
        {
            if (capturedFileViews.Count == 0)
            {
                return;
            }

            this.SuspendLayout();

            if (alignLeft)
            {
                for (int i = capturedFileViews.Count - 1; i >= 0; i--)
                {
                    CapturedFileView view = capturedFileViews.ElementAt(i).Value;

                    // Index is relative to first in view and can be negative.
                    // Elements outside of view to the left will have a negative index and be drawn totally or partially off site.
                    // It's simpler to draw everything, because during animation several partially off site items may come into view.
                    int index = first - i;
                    int left  = masterMargin + (index * (view.Width + margin));

                    left += btnLeft.Width;

                    view.Left    = left;
                    view.Top     = top;
                    view.Visible = true;
                }
            }
            else
            {
                for (int i = 0; i < capturedFileViews.Count; i++)
                {
                    CapturedFileView view = capturedFileViews.ElementAt(i).Value;
                    int index             = i - last;
                    int total             = masterMargin + (index * (view.Width + margin));

                    total += btnRight.Width;

                    int left = this.Width - total - view.Width;

                    view.Left    = left;
                    view.Top     = top;
                    view.Visible = true;
                }
            }

            this.ResumeLayout();
        }
Exemplo n.º 7
0
        private void View_DeleteAsked(object sender, EventArgs e)
        {
            CapturedFileView view = sender as CapturedFileView;

            if (view == null || view.CapturedFile == null || string.IsNullOrEmpty(view.CapturedFile.Filepath))
            {
                return;
            }

            FilesystemHelper.DeleteFile(view.CapturedFile.Filepath);

            if (File.Exists(view.CapturedFile.Filepath))
            {
                return;
            }

            HideCapturedFileView(view.CapturedFile);
            NotificationCenter.RaiseRefreshFileExplorer(this, true);
        }
Exemplo n.º 8
0
        public void AddFile(CapturedFile capturedFile)
        {
            bool known = capturedFiles.Any(c => c.Filename == capturedFile.Filename);

            if (known)
            {
                return;
            }

            this.capturedFiles.Add(capturedFile);

            if (capturedFiles.Count > PreferencesManager.FileExplorerPreferences.MaxRecentCapturedFiles)
            {
                HideCapturedFileView(capturedFiles[0]);
            }

            CapturedFileView view = new CapturedFileView(capturedFile);

            view.LaunchAsked        += View_LaunchAsked;
            view.LaunchWatcherAsked += View_LaunchWatcherAsked;
            view.LocateAsked        += view_LocateAsked;
            view.SelectAsked        += View_Clicked;
            view.HideAsked          += View_HideAsked;
            view.DeleteAsked        += View_DeleteAsked;

            // If we are still aligned with the first image, we keep updating the first visible,
            // otherwise we keep things as is.
            bool alignedToFirst = capturedFileViews.Count == 0 || first == capturedFileViews.Count - 1;

            capturedFileViews.Add(capturedFile.Time, view);
            this.Controls.Add(view);

            if (alignedToFirst)
            {
                first++;
                spotWidth = view.Width + margin;
            }

            RecomputeSpots();
            LayoutThumbnails();
            Invalidate();
        }