当前位置: 首页>>代码示例>>C#>>正文


C# ModelDropEventArgs.RefreshObjects方法代码示例

本文整理汇总了C#中BrightIdeasSoftware.ModelDropEventArgs.RefreshObjects方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDropEventArgs.RefreshObjects方法的具体用法?C# ModelDropEventArgs.RefreshObjects怎么用?C# ModelDropEventArgs.RefreshObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BrightIdeasSoftware.ModelDropEventArgs的用法示例。


在下文中一共展示了ModelDropEventArgs.RefreshObjects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PluginTree_ModelDropped

        private void PluginTree_ModelDropped(object sender, ModelDropEventArgs e)
        {
            if (e.DropTargetLocation == DropTargetLocation.Item)
            {
                var group = e.TargetModel as IGroupRecord;
                if (group == null)
                {
                    return;
                }

                var objects = new List<BaseRecord>();
                foreach (IRecord record in e.SourceModels)
                {
                    if (e.Effect == DragDropEffects.Copy)
                    {
                        var r = record.Clone() as BaseRecord;
                        group.AddRecord(r);
                        objects.Add(r);
                    }
                    else if (e.Effect == DragDropEffects.Move)
                    {
                        var r = record as BaseRecord;
                        if (r != null && r.Parent.DeleteRecord(r))
                        {
                            group.AddRecord(r);
                            objects.Add(r);
                        }
                    }
                }

                e.RefreshObjects();
                this.PluginTree.SelectObject(objects);
                this.PluginTree.RefreshObject(group);
                this.PluginTree.RefreshObjects(objects);
            }
            else if (e.DropTargetLocation == DropTargetLocation.AboveItem || e.DropTargetLocation == DropTargetLocation.BelowItem)
            {
                int offset = e.DropTargetLocation == DropTargetLocation.BelowItem ? +1 : 0;
                var rec = e.TargetModel as IRecord;
                if (rec == null)
                {
                    return;
                }

                var group = rec.Parent as IGroupRecord;
                if (group == null)
                {
                    return;
                }

                int idx = group.IndexOf(rec as BaseRecord) + offset;
                var refreshObjects = new List<BaseRecord>();
                var selObjects = new List<BaseRecord>();
                IEnumerable<IRecord> itr = e.SourceModels.OfType<IRecord>();
                if (e.DropTargetLocation == DropTargetLocation.BelowItem)
                {
                    itr = itr.Reverse();
                }

                foreach (IRecord record in itr)
                {
                    if (e.Effect == DragDropEffects.Copy)
                    {
                        var r = record.Clone() as BaseRecord;
                        group.InsertRecord(idx, r);
                        selObjects.Add(r);
                    }
                    else if (e.Effect == DragDropEffects.Move)
                    {
                        var r = record as BaseRecord;
                        var p = r.Parent;
                        if (r.Parent.DeleteRecord(r))
                        {
                            idx = group.IndexOf(rec as BaseRecord) + offset;
                            group.InsertRecord(idx, r);
                            selObjects.Add(r);
                        }
                    }
                }

                e.RefreshObjects();
                this.PluginTree.SelectObject(selObjects);
                this.PluginTree.RefreshObject(group);
                this.PluginTree.RefreshObjects(selObjects);
            }
        }
开发者ID:rxantos,项目名称:tesv-snip,代码行数:86,代码来源:PluginTreeView.cs

示例2: tree_ModelDropped

 //process the dropped
 private void tree_ModelDropped(object sender, ModelDropEventArgs e)
 {
     switch (e.DropTargetLocation) {
     case DropTargetLocation.AboveItem:
       moveTag(e.SourceModels, (TagItem)e.TargetModel);
       break;
     case DropTargetLocation.BelowItem:
       moveTag(e.SourceModels, (TagItem)e.TargetModel, 1);
       break;
     case DropTargetLocation.Item:
       moveNote(e.SourceModels, (TagItem)e.TargetModel, e.StandardDropActionFromKeys);
       e.RefreshObjects();
       break;
       }
       //OLV drops renderer/sort when Roots assigned
       cName.Renderer = fancyRenderer;
       tree.Sort(cSort, SortOrder.Ascending);
 }
开发者ID:yinluobing,项目名称:SynNotes,代码行数:19,代码来源:Form.cs


注:本文中的BrightIdeasSoftware.ModelDropEventArgs.RefreshObjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。