コード例 #1
0
        public void AddFile(string filename, RecentFileType type)
        {
            // check not in list already - if so remove and add to end
            int  idx    = 0;
            bool remove = false;

            foreach (RecentFile file in files)
            {
                if (file.Filename.CompareTo(filename) == 0)
                {
                    remove = true;
                    break;
                }
                idx++;
            }
            if (remove)
            {
                files.RemoveAt(idx);
            }

            RecentFile _file = new RecentFile();

            _file.Filename = filename;
            _file.Type     = type;

            files.Add(_file);
        }
コード例 #2
0
        public FileRecentItem(string FileName, RecentFileType FileType, bool IsSaving = false)
        {
            this.FileName = FileName;
            this.FileType = FileType;
            this.IsSaving = IsSaving;

            Display = Path.GetFileName(FileName);

            ClickCommand = new DelegateCommand(() => ServiceProvider.LaunchFile(new ProcessStartInfo(FileName)));

            RemoveCommand = new DelegateCommand(() => RemoveRequested?.Invoke());

            var icons         = ServiceProvider.Get <IIconSet>();
            var loc           = ServiceProvider.Get <LanguageManager>();
            var windowService = ServiceProvider.Get <IMainWindow>();

            Icon      = GetIcon(FileType, icons);
            IconColor = GetColor(FileType);

            var list = new List <RecentAction>
            {
                new RecentAction(loc.CopyPath, icons.Clipboard, () => this.FileName.WriteToClipboard())
            };

            void AddTrimMedia()
            {
                list.Add(new RecentAction(loc.Trim, icons.Trim, () => windowService.TrimMedia(FileName)));
            }

            switch (FileType)
            {
            case RecentFileType.Image:
                list.Add(new RecentAction(loc.CopyToClipboard, icons.Clipboard, OnCopyToClipboardExecute));
                list.Add(new RecentAction(loc.UploadToImgur, icons.Upload, OnUploadToImgurExecute));
                list.Add(new RecentAction(loc.Edit, icons.Pencil, () => windowService.EditImage(FileName)));
                list.Add(new RecentAction(loc.Crop, icons.Crop, () => windowService.CropImage(FileName)));
                break;

            case RecentFileType.Audio:
                AddTrimMedia();
                break;

            case RecentFileType.Video:
                AddTrimMedia();
                list.Add(new RecentAction("Upload to YouTube", icons.YouTube, () => windowService.UploadToYouTube(FileName)));
                break;
            }

            list.Add(new RecentAction(loc.Delete, icons.Delete, OnDelete));

            Actions = list;
        }
コード例 #3
0
        static string GetColor(RecentFileType ItemType)
        {
            switch (ItemType)
            {
            case RecentFileType.Audio:
                return("DodgerBlue");

            case RecentFileType.Image:
                return("YellowGreen");

            case RecentFileType.Video:
                return("OrangeRed");
            }

            return(null);
        }
コード例 #4
0
        static string GetIcon(RecentFileType ItemType, IIconSet Icons)
        {
            switch (ItemType)
            {
            case RecentFileType.Audio:
                return(Icons.Music);

            case RecentFileType.Image:
                return(Icons.Image);

            case RecentFileType.Video:
                return(Icons.Video);
            }

            return(null);
        }
コード例 #5
0
        public void AddFile(string filename, RecentFileType type)
        {
            // check not in list already - if so remove and add to end
            int idx = 0;
            bool remove = false;
            foreach (RecentFile file in files)
            {
                if (file.Filename.CompareTo(filename) == 0)
                {
                    remove = true;
                    break;
                }
                idx++;
            }
            if (remove)
                files.RemoveAt(idx);

            RecentFile _file = new RecentFile();
            _file.Filename = filename;
            _file.Type = type;

            files.Add(_file);
        }
コード例 #6
0
 public void RegisterRecentFile(RecentFileType recentFileType, string fileName)
 {
     m_VideoController.RegisterRecentFile(RecentFileType.LightCurve, fileName);
 }
コード例 #7
0
 public void RegisterRecentFile(RecentFileType recentFileType, string fileName)
 {
     m_VideoController.RegisterRecentFile(RecentFileType.LightCurve, fileName);
 }