Example #1
0
        private IProjectObject CreateContentEntry(IClipboardEntry clipboardEntry)
        {
            switch (clipboardEntry.Type)
            {
            case "page":
                return(new Page(Project, clipboardEntry.Guid, Project.LanguageVariants.Current));

            case "pageelement":
                return(PageElementFactory.Instance.CreateElement(Project, clipboardEntry.Guid, Project.LanguageVariants.Current));

            case "app.4015":
                return(new ContentClass(Project, clipboardEntry.Guid));

            case "project.6050":
                IFolder folder;
                return(Project.Folders.TryGetByGuid(clipboardEntry.Guid, out folder) ? folder : null);

            case "project.6055":
                IFolder subFolder;
                return(Project.Folders.AllIncludingSubFolders.TryGetByGuid(clipboardEntry.Guid, out subFolder) ? subFolder : null);

            default:
                return(null);
            }
        }
Example #2
0
        private void ClipboardOnClipboardChanged([CanBeNull] object sender, SharpClipboard.ClipboardChangedEventArgs e)
        {
            IClipboardEntry entry = e.ContentType switch
            {
                SharpClipboard.ContentTypes.Text => new TextClipboardEntry
                {
                    Title   = _clipboard.ClipboardText.Trim().Replace("\n", "").Replace("\r", ""),
                    Content = _clipboard.ClipboardText
                },
                SharpClipboard.ContentTypes.Image => new ImageClipboardEntry
                {
                    Title   = $"Image - Copied {DateTime.Now.ToShortDateString()}",
                    Content = _clipboard.ClipboardImage
                },
                _ => null
            };

            if (entry != null)
            {
                _pluginEngine.PluginByType <ClipboardManagerPlugin>().ClipboardHistory.AddFirst(entry);
            }
        }
Example #3
0
 public ClipboardResult(IClipboardEntry clipboardEntry) : base(clipboardEntry.Title)
 {
     _clipboardEntry = clipboardEntry;
     Subtitle        = $"Copied {MakeReadableTimestamp()}";
 }
Example #4
0
 public ClipboardResult(IClipboardEntry clipboardEntry) : base(clipboardEntry.Title, "Select to paste")
 {
     _clipboardEntry = clipboardEntry;
 }
Example #5
0
 private IProjectObject CreateContentEntry(IClipboardEntry clipboardEntry)
 {
     switch (clipboardEntry.Type)
     {
         case "page":
             return new Page(Project, clipboardEntry.Guid, Project.LanguageVariants.Current);
         case "pageelement":
             return PageElementFactory.Instance.CreateElement(Project, clipboardEntry.Guid, Project.LanguageVariants.Current);
         case "app.4015":
             return new ContentClass(Project, clipboardEntry.Guid);
         case "project.6050":
             IFolder folder;
             return Project.Folders.TryGetByGuid(clipboardEntry.Guid, out folder) ? folder : null;
         case "project.6055":
             IFolder subFolder;
             return Project.Folders.AllIncludingSubFolders.TryGetByGuid(clipboardEntry.Guid, out subFolder) ? subFolder : null;
         default:
             return null;
     }
 }