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); } }
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); } }
public ClipboardResult(IClipboardEntry clipboardEntry) : base(clipboardEntry.Title) { _clipboardEntry = clipboardEntry; Subtitle = $"Copied {MakeReadableTimestamp()}"; }
public ClipboardResult(IClipboardEntry clipboardEntry) : base(clipboardEntry.Title, "Select to paste") { _clipboardEntry = clipboardEntry; }
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; } }