Esempio n. 1
0
        protected void CopyItem(object sender, EventArgs e)
        {
            int  itemid = Convert.ToInt32(Request.QueryString["ItemId"]);
            Guid listid = new Guid(Request.QueryString["ListId"]);

            SPWeb      sourceweb  = SPControl.GetContextWeb(HttpContext.Current);
            SPList     sourcelist = sourceweb.Lists[listid];
            SPListItem sourceitem = sourcelist.GetItemById(itemid);

            lblListItem.Text = sourceitem.Name;

            TreeNodeContext ctx = new TreeNodeContext(tvSite.SelectedValue);

            SPSite destcol = new SPSite(ctx.SiteCollection);
            SPWeb  destweb = destcol.AllWebs[ctx.WebID];

            if (ctx.IsList)
            {
                SPList     destlist = destweb.Lists[ctx.ListID];
                SPListItem destitem = destlist.Items.Add();

                SPFolder folder = destlist.RootFolder;

                try
                {
                    folder.Files.Add(sourceitem.Name, sourceitem.File.OpenBinary());
                }
                catch (Exception ex)
                {
                    lblStatus.Text = string.Format("Error uploading File {0}", sourceitem.Name);
                }

                lblStatus.Text = string.Format("{0} copied successfully to {1}", sourceitem.Name, destlist.Title);
            }
        }
Esempio n. 2
0
        public async Task AfterVisitNode(TreeNodeContext treeNodeContext)
        {
            string serializeProperties = JsonConvert.SerializeObject(treeNodeContext.Properties);

            await Task.Run(() => Console.WriteLine(string.Format(
                                                       "AfterVisitNode: SessionId: {0}, TreeNodeKey: {1}, Properties: {2}.",
                                                       treeNodeContext.SessionId,
                                                       treeNodeContext.TreeNodeKey,
                                                       serializeProperties)));

            treeNodeContext.CurrentNodeSkipActionContext = this.CurrentNodeSkipActionContext;
        }
Esempio n. 3
0
        /// <summary>
        /// ルート用コンストラクタ。
        /// </summary>
        protected UIElement(ICanvasContext canvasContext, string settingsJson)
        {
            var options = new JsonSerializerOptions();

            options.AllowTrailingCommas = true;
            options.Converters.Add(new JsonStringEnumConverter(null, false));
            options.Converters.Add(new JsonColorConverter());
            var settings = JsonSerializer.Deserialize <Settings>(settingsJson, options);

            Tnc = TreeNodeContext <UIElement> .CreateForRootNode(this, elem => elem.Tnc);

            _lazySharedInfo = new Lazy <InternalSharedInfo>(new InternalSharedInfo(canvasContext, this, settings));
            _canvasContext  = canvasContext;

#warning 後で見直し
            _lazySharedInfo.Value.CanvasContext.Created += RaiseCreated;
        }
Esempio n. 4
0
        protected void NodeSelected(object sender, EventArgs e)
        {
            TreeView        tv  = (TreeView)sender;
            TreeNodeContext ctx = new TreeNodeContext(tv.SelectedValue);

            SPSite col = new SPSite(ctx.SiteCollection);
            SPWeb  sw  = col.AllWebs[ctx.WebID];

            if (ctx.IsList)
            {
                SPList sl = sw.Lists[ctx.ListID];
                lblList.Text = sl.Title;
            }
            else
            {
                lblList.Text = string.Empty;
            }
        }
Esempio n. 5
0
 public TreeNodeService(TreeNodeContext context)
 {
     _context = context;
 }
Esempio n. 6
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        protected UIElement()
        {
            Tnc = TreeNodeContext <UIElement> .CreateForNormalNode(this, elem => elem.Tnc);

            _lazySharedInfo = new Lazy <InternalSharedInfo>(() => Tnc.GetRoot()._lazySharedInfo.Value, false);
        }