コード例 #1
0
ファイル: BookmarkLister.cs プロジェクト: pbiswal/LevelEditor
        private void AddBookmark()
        {
            IList <Bookmark> bookmarkList   = null;
            Bookmark         parentBookmark = LastHit.As <Bookmark>();

            if (parentBookmark != null)
            {
                bookmarkList = parentBookmark.Bookmarks;
            }
            else
            {
                var bookmarkContext = TreeView.As <BookmarkingContext>();
                if (bookmarkContext != null)
                {
                    bookmarkList = bookmarkContext.Bookmarks;
                }
            }

            if (bookmarkList != null)
            {
                Bookmark newBookmark = new DomNode(Schema.bookmarkType.Type).As <Bookmark>();
                newBookmark.Name   = "New bookmark".Localize();
                newBookmark.Camera = m_designView.ActiveView.Camera;

                ITransactionContext transactionContext = TreeView.As <ITransactionContext>();
                TransactionContexts.DoTransaction(
                    transactionContext,
                    delegate
                {
                    bookmarkList.Add(newBookmark);
                },
                    "Add bookmark".Localize());
            }
        }
コード例 #2
0
ファイル: BookmarkLister.cs プロジェクト: pbiswal/LevelEditor
        private void TreeControl_MouseDown(object sender, MouseEventArgs e)
        {
            Bookmark bkm = LastHit.As <Bookmark>();

            if (e.Button == MouseButtons.Left && bkm != null)
            {
                m_designView.ActiveView.Camera.Init(bkm.Camera);
            }
        }