本文整理汇总了C#中Bookmark类的典型用法代码示例。如果您正苦于以下问题:C# Bookmark类的具体用法?C# Bookmark怎么用?C# Bookmark使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bookmark类属于命名空间,在下文中一共展示了Bookmark类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
// ExStart:AddChildBookmark
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Bookmarks();
// Create bookmarks
Aspose.Pdf.Facades.Bookmarks bookmarks = new Aspose.Pdf.Facades.Bookmarks();
Bookmark childBookmark1 = new Bookmark();
childBookmark1.PageNumber = 1;
childBookmark1.Title = "First Child";
Bookmark childBookmark2 = new Bookmark();
childBookmark2.PageNumber = 2;
childBookmark2.Title = "Second Child";
bookmarks.Add(childBookmark1);
bookmarks.Add(childBookmark2);
Bookmark bookmark = new Bookmark();
bookmark.Action = "GoTo";
bookmark.PageNumber = 1;
bookmark.Title = "Parent";
bookmark.ChildItems = bookmarks;
// Create PdfBookmarkEditor class
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
// Bind PDF document
bookmarkEditor.BindPdf(dataDir+ "AddChildBookmark.pdf");
// Create bookmarks
bookmarkEditor.CreateBookmarks(bookmark);
// Save updated document
bookmarkEditor.Save(dataDir+ "AddChildBookmark_out.pdf");
// ExEnd:AddChildBookmark
}
示例2: Add
public void Add(string title, string url, string description, string snapshotBase64String, IEnumerable<Tag> tags, Website website, string userId)
{
var bookmark = new Bookmark
{
Description = description,
UserId = userId,
Title = title,
Url = url,
SnapshotBase64String = snapshotBase64String
};
//check for existing website
var existingWebsite = websiteService.GetWebsiteByName(website.Name, userId).FirstOrDefault();
if (existingWebsite != null)
{
bookmark.WebSite = existingWebsite;
}
else
{
var websiteToAdd = new Website
{
Name = website.Name,
FaviconBase64String = website.FaviconBase64String
};
bookmark.WebSite = website;
}
AddTags(bookmark, tags, userId);
this.bookmarks.Add(bookmark);
this.bookmarks.SaveChanges();
}
示例3: Continue
private void Continue(NativeActivityContext context, Bookmark bookmark, object obj)
{
var args = (object[])obj;
var userID = (int)args[0];
UserID.Set(context, userID);
var result = 0;
var id = ID.Get(context);
var item = ProjectProcessService.GetById(id);
ProjectProcessService.LoadReference(item, i => i.Owner);
var appraisalResult = ProjectProcessService.GetAppraisalResult(item);
var userCount = UserService.Count();
if (appraisalResult.Item1 + appraisalResult.Item2 < userCount * 0.8)//投票人数未达到所有人的 80%
{
result = 0;
}
else
{
if (appraisalResult.Item1 > appraisalResult.Item2 * 2)//同意的人数大于不同意人数的两倍
{
result = 1;
InboxService.Create(UserRoleEnum.全员, item.ID, RedirectType.项目流程查看, InboxService.APPRAISAL_FINISH_PROCESS_PROJECT, item.ID.ToString(), appraisalResult.Item1.ToString(), appraisalResult.Item2.ToString(), "通过", item.Owner.NickName);
InboxService.Create(UserRoleEnum.运营组成员, item.ID, RedirectType.项目流程处理, InboxService.DESIGN_PROCESS_PROJECT, item.ID.ToString(), item.Owner.NickName);
}
else
{
result = -1;
InboxService.Create(UserRoleEnum.全员, item.ID, RedirectType.项目流程查看, InboxService.APPRAISAL_FINISH_PROCESS_PROJECT, item.ID.ToString(), appraisalResult.Item1.ToString(), appraisalResult.Item2.ToString(), "不通过", item.Owner.NickName);
}
}
Rusult.Set(context, result);
}
示例4: OnCancelTimer
protected override void OnCancelTimer(Bookmark bookmark)
{
lock (this.ThisLock)
{
this.RegisteredTimers.RemoveTimer(bookmark);
}
}
示例5: ExprNodeAssignment
// Constructor
public ExprNodeAssignment(Bookmark bookmark, ExprNode lhs, ExprNode rhs, Token op)
: base(bookmark)
{
Lhs = lhs;
Rhs = rhs;
Op = op;
}
示例6: AddBookmark
public static void AddBookmark(string username, string title, string url, string[] tags, string notes)
{
//Console.WriteLine("{0} {1} {2} {3} {4}", username, title, url, string.Join(", ", tags), notes);
BookmarksEntities context = new BookmarksEntities();
Bookmark newBookmark = new Bookmark();
newBookmark.User = CreateOrLoadUser(context, username);
newBookmark.Title = title;
newBookmark.URL = url;
newBookmark.Notes = notes;
foreach (var tagName in tags)
{
Tag tag = CreateOrLoadTag(context, tagName);
newBookmark.Tags.Add(tag);
}
//dopulnitelnite tagotve------------------------
//string[] titleTags = Regex.Split(title, @"\W+");
string[] titleTags = Regex.Split(title, @"[,'!\. ;?-]+");
foreach (var titleTagName in titleTags)
{
Tag titleTag = CreateOrLoadTag(context, titleTagName);
newBookmark.Tags.Add(titleTag);
}
//dopulnitelnite tagotve-----------------------
context.Bookmarks.Add(newBookmark);
context.SaveChanges();
}
示例7: BookmarkWorkItem
// This ctor is only used by subclasses which make their own determination about no persist or not
protected BookmarkWorkItem(BookmarkCallbackWrapper callbackWrapper, Bookmark bookmark, object value)
: base(callbackWrapper.ActivityInstance)
{
this.callbackWrapper = callbackWrapper;
this.bookmark = bookmark;
this.state = value;
}
示例8: Main
public static void Main()
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
//create bookmarks
Bookmarks bookmarks = new Bookmarks();
Bookmark childBookmark1 = new Bookmark();
childBookmark1.PageNumber = 1;
childBookmark1.Title = "First Child";
Bookmark childBookmark2 = new Bookmark();
childBookmark2.PageNumber = 2;
childBookmark2.Title = "Second Child";
bookmarks.Add(childBookmark1);
bookmarks.Add(childBookmark2);
Bookmark bookmark = new Bookmark();
bookmark.Action = "GoTo";
bookmark.PageNumber = 1;
bookmark.Title = "Parent";
bookmark.ChildItems = bookmarks;
//create PdfBookmarkEditor class
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
//bind PDF document
bookmarkEditor.BindPdf(dataDir+ "input.pdf");
//create bookmarks
bookmarkEditor.CreateBookmarks(bookmark);
//save updated document
bookmarkEditor.Save(dataDir+ "output.pdf");
}
示例9: OnBookmarkCallback
private void OnBookmarkCallback(NativeActivityContext context, Bookmark bookmark)
{
var log = context.Resolve<ILoggerFactory>() != null
? context.Resolve<ILoggerFactory>().Create(typeof(SubProcess))
: null;
var parser = context.Resolve<IScriptParser>();
var extension = context.GetExtension<DataFieldExtension>();
//完成规则解析
if (this.Result != null
&& parser != null
&& this.FinishRule != null
&& this.FinishRule.Count > 0)
{
foreach (var i in this.FinishRule)
if (parser.EvaluateRule(i.Value, extension))
{
this.Result.Set(context, i.Key);
if (log != null)
log.InfoFormat("SubProcess节点完成规则“{0}”测试通过,将进入节点“{1}”", i.Value, i.Key);
break;
}
}
//所有逻辑完成才可删除,若上述逻辑失败则将此书签用于错误恢复
context.RemoveBookmark(bookmark);
}
示例10: AppendBookmarkedText
/// <summary>
/// Copies content of the bookmark and adds it to the end of the specified node.
/// The destination node can be in a different document.
/// </summary>
/// <param name="importer">Maintains the import context </param>
/// <param name="srcBookmark">The input bookmark</param>
/// <param name="dstNode">Must be a node that can contain paragraphs (such as a Story).</param>
private static void AppendBookmarkedText(NodeImporter importer, Bookmark srcBookmark, CompositeNode dstNode)
{
// This is the paragraph that contains the beginning of the bookmark.
Paragraph startPara = (Paragraph)srcBookmark.BookmarkStart.ParentNode;
// This is the paragraph that contains the end of the bookmark.
Paragraph endPara = (Paragraph)srcBookmark.BookmarkEnd.ParentNode;
if ((startPara == null) || (endPara == null))
throw new InvalidOperationException("Parent of the bookmark start or end is not a paragraph, cannot handle this scenario yet.");
// Limit ourselves to a reasonably simple scenario.
if (startPara.ParentNode != endPara.ParentNode)
throw new InvalidOperationException("Start and end paragraphs have different parents, cannot handle this scenario yet.");
// We want to copy all paragraphs from the start paragraph up to (and including) the end paragraph,
// therefore the node at which we stop is one after the end paragraph.
Node endNode = endPara.NextSibling;
// This is the loop to go through all paragraph-level nodes in the bookmark.
for (Node curNode = startPara; curNode != endNode; curNode = curNode.NextSibling)
{
// This creates a copy of the current node and imports it (makes it valid) in the context
// of the destination document. Importing means adjusting styles and list identifiers correctly.
Node newNode = importer.ImportNode(curNode, true);
// Now we simply append the new node to the destination.
dstNode.AppendChild(newNode);
}
}
示例11: AddBookmarks
public static void AddBookmarks(string username, string title, string url, string[] tags, string notes)
{
var dbCon = new BookmarksEntities();
using (dbCon)
{
var bookmark = new Bookmark();
bookmark.Notes = notes;
bookmark.URL = url;
bookmark.Title = title;
bookmark.User = CreateOrLoadUser(dbCon, username);
foreach (var tagName in tags)
{
var tag = CreateOrLoadTag(dbCon, tagName);
bookmark.Tags.Add(tag);
}
var titleTags = Regex.Split(title, @"[ ,-\.;!?]+");
foreach (var titleTag in titleTags)
{
var tag = CreateOrLoadTag(dbCon, titleTag);
bookmark.Tags.Add(tag);
}
dbCon.Bookmarks.Add(bookmark);
dbCon.SaveChanges();
}
}
示例12: MatchProgram
private bool MatchProgram(Bookmark bookmark, FuzzyMatcher matcher)
{
if ((bookmark.Score = matcher.Evaluate(bookmark.Name).Score) > 0) return true;
if ((bookmark.Score = matcher.Evaluate(bookmark.PinyinName).Score) > 0) return true;
if ((bookmark.Score = matcher.Evaluate(bookmark.Url).Score / 10) > 0) return true;
return false;
}
示例13: Continue
void Continue(NativeActivityContext context, Bookmark bookmark, object obj)
{
var eventArgs = obj as WorkflowNotificationEventArgs;
if (eventArgs.NotificationType != WorkflowNotificationObserver.CONTENTCHANGEDNOTIFICATIONTYPE)
return;
InstanceManager.ReleaseWait(notificationId.Get(context));
}
示例14: CreateBookmark
public static Bookmark CreateBookmark(int bookmarkId, int userId, int ordinal)
{
Bookmark bookmark = new Bookmark();
bookmark.BookmarkId = bookmarkId;
bookmark.UserId = userId;
bookmark.Ordinal = ordinal;
return bookmark;
}
示例15: AddDeclaration
// Add another variable declaration
public void AddDeclaration(Bookmark bookmark, string Name, ast.Expression InitialValue)
{
var v = new Variable();
v.Bookmark = bookmark;
v.Name = Name;
v.InitialValue = InitialValue;
Variables.Add(v);
}