public virtual void NotifyAction(IActionControl sender, ActionEventArgs argument) { if (ActionCallback != null) { ActionCallback(sender, argument); } }
public void StartDrag(IActionControl mousecontrol, Point startpoint) { this.frontcanvas.Visibility = System.Windows.Visibility.Visible; this.frontcanvas.Children.Clear(); FrameworkElement dragcontrol = null; foreach (var item in GetSelectItems()) { var x = Canvas.GetLeft(item.Element); var y = Canvas.GetTop(item.Element); Image image = new Image(); image.DataContext = item; image.Source = item.DefaultView; image.Width = item.Element.ActualWidth; image.Height = item.Element.ActualHeight; this.frontcanvas.Children.Add(image); Canvas.SetLeft(image, x); Canvas.SetTop(image, y); if (mousecontrol.Equals(item)) { dragcontrol = image; } } this.frontcanvas.ElementBeingDragged = dragcontrol; this.frontcanvas.StartDrag(startpoint); dragcontrol.Loaded += (s, e) => dragcontrol.CaptureMouse(); }
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnPreviewMouseLeftButtonDown(e); var mousepoint = e.GetPosition(this.bottomcanvas); var hitvisual = VisualTreeHelper.HitTest(this.bottomcanvas, mousepoint); if (hitvisual != null && hitvisual.VisualHit != null) { selectcontrol = hitvisual.VisualHit.FindVisualParent <IActionControl>(); } if (selectcontrol != null) { if (!selectcontrol.IsSelected) { CheckSelected(selectcontrol); } DragPoint = mousepoint; this.bottomcanvas.BringToFront(selectcontrol.Element); } else { MousePoint = mousepoint; this.bottomcanvas.Start(MousePoint.Value); JudgeSelect(Rect.Empty); this.bottomcanvas.CaptureMouse(); } }
private static void AddChildActions(ModuleAction objParentAction, Node objParentNode, Node objRootNode, IActionControl objActionControl, int intDepth) { bool blnPending; foreach (ModuleAction objAction in objParentAction.Actions) { blnPending = IsActionPending(objParentNode, objRootNode, intDepth); if (objAction.Title == "~") { if (blnPending == false) { objParentNode.Nodes.AddBreak(); } } else { if (objAction.Visible == true && (objAction.Secure != SecurityAccessLevel.Anonymous || ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "EDIT", objActionControl.ModuleControl.ModuleContext.Configuration)) && ModulePermissionController.HasModuleAccess(objAction.Secure, Null.NullString, objActionControl.ModuleControl.ModuleContext.Configuration)) { if (blnPending) { objParentNode.HasNodes = true; } else { Node objNode; int i = objParentNode.Nodes.Add(); objNode = objParentNode.Nodes[i]; objNode.ID = objAction.ID.ToString(); objNode.Key = objAction.ID.ToString(); objNode.Text = objAction.Title; if (!String.IsNullOrEmpty(objAction.ClientScript)) { objNode.JSFunction = objAction.ClientScript; objNode.ClickAction = eClickAction.None; } else { objNode.NavigateURL = objAction.Url; if (objAction.UseActionEvent == false && !String.IsNullOrEmpty(objNode.NavigateURL)) { objNode.ClickAction = eClickAction.Navigate; if (objAction.NewWindow) { objNode.Target = "_blank"; } } else { objNode.ClickAction = eClickAction.PostBack; } } objNode.Image = objAction.Icon; if (objAction.HasChildren()) { AddChildActions(objAction, objNode, objRootNode, objActionControl, intDepth); } } } } } }
public bool CheckSelected(IActionControl ac) { bool recheck = ac == null ? false : !ac.IsSelected; this.DragControls.ForEach(i => i.IsSelected = i.Equals(ac)); return(recheck); }
protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e) { base.OnPreviewMouseLeftButtonUp(e); this.DragPoint = null; this.MousePoint = null; this.selectcontrol = null; this.ReleaseMouseCapture(); }
public static NodeCollection GetActionNodes(ModuleAction objActionRoot, Node objRootNode, Control objControl, int intDepth) { NodeCollection objCol = objRootNode.ParentNode.Nodes; IActionControl objActionControl = objControl as IActionControl; if (objActionControl != null) { AddChildActions(objActionRoot, objRootNode, objRootNode, objActionControl, intDepth); } return(objCol); }
private void ActionControl_NativeControlDisposed(object sender, System.EventArgs e) { IActionControl actionControl = (IActionControl)sender; actionControl.NativeControlDisposed -= ActionControl_NativeControlDisposed; var h = dictBinding.FirstOrDefault(k => k.Key.Id == actionControl.ActionId); // Wirf die ActionBinding weg !!! if (h.Value != null) { h.Value.Dispose(); dictBinding.Remove(h.Key); } }
private void actionControlsSiteController_CustomAddActionControlToContainer(object sender, CustomAddActionControlEventArgs e) { if (e.Action is CheckableSimpleAction) { if (e.Container is BarLinkActionControlContainer) { BarLinkActionControlContainer container = (BarLinkActionControlContainer)e.Container; IActionControl actionControl = CreateActionControl(e.Action.Id, container.BarContainerItem); container.AddActionControl(actionControl); e.Handled = true; } if (e.Container is RibbonGroupActionControlContainer) { RibbonGroupActionControlContainer container = (RibbonGroupActionControlContainer)e.Container; IActionControl actionControl = CreateActionControl(e.Action.Id, container.RibbonGroup.ItemLinks); container.AddActionControl(actionControl); e.Handled = true; } } }
public static NodeCollection GetActionNodes(ModuleAction objActionRoot, Control objControl, int intDepth) { NodeCollection objCol = new NodeCollection(objControl.ClientID); IActionControl objActionControl = objControl as IActionControl; if (objActionControl != null) { if (objActionRoot.Visible) { objCol.Add(); Node objRoot = objCol[0]; objRoot.ID = objActionRoot.ID.ToString(); objRoot.Key = objActionRoot.ID.ToString(); objRoot.Text = objActionRoot.Title; objRoot.NavigateURL = objActionRoot.Url; objRoot.Image = objActionRoot.Icon; objRoot.Enabled = false; AddChildActions(objActionRoot, objRoot, objRoot.ParentNode, objActionControl, intDepth); } } return(objCol); }
/// ----------------------------------------------------------------------------- /// <summary> /// Constructs a new ActionManager /// </summary> /// <history> /// [cnurse] 12/23/2007 created /// </history> /// ----------------------------------------------------------------------------- public ActionManager(IActionControl actionControl) { ActionControl = actionControl; }
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="parentAction">Parent action</param> /// <param name="parentNode">Parent node</param> /// <param name="rootNode">Root Node.</param> /// <param name="actionControl">ActionControl to base actions off of</param> /// <param name="intDepth">How many levels deep should be populated</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> /// ----------------------------------------------------------------------------- private static void AddChildActions(ModuleAction parentAction, DNNNode parentNode, DNNNode rootNode, IActionControl actionControl, int intDepth) { //Add Menu Items foreach (ModuleAction action in parentAction.Actions) { bool isActionPending = IsActionPending(parentNode, rootNode, intDepth); if (action.Title == "~") { if (isActionPending == false) { //A title (text) of ~ denotes a break parentNode.DNNNodes.AddBreak(); } } else { //if action is visible and user has permission if (action.Visible && (action.Secure != SecurityAccessLevel.Anonymous || (!ModuleHost.IsViewMode(actionControl.ModuleControl.ModuleContext.Configuration, PortalSettings.Current)) && ModulePermissionController.HasModuleAccess(action.Secure, Null.NullString, actionControl.ModuleControl.ModuleContext.Configuration))) { if (isActionPending) { parentNode.HasNodes = true; } else { int i = parentNode.DNNNodes.Add(); DNNNode node = parentNode.DNNNodes[i]; node.ID = action.ID.ToString(); node.Key = action.ID.ToString(); node.Text = action.Title; //no longer including SPACE in generic node collection, each control must handle how they want to display if (string.IsNullOrEmpty(action.ClientScript) && string.IsNullOrEmpty(action.Url) && string.IsNullOrEmpty(action.CommandArgument)) { node.Enabled = false; } else if (!string.IsNullOrEmpty(action.ClientScript)) { node.JSFunction = action.ClientScript; node.ClickAction = eClickAction.None; } else { node.NavigateURL = action.Url; if (action.UseActionEvent == false && !String.IsNullOrEmpty(node.NavigateURL)) { node.ClickAction = eClickAction.Navigate; if (action.NewWindow) { node.Target = "_blank"; } } else { node.ClickAction = eClickAction.PostBack; } } node.Image = action.Icon; if (action.HasChildren()) //if action has children then call function recursively { AddChildActions(action, node, rootNode, actionControl, intDepth); } } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="objParentAction">Parent action</param> /// <param name="objParentNode">Parent node</param> /// <param name="objRootNode">Root Node.</param> /// <param name="objActionControl">ActionControl to base actions off of</param> /// <param name="intDepth">How many levels deep should be populated</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> /// ----------------------------------------------------------------------------- private static void AddChildActions(ModuleAction objParentAction, DNNNode objParentNode, DNNNode objRootNode, IActionControl objActionControl, int intDepth) { //Add Menu Items bool blnPending; foreach (ModuleAction objAction in objParentAction.Actions) { blnPending = IsActionPending(objParentNode, objRootNode, intDepth); if (objAction.Title == "~") { if (blnPending == false) { //A title (text) of ~ denotes a break objParentNode.DNNNodes.AddBreak(); } } else { //if action is visible and user has permission if (objAction.Visible && (objAction.Secure != SecurityAccessLevel.Anonymous || ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, string.Empty, objActionControl.ModuleControl.ModuleContext.Configuration)) && ModulePermissionController.HasModuleAccess(objAction.Secure, Null.NullString, objActionControl.ModuleControl.ModuleContext.Configuration)) { if (blnPending) { objParentNode.HasNodes = true; } else { DNNNode objNode; int i = objParentNode.DNNNodes.Add(); objNode = objParentNode.DNNNodes[i]; objNode.ID = objAction.ID.ToString(); objNode.Key = objAction.ID.ToString(); objNode.Text = objAction.Title; //no longer including SPACE in generic node collection, each control must handle how they want to display if (string.IsNullOrEmpty(objAction.ClientScript) && string.IsNullOrEmpty(objAction.Url) && string.IsNullOrEmpty(objAction.CommandArgument)) { objNode.Enabled = false; } else if (!string.IsNullOrEmpty(objAction.ClientScript)) { objNode.JSFunction = objAction.ClientScript; objNode.ClickAction = eClickAction.None; } else { objNode.NavigateURL = objAction.Url; if (objAction.UseActionEvent == false && !String.IsNullOrEmpty(objNode.NavigateURL)) { objNode.ClickAction = eClickAction.Navigate; if (objAction.NewWindow) { objNode.Target = "_blank"; } } else { objNode.ClickAction = eClickAction.PostBack; } } objNode.Image = objAction.Icon; if (objAction.HasChildren()) //if action has children then call function recursively { AddChildActions(objAction, objNode, objRootNode, objActionControl, intDepth); } } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="objParentAction">Parent action</param> /// <param name="objParentNode">Parent node</param> /// <param name="objActionControl">ActionControl to base actions off of</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- private static void AddChildActions(ModuleAction objParentAction, DNNNode objParentNode, IActionControl objActionControl) { AddChildActions(objParentAction, objParentNode, objParentNode, objActionControl, -1); }
private static ActionBinding Create(ActionBase action, IActionControl actionControl) => new ConsoleSimpleActionBinding((SimpleAction)action, (ISimpleActionControl)actionControl);
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="parentAction">Parent action</param> /// <param name="parentNode">Parent node</param> /// <param name="objActionControl">ActionControl to base actions off of</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- private static void AddChildActions(ModuleAction parentAction, DNNNode parentNode, IActionControl objActionControl) { AddChildActions(parentAction, parentNode, parentNode, objActionControl, -1); }
private static void AddChildActions(ModuleAction objParentAction, Node objParentNode, IActionControl objActionControl) { AddChildActions(objParentAction, objParentNode, objParentNode, objActionControl, -1); }