示例#1
0
        /// <summary>
        /// Creates a new instance of the ScriptableNodeEventArgs based
        /// on the event arguments provided
        /// </summary>
        /// <param name="originalArgs">The original event arguments</param>
        /// <returns>a configured ScriptableNodeEventArgs instance</returns>
        public static ScriptableNodeEventArgs Create(NodeViewModelEventArgs originalArgs)
        {
            ScriptableNodeEventArgs args = new ScriptableNodeEventArgs();

            args.Id              = originalArgs.NodeViewModel.ParentNode.ID;
            args.X               = originalArgs.NodeViewModel.Position.X;
            args.Y               = originalArgs.NodeViewModel.Position.Y;
            args.Visible         = !originalArgs.NodeViewModel.IsHidden;
            args.SourceMechanism = Enum.GetName(typeof(Model.CreationType), originalArgs.NodeViewModel.ParentNode.SourceMechanism);


            // Ensure that there are attributes available before trying
            // to get a string to represent them
            if (originalArgs.NodeViewModel.ParentNode.Attributes == null || originalArgs.NodeViewModel.ParentNode.Attributes.Count == 0)
            {
                args.Attributes = string.Empty;
            }
            else
            {
                args.Attributes = originalArgs.NodeViewModel.ParentNode.Attributes.ToJSON();
            }

            return(args);
        }
示例#2
0
        /// <summary>
        /// Creates a new instance of the ScriptableNodeEventArgs based
        /// on the event arguments provided
        /// </summary>
        /// <param name="originalArgs">The original event arguments</param>
        /// <returns>a configured ScriptableNodeEventArgs instance</returns>
        public static ScriptableNodeEventArgs Create(NodeViewModelEventArgs originalArgs)
        {
            ScriptableNodeEventArgs args = new ScriptableNodeEventArgs();

            args.Id = originalArgs.NodeViewModel.ParentNode.ID;
            args.X = originalArgs.NodeViewModel.Position.X;
            args.Y = originalArgs.NodeViewModel.Position.Y;
            args.Visible = !originalArgs.NodeViewModel.IsHidden;
            args.SourceMechanism = Enum.GetName(typeof(Model.CreationType), originalArgs.NodeViewModel.ParentNode.SourceMechanism);

            // Ensure that there are attributes available before trying
            // to get a string to represent them
            if (originalArgs.NodeViewModel.ParentNode.Attributes == null || originalArgs.NodeViewModel.ParentNode.Attributes.Count == 0)
                args.Attributes = string.Empty;
            else
                args.Attributes = originalArgs.NodeViewModel.ParentNode.Attributes.ToJSON();

            return args;
        }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="args"></param>
 public void NodePositionAnimatedEventHandler(NodeViewModelEventArgs args)
 {
     // Resize the graph to fit the window
     ResizeToFit();
 }