private void olvUserGroups_ModelDropped(object sender, ModelDropEventArgs e) { if (_currentUser != 0 && e.SourceModels.Count > 0) { addGroupToUser((SynapseProfile)e.SourceModels[0]); } }
private void olvGroupUsers_ModelDropped(object sender, ModelDropEventArgs e) { if (_currentGroup != 0 && e.SourceModels.Count > 0) { addUserToGroup((SynapseUser)e.SourceModels[0]); } }
private void treeListView_ModelCanDrop(object sender, ModelDropEventArgs e) { var targetNode = e.TargetModel as HierarchyNode; var sourceNode = e.SourceModels[0] as HierarchyNode; e.DropSink.CanDropBetween = true; if (targetNode == null || sourceNode == null || targetNode.Script == null && sourceNode.Command == null || targetNode.Script != null && sourceNode.Script != null && e.DropTargetLocation == DropTargetLocation.Item) { e.Effect = DragDropEffects.None; return; } e.DropSink.CanDropOnItem = targetNode.Script != null || targetNode.Command.CanBeNested; if (targetNode.Script != null && sourceNode.Command != null) { e.DropSink.CanDropBetween = false; } if (sourceNode.GetAllNodes().Contains(targetNode)) { e.Effect = DragDropEffects.None; return; } e.Effect = DragDropEffects.Move; }
private void dColumnsListView_ModelCanDrop(object sender, ModelDropEventArgs e) { var targetTable = e.TargetModel as EDDTable; var targetColumn = e.TargetModel as EDDColumn; var dataItem = e.SourceModels.Cast <Object>().FirstOrDefault() as DataItem; if (dataItem != null) { if (targetTable != null) { e.Effect = DragDropEffects.Link; e.InfoMessage = "Create new column"; } else if (targetColumn != null) { e.Effect = DragDropEffects.Link; e.InfoMessage = "Link dataitem to column"; } else { e.Effect = DragDropEffects.None; } } else { e.Effect = DragDropEffects.None; e.InfoMessage = "You can only drop DataItems"; } }
private void HandleDropAdding(ModelDropEventArgs e) { if (e.SourceModels != null) { Include(e.SourceModels.OfType <IColumn>().ToArray()); } }
private void treeListView_ModelCanDrop(object sender, ModelDropEventArgs e) { var targetNode = e.TargetModel as HierarchyNode; var sourceNode = e.SourceModels[0] as HierarchyNode; e.DropSink.CanDropBetween = true; if (targetNode == null || sourceNode == null || sourceNode.Script == null && sourceNode.Command == null || // Source node is empty string value targetNode.Script == null && targetNode.Command == null || // Target node is empty string value targetNode.Script == null && sourceNode.Command == null || // Cannot drag scripts onto commands m_HooksNode.Children.Contains(sourceNode) || // Hooks scripts are special and should not be moved at all m_HooksNode.Children.Contains(targetNode) && sourceNode.Script != null || // Cannot drag any script onto or inbetween hooks scripts targetNode.Script != null && sourceNode.Script != null && e.DropTargetLocation == DropTargetLocation.Item) // Cannot drag scripts onto scripts { e.Effect = DragDropEffects.None; return; } e.DropSink.CanDropOnItem = sourceNode.Script == null && // We don't want scripts to be dropped on any item (targetNode.Script != null || targetNode.Command.CanBeNested); // Everything can be dropped on script and commands with nested tag can also be dropped onto if (targetNode.Script != null && sourceNode.Command != null) { e.DropSink.CanDropBetween = false; } if (sourceNode.GetAllNodes().Contains(targetNode)) { e.Effect = DragDropEffects.None; return; } e.Effect = DragDropEffects.Move; }
private void dColumnsListView_ModelDropped(object sender, ModelDropEventArgs e) { var targetTable = e.TargetModel as EDDTable; var targetColumn = e.TargetModel as EDDColumn; var dataItem = e.SourceModels.Cast <Object>().FirstOrDefault() as DataItem; if (dataItem != null) { if (targetTable != null) { //create new column targetColumn = targetTable.addNewColumn(dataItem.Label); targetColumn.dataItem = dataItem; } if (targetColumn != null) { //refresh dColumnsListView.RefreshObject(targetTable); //select the target column this.dColumnsListView.SelectedObject = targetColumn; //set the data field this.setLinkedDataItemData(targetColumn, dataItem); } } }
void treeListView_ModelDropped(object sender, ModelDropEventArgs e) { //String msg = String.Format("{2} items were dropped on '{1}' as a {0} operation.", // e.Effect, (string)e.TargetModel, e.SourceModels.Count); //MessageBox.Show(msg, "OLV Demo", MessageBoxButtons.OK, MessageBoxIcon.Information); string folderTo = (e.TargetModel is Strategy) ? ((Strategy)e.TargetModel).StoredInFolderRelName : (string)e.TargetModel; foreach (Strategy strategyDropped in e.SourceModels) { if (strategyDropped.StoredInFolderRelName == folderTo) { continue; // dont wake up the lion } try { this.strategyRepository.StrategyMoveToFolder(strategyDropped, folderTo); } catch (Exception ex) { string msg = "Looks like folderTo[" + folderTo + "] has a strategy with the same name[" + strategyDropped.Name + "]"; this.statusReporter.PopupException(new Exception(msg, ex)); continue; } } this.tree.SetObjects(strategyRepository.AllFoldersAvailable); }
private void EditableDataListView_ModelCanDrop(object sender, ModelDropEventArgs e) { e.Handled = true; e.Effect = DragDropEffects.None; if (_currentSource == null || e.SourceModels == null || e.SourceModels.Count != 1 || e.TargetModel == null || object.ReferenceEquals(e.SourceModels[0], e.TargetModel)) { return; } var indexToMove = _currentSource.IndexOf((ApplicationRoleSchema)e.TargetModel); if (e.DropTargetLocation == DropTargetLocation.BelowItem) { indexToMove += 1; } if (_currentSource.IndexOf((ApplicationRoleSchema)e.SourceModels[0]) == indexToMove) { return; } e.Effect = DragDropEffects.Move; }
private void ModelDropped(object sender, ModelDropEventArgs e) { var cmd = _commandFactory.Create(e); //no valid source command if (cmd == null) { return; } //otherwise get command compatible with the target var execution = _commandExecutionFactory.Create(cmd, e.TargetModel, GetDropLocation(e)); //it is a valid combination if (execution != null) { try { execution.Execute(); } catch (Exception exception) { ExceptionViewer.Show("ExecuteCommand " + execution.GetType().Name + " failed, See Exception for details", exception); } } }
// Can drop event. // Allows or prevents drop. private void CanDrop(Object sender, ModelDropEventArgs e) { // Guilty until proven innocent e.Effect = DragDropEffects.None; e.DropSink.FeedbackColor = Color.IndianRed; //Is mouse inside control if (ListView.Bounds.Contains(e.MouseLocation)) { // Get source and target tree nodes. IEnumerable <BaseTreeNode> sourceTreeNodes = e.SourceModels.Cast <BaseTreeNode>(); BaseTreeNode target = e.TargetModel as BaseTreeNode; // Handle drag drop when target is a valid treeNode if (target != null) { // Check to make sure drop target it not a child of drag nodes, and drop parent is not the same as drag parent. if (!sourceTreeNodes.Any(x => target.IsAncestor(x))) { // If layers or folders being dropped on layers, allow move. // The drop event handler will correctly handle shifting the target to the parent. if (sourceTreeNodes.All(x => x is LayerTreeNode) && target is LayerTreeNode || sourceTreeNodes.All(x => x is FolderTreeNode) && target is LayerTreeNode) { e.DropSink.FeedbackColor = ListView.HighlightBackgroundColor; e.Effect = DragDropEffects.Move; } // If all drag nodes are folders or layers, allow move. if (sourceTreeNodes.All(x => x is LayerTreeNode) && target is FolderTreeNode || sourceTreeNodes.All(x => x is FolderTreeNode) && target is FolderTreeNode) { e.DropSink.FeedbackColor = ListView.HighlightBackgroundColor; e.Effect = DragDropEffects.Move; } // If all drag nodes are iNodes and target is a layer, allow move. if (sourceTreeNodes.All(x => x is ObjectTreeNode) && target is LayerTreeNode) { e.DropSink.FeedbackColor = ListView.HighlightBackgroundColor; e.Effect = DragDropEffects.Move; } // If all drag nodes are iNodes and target is an iNode, allow move. if (sourceTreeNodes.All(x => x is ObjectTreeNode) && target is ObjectTreeNode) { e.DropSink.FeedbackColor = ListView.HighlightBackgroundColor; e.Effect = DragDropEffects.Move; } } } // Handle drag drop when target is null by moving drag nodes to root. else { // If all drag nodes are folders or layers, allow move. if (sourceTreeNodes.All(x => x is LayerTreeNode) || sourceTreeNodes.All(x => x is FolderTreeNode)) { e.DropSink.FeedbackColor = ListView.HighlightBackgroundColor; e.Effect = DragDropEffects.Move; } } } }
private void objectListViewLayers_ModelDropped(object sender, ModelDropEventArgs e) { if (e.SourceListView == objectListViewLayers) { var targetLayer = (LayerListDto)e.TargetModel; var sourceLayer = (LayerListDto)e.SourceModels[0]; _engine.MoveLayer(sourceLayer.Key, targetLayer.Key); } }
private void objectListView_ModelCanDrop(object sender, ModelDropEventArgs e) { if ((this.Encounter == null) || !e.SourceModels.OfType <Combatant>().Any()) { e.Effect = DragDropEffects.None; return; } e.Effect = DragDropEffects.Copy; }
private void mappingControl_CreateNewMapping(object sender, ModelDropEventArgs e) { var targetNode = e.TargetModel as MappingNode; var sourceNode = e.SourceModels.Cast <Object>().FirstOrDefault() as MappingNode; if (targetNode != null && sourceNode != null) { sourceNode.mapTo(targetNode); } }
void treeListView_ModelCanDrop(object sender, ModelDropEventArgs e) { //e.Effect = DragDropEffects.None; //if (e.TargetModel == null) return; //if (e.TargetModel is Strategy) { // e.InfoMessage = "Can only drop on directories"; //} else { e.Effect = e.StandardDropActionFromKeys; //} }
/// <summary> /// Handles dropping items from the list view on other items in the list view /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void olvCraftList_ModelDropped(object sender, ModelDropEventArgs e) { if (e.TargetModel == null) { return; } _craftFileHandler.CopyCraftToSave(e.SourceModels as List <CraftInfo>, SaveType.Save, (e.TargetModel as CraftInfo).SaveName); UpdateList(); }
private void DropsinkOnModelCanDrop(object sender, ModelDropEventArgs e) { if (e.TargetModel != null) { if (e.TargetModel is WebCollection wb && !wb.Loaded) { e.Handled = true; e.Effect = DragDropEffects.None; } } }
private void DropsinkOnModelDropped(object sender, ModelDropEventArgs modelDropEventArgs) { modelDropEventArgs.Handled = true; var beatmaps = new Beatmaps(); foreach (var sourceModel in modelDropEventArgs.SourceModels) { beatmaps.Add((BeatmapExtension)sourceModel); } BeatmapsDropped?.Invoke(this, beatmaps); }
public void HandleEvent_ModelDropped(object sender, ModelDropEventArgs e) { if (!(e.TargetModel is ConnectionInfo dropTarget)) { return; } var dropSource = (ConnectionInfo)e.SourceModels[0]; DropModel(dropSource, dropTarget, e.DropTargetLocation); e.Handled = true; }
private void ListView_ModelDropped(object sender, ModelDropEventArgs e) { try { Console.WriteLine(SourceObjectType.Name + " ModelDropped " + e.TargetModel); } catch (Exception ex) { Log.ShowError(ex); } }
private void HandleReorder(ModelDropEventArgs e) { if (e.SourceModels == null || e.SourceModels.Count != 1) { return; } ExtractableColumn sourceColumn = (ExtractableColumn)e.SourceModels[0]; HandleReorder(sourceColumn, (IOrderable)e.TargetModel, e.DropTargetLocation); }
private void targetTreeView_ModelCanDrop(object sender, ModelDropEventArgs e) { var targetNode = e.TargetModel as MP.MappingNode; var sourceNode = e.SourceModels.Cast <Object>().FirstOrDefault() as MP.MappingNode; if (targetNode != null && sourceNode != null) { e.Effect = DragDropEffects.Link; e.InfoMessage = "Create new Mapping"; } }
private void objectListViewLayers_ModelCanDrop(object sender, ModelDropEventArgs e) { if (e.SourceModels == objectListViewLayers) { e.Effect = DragDropEffects.None; } else { e.Effect = DragDropEffects.Move; } }
private void olvSelected_ModelDropped(object sender, ModelDropEventArgs e) { if (e.SourceListView == olvSelected) { HandleReorder(e); } if (e.SourceListView == olvAvailable) { HandleDropAdding(e); } }
private void objectListView_ModelDropped(object sender, ModelDropEventArgs e) { var copy = new List <Combatant>(e.SourceModels.OfType <Combatant>()); if (copy.Count == 0) { return; } foreach (var combatant in copy) { this.Encounter.AddCombatant(combatant); } }
private InsertOption GetDropLocation(ModelDropEventArgs e) { if (e.DropTargetLocation == DropTargetLocation.AboveItem) { return(InsertOption.InsertAbove); } if (e.DropTargetLocation == DropTargetLocation.BelowItem) { return(InsertOption.InsertBelow); } return(InsertOption.Default); }
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(); }
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; }
private void treeListView_ModelDropped(object sender, ModelDropEventArgs e) { var targetNode = e.TargetModel as HierarchyNode; var sourceNode = e.SourceModels[0] as HierarchyNode; if (targetNode.Script != null && sourceNode.Script != null) { if (e.DropTargetLocation == DropTargetLocation.AboveItem) { ScriptManager.MoveScriptBefore(sourceNode.Script.GetIndex(ScriptManager), targetNode.Script.GetIndex(ScriptManager)); } if (e.DropTargetLocation == DropTargetLocation.BelowItem) { ScriptManager.MoveScriptAfter(sourceNode.Script.GetIndex(ScriptManager), targetNode.Script.GetIndex(ScriptManager)); } } if (targetNode.Command != null && sourceNode.Command != null) { var targetScript = ScriptManager.GetScriptFromCommand(targetNode.Command); var sourceScript = ScriptManager.GetScriptFromCommand(sourceNode.Command); if (e.DropTargetLocation == DropTargetLocation.AboveItem) { ScriptManager.MoveCommandBefore(sourceNode.Command, targetNode.Command, sourceScript.GetIndex(ScriptManager), targetScript.GetIndex(ScriptManager)); } if (e.DropTargetLocation == DropTargetLocation.BelowItem) { ScriptManager.MoveCommandAfter(sourceNode.Command, targetNode.Command, sourceScript.GetIndex(ScriptManager), targetScript.GetIndex(ScriptManager)); } if (e.DropTargetLocation == DropTargetLocation.Item && targetNode.Command.CanBeNested) { var node = sourceScript.Commands.GetNodeFromValue(sourceNode.Command); sourceScript.RemoveCommand(sourceNode.Command); targetScript.AddCommandNode(node, targetNode.Command); } } if (targetNode.Script != null && sourceNode.Command != null) { var sourceScript = ScriptManager.GetScriptFromCommand(sourceNode.Command); var node = sourceScript.Commands.GetNodeFromValue(sourceNode.Command); sourceScript.RemoveCommand(sourceNode.Command); targetNode.Script.AddCommandNode(node); } }
private void HandleDropAdding(ModelDropEventArgs e) { if (e.SourceModels != null) { foreach (IColumn sourceModel in e.SourceModels.OfType <IColumn>()) { if (!IsAlreadySelected(sourceModel)) { var added = AddColumnToExtraction(sourceModel); HandleReorder(added, e.TargetModel as IOrderable, e.DropTargetLocation); } } } RefreshDisabledObjectStatus(); }