本文整理汇总了C#中BrightIdeasSoftware.ModelDropEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ModelDropEventArgs类的具体用法?C# ModelDropEventArgs怎么用?C# ModelDropEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelDropEventArgs类属于BrightIdeasSoftware命名空间,在下文中一共展示了ModelDropEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: objectListView_ModelDropped
private void objectListView_ModelDropped(object sender, ModelDropEventArgs e)
{
var copy = new List<Combatant>(e.SourceModels.OfType<Combatant>());
if (copy.Count == 0) {
return;
}
this.dirty = true;
this.Text = String.Concat("* ", this.Text);
//var handles = this.encounter.Handles;
//var combatants = this.encounter.Combatants;
//foreach (var combatant in copy) {
// int count;
// if (!handles.TryGetValue(combatant.Handle, out count)) {
// combatants.Add(combatant.Handle, combatant);
// }
// else if (combatant is Character) {
// continue; // only one copy of a character allowed
// }
// else {
// this.encounter.IncrementCombatant(combatant.Handle);
// }
//}
}
示例2: objectListView_ModelCanDrop
private void objectListView_ModelCanDrop(object sender, ModelDropEventArgs e)
{
if (!e.SourceModels.OfType<Combatant>().Any()) {
e.Effect = DragDropEffects.None;
return;
}
e.Effect = DragDropEffects.Copy;
}
示例3: HandleEvent_ModelDropped
public void HandleEvent_ModelDropped(object sender, ModelDropEventArgs e)
{
var dropTarget = e.TargetModel as ConnectionInfo;
if (dropTarget == null) return;
var dropSource = (ConnectionInfo)e.SourceModels[0];
DropModel(dropSource, dropTarget, e.DropTargetLocation);
e.Handled = true;
Runtime.SaveConnectionsAsync();
}
示例4: GetDragTargetKlasse
public static Klasse GetDragTargetKlasse(ModelDropEventArgs e)
{
Klasse targetKlasse = e.TargetModel as Klasse;
if (targetKlasse == null)
{
Schueler targetSchueler = e.TargetModel as Schueler;
if (targetSchueler != null)
{
targetKlasse = targetSchueler.getKlasse;
}
}
return targetKlasse;
}
示例5: HandleEvent_ModelCanDrop
public void HandleEvent_ModelCanDrop(object sender, ModelDropEventArgs e)
{
_enableFeedback = true;
_currentFeedbackColor = DropDeniedFeedbackColor;
_infoMessage = null;
var dropSource = e.SourceModels.Cast<ConnectionInfo>().First();
var dropTarget = e.TargetModel as ConnectionInfo;
e.Effect = CanModelDrop(dropSource, dropTarget, e.DropTargetLocation);
e.InfoMessage = _infoMessage;
e.DropSink.EnableFeedback = _enableFeedback;
e.DropSink.FeedbackColor = _currentFeedbackColor;
e.Handled = true;
}
示例6: treeListView1_ModelCanDrop
public void treeListView1_ModelCanDrop(object sender, ModelDropEventArgs e)
{
e.Handled = true;
e.Effect = DragDropEffects.None;
Klasse targetKlasse = GetDragTargetKlasse(e);
if (targetKlasse == null)
{
e.InfoMessage = "Ziel konnte nicht erkannt werden.";
return;
}
Schueler derSchueler = GetDraggedSchueler(e.SourceModels);
if (derSchueler == null)
{
e.InfoMessage = "Nur Schülerzeilen können in eine andere Klasse verschoben werden.";
return;
}
else
{
e.Effect = DragDropEffects.Move;
}
}
示例7: dropSink_ModelDropped
private void dropSink_ModelDropped(object sender, ModelDropEventArgs e)
{
OnModelDropped(e);
}
示例8: 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);
}
}
示例9: PluginTree_ModelCanDrop
private void PluginTree_ModelCanDrop(object sender, ModelDropEventArgs e)
{
e.Effect = DragDropEffects.None;
if (e.DropTargetLocation == DropTargetLocation.Background)
{
return;
}
if (e.SourceModels.OfType<Plugin>().Any())
{
e.InfoMessage = "Cannot drag plugins";
return;
}
if (e.TargetModel != null)
{
var rec = e.TargetModel as BaseRecord;
var targetPlugin = this.GetPluginFromNode(rec);
var targetParent = rec.Parent;
if (e.SourceModels.Contains(e.TargetModel))
{
// e.InfoMessage = "Cannot drop on self";
}
else
{
var parents = e.SourceModels.OfType<BaseRecord>().Select(x => x.Parent).Distinct();
if (parents.Count() != 1)
{
e.InfoMessage = Resources.CannotDragNodesWithDifferentParents;
return;
}
var srcParent = parents.FirstOrDefault();
if (e.DropTargetLocation == DropTargetLocation.Item && srcParent.Equals(targetParent))
{
return;
}
Plugin srcPlugin = this.GetPluginFromNode(srcParent);
foreach (BaseRecord r in e.SourceModels)
{
foreach (var r2 in r.Enumerate(x => x is IGroupRecord || x.Equals(rec)))
{
if (r2.Equals(rec))
{
e.InfoMessage = Resources.CannotDropOnDescendent;
return;
}
}
}
if (e.DropTargetLocation == DropTargetLocation.Item && !(e.TargetModel is IGroupRecord))
{
// e.InfoMessage = "Can only drop on groups or plugins";
}
else
{
if (srcPlugin.Equals(targetPlugin))
{
// same plugin defaults to move unless ctrl down
e.Effect = e.DropSink.IsControlDown ? DragDropEffects.Copy : DragDropEffects.Move;
}
else
{
// same plugin defaults to copy unless shift down
e.Effect = (!e.DropSink.IsControlDown && e.DropSink.IsShiftDown) ? DragDropEffects.Move : DragDropEffects.Copy;
}
}
}
}
}
示例10: OnModelDropped
protected override void OnModelDropped(ModelDropEventArgs args)
{
base.OnModelDropped(args);
}
示例11: OnModelDropped
/// <summary>
///
/// </summary>
/// <param name="args"></param>
protected virtual void OnModelDropped(ModelDropEventArgs args) {
if (this.ModelDropped != null)
this.ModelDropped(this, args);
}
示例12: dataListViewScenes_ModelDropped_1
private void dataListViewScenes_ModelDropped_1(object sender, ModelDropEventArgs e)
{
int TargetIndex = 0;
//Handle if dropped into empty Action box
if (e.TargetModel == null)
TargetIndex = 0;
else
TargetIndex = e.DropTargetIndex;
if (e.SourceModels[0].GetType().Equals(typeof(scene)))
{
switch (e.DropTargetLocation)
{
case DropTargetLocation.AboveItem:
//offset = 0
dataListViewScenes.MoveObjects(TargetIndex, e.SourceModels);
dataListViewScenes.SelectedObjects = e.SourceModels;
break;
case DropTargetLocation.BelowItem:
//offset = 1
dataListViewScenes.MoveObjects(TargetIndex +1, e.SourceModels);
dataListViewScenes.SelectedObjects = e.SourceModels;
break;
}
}
//SAve the sort order to the DB
foreach (scene scene_in_list in dataListViewScenes.Objects)
{
using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
{
scene scene = db.scenes.FirstOrDefault(s => s.id == scene_in_list.id);
if (scene != null)
{
scene.sort_order = dataListViewScenes.IndexOf(scene_in_list);
}
db.SaveChanges();
}
}
}
示例13: OnModelDropped
protected override void OnModelDropped(ModelDropEventArgs args)
{
base.OnModelDropped(args);
if (!args.Handled)
this.RearrangeModels(args);
}
示例14: RearrangeModels
/// <summary>
/// Do the work of processing the dropped items
/// </summary>
/// <param name="args"></param>
public virtual void RearrangeModels(ModelDropEventArgs args)
{
switch (args.DropTargetLocation) {
case DropTargetLocation.AboveItem:
this.ListView.MoveObjects(args.DropTargetIndex, args.SourceModels);
break;
case DropTargetLocation.BelowItem:
this.ListView.MoveObjects(args.DropTargetIndex + 1, args.SourceModels);
break;
case DropTargetLocation.Background:
this.ListView.AddObjects(args.SourceModels);
break;
default:
return;
}
if (args.SourceListView != this.ListView) {
args.SourceListView.RemoveObjects(args.SourceModels);
}
}
示例15: dataListViewSceneCMDs_ModelCanDrop
private void dataListViewSceneCMDs_ModelCanDrop(object sender, ModelDropEventArgs e)
{
if (e.SourceModels[0].GetType().Equals(typeof(device)))
{
e.Effect = DragDropEffects.Copy;
e.InfoMessage = "Create new action for this device";
}
else if (e.SourceModels[0].GetType().Equals(typeof(scene_commands)))
{
e.Effect = DragDropEffects.Move;
e.InfoMessage = "Rearrage Order";
}
else
{
e.Effect = DragDropEffects.None;
e.InfoMessage = "Can not drop this here.";
}
}