// event handler pro vkládání uzlu
        private void diagram_ExternalObjectsDropped(object sender, DiagramEventArgs e)
        {
            ActivityDiagramNodeData data = null;

            if ((sender as Diagram).SelectedNode == null)
            {
                data = (sender as Diagram).SelectedGroup.Data as ActivityDiagramNodeData;
            }
            else
            {
                data = (sender as Diagram).SelectedNode.Data as ActivityDiagramNodeData;
            }
            string[] categories = { Constants.UML_AD_ACTIVITY, Constants.UML_AD_OBJECT, Constants.UML_AD_SWIMLANE, Constants.UML_AD_NOTE, Constants.UML_AD_SEND_SIGNAL_ACTION, Constants.UML_AD_ACCEPT_EVENT_ACTION };
            if (data.Category == Constants.UML_AD_INITIAL_ACTIVITY /*|| data.Category == Constants.UML_AD_FINAL_ACTIVITY*/)
            {
                if ((sender as Diagram).Nodes.Where(x => (x.Data as ActivityDiagramNodeData).Category == data.Category).Count() > 1)
                {
                    diagram.Model.RemoveNode(data);
                }
            }
            else if (categories.Contains(data.Category) && !AllowDuplicateNodes)
            {
                if ((sender as Diagram).Nodes.Where(x => (x.Data as ActivityDiagramNodeData).IRI == data.IRI && (x.Data as ActivityDiagramNodeData).Category == data.Category).Count() > 1)
                {
                    diagram.Model.RemoveNode(data);
                }
            }
        }
        // event handler pro validaci myší vytvořených linků jakožto povolených vztahů z UPMM
        private void diagram_LinkDrawn(object sender, DiagramEventArgs e)
        {
            Link link = (e.Part as Link);
            ActivityDiagramLinkData linkData = link.Data as ActivityDiagramLinkData;
            ActivityDiagramNodeData fromData = link.FromData as ActivityDiagramNodeData;
            ActivityDiagramNodeData toData   = link.ToData as ActivityDiagramNodeData;

            ChooseLinkCategory(fromData, toData, linkData);
            switch (linkData.Category)
            {
            case "Control Flow":
                CheckLink(fromData, toData, linkData);
                break;

            case "Object Flow":
                CheckLink(fromData, toData, linkData);
                break;

            case "Anchor":
                CheckLink(fromData, toData, linkData);
                break;

            default:
                (diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Remove(linkData);
                break;
            }
        }
Exemple #3
0
        /// <summary>
        /// Item selected event to change the property panel elements value and enable or disbale the panel.
        /// </summary>
        /// <param name="sender">Diagram</param>
        /// <param name="args">DiagramEventArgs</param>
        private void Diagram_ItemUnSelectedEvent(object sender, DiagramEventArgs args)
        {
            var viewModel = Diagram.DataContext as AnnotationsViewModel;

            viewModel.Decoration       = null;
            viewMode.IsChecked         = false;
            labelInteraction.IsChecked = false;
            bold.Background            = new SolidColorBrush(Colors.Transparent);
            italic.Background          = new SolidColorBrush(Colors.Transparent);
            Strike.Background          = new SolidColorBrush(Colors.Transparent);
            underline.Background       = new SolidColorBrush(Colors.Transparent);
            if (((Diagram.SelectedItems as SelectorViewModel).Nodes as IEnumerable <object>).Count() == 0 &&
                ((Diagram.SelectedItems as SelectorViewModel).Connectors as IEnumerable <object>).Count() == 0)
            {
                propertyPanel.IsEnabled = false;
                if (viewModel.prevbutton != null)
                {
                    viewModel.prevbutton.Style = this.Resources["AnnotationsButtonStyle"] as Style;
                }
            }
            else
            {
                propertyPanel.IsEnabled = true;
            }
        }
        private void mainDiagram_TemplateApplied(object sender, DiagramEventArgs e)
        {
            var bind = new System.Windows.Data.Binding("Scale");

            bind.Source = mainDiagram.Panel;
            bind.Mode   = System.Windows.Data.BindingMode.TwoWay;
            zoomSlider.SetBinding(Slider.ValueProperty, bind);
        }
Exemple #5
0
        // When a node is created with ClickCreatingTool we must do some additional layout
        void myDiagram_NodeCreated(object sender, DiagramEventArgs e)
        {
            Node        n          = (Node)e.Part;
            MindMapData data       = (MindMapData)n.Data;
            MindMapData parentData = (MindMapData)myDiagram.Model.FindNodeByKey("/");

            n.Data = SetUpChild(data, parentData);
        }
Exemple #6
0
        /// <summary>
        /// Update commands when the zoom level changes
        /// </summary>
        private void DesignerZoomChanged(object sender, DiagramEventArgs e)
        {
            IVsUIShell shell = (IVsUIShell)GetService(typeof(SVsUIShell));

            if (shell != null)
            {
                ErrorHandler.ThrowOnFailure(shell.UpdateCommandUI(0));
            }
        }
Exemple #7
0
        internal void project_DiagramRemoved(object sender, DiagramEventArgs e)
        {
            PanelWindow tab = FindTab(e.Diagram);

            if (tab != null)
            {
                RemoveTab(tab);
            }
        }
        /// <summary>
        /// Method will execute when ItemSelectedCommand executed
        /// </summary>
        /// <param name="param">
        /// </param>
        private void ItemSelectedCommandExecute(object param)
        {
            DiagramEventArgs args = param as DiagramEventArgs;

            if (args.Item is BrainstormingNodeVM)
            {
                BrainstormingNodeVM node = args.Item as BrainstormingNodeVM;
                this.UpdateQuickCommandsVisibility(this.Rootnode.IsSelected ? this.Rootnode : node);
            }
        }
 void MainWindow_ItemSelectedEvent(object sender, DiagramEventArgs args)
 {
     if (args.Item is INode)
     {
         propertyGrid1.SelectedObject = args.Item;
     }
     else if (args.Item is IConnector)
     {
         propertyGrid1.SelectedObject = args.Item;
     }
 }
Exemple #10
0
 private void MainWindow_ItemUnSelectedEvent(object sender, DiagramEventArgs args)
 {
     (Diagram.DataContext as TextAnnotations).Decoration = null;
     viewMode.IsChecked         = false;
     labelInteraction.IsChecked = false;
     if (((Diagram.SelectedItems as SelectorViewModel).Nodes as IEnumerable <object>).Count() == 0 &&
         ((Diagram.SelectedItems as SelectorViewModel).Nodes as IEnumerable <object>).Count() == 0)
     {
         (Diagram.DataContext as TextAnnotations).prevbutton.Style = Application.Current.Resources["ButtonStyle"] as Style;
     }
 }
Exemple #11
0
        private void MyDiagram_NodeCreated(object sender, DiagramEventArgs e)
        {
            var nodeModel = e.Part.Data as NodeModel;
            var key       = NodeKeyCreator.GetNodeName(myDiagram.Model.NodesSource.Cast <NodeModel>().Select(i => i.Key), myDiagram.Model.NodesSource.Cast <NodeModel>().Select(i => i.Key));


            nodeModel.Text = key;
            nodeModel.Key  = key;

            AddNodeToMatrix(key);
        }
Exemple #12
0
            private static void ViewDisplayChanged(object sender, DiagramEventArgs e)
            {
                DiagramClientView             view = e.DiagramClientView;
                Diagram                       diagram;
                DiagramDisplayHasDiagramOrder link;

                if (null != (diagram = view.Diagram) &&
                    null != (link = DiagramDisplayHasDiagramOrder.GetLinkToDiagramDisplay(diagram)))
                {
                    link.UpdatePosition(view.ViewBounds.Center, view.ZoomFactor);
                }
            }
Exemple #13
0
 private void DdClicked(object sender, DiagramEventArgs e)
 {
     myContextMenu.Visibility = Visibility.Collapsed;
     if (e.MouseButton == MouseButton.Right && (CanEdit))
     {
         _rightClick = e.MousePosition;
         myContextMenu.Visibility  = Visibility.Visible;
         myContextMenu.IsEnabled   = true;
         myContextMenu.DataContext = MenuOptions;
         SelectedNodes             = new List <DiagramNode>();
     }
 }
Exemple #14
0
 private void MainWindow_ItemSelectedEvent(object sender, DiagramEventArgs args)
 {
     if (themeRemovedItems.Contains(args.Item))
     {
         shapeRemoveThemesCheckbox.IsChecked = true;
         foreach (var galleryGroup in shapeEffectStylesGallery.GalleryGroups)
         {
             foreach (var galleryItem in galleryGroup.Items)
             {
                 (galleryItem as RibbonGalleryItem).IsEnabled = false;
             }
         }
         foreach (var galleryGroup in connectorEffectStylesGallery.GalleryGroups)
         {
             foreach (var galleryItem in galleryGroup.Items)
             {
                 (galleryItem as RibbonGalleryItem).IsEnabled = false;
             }
         }
     }
     else
     {
         foreach (var galleryGroup in shapeEffectStylesGallery.GalleryGroups)
         {
             foreach (var galleryItem in galleryGroup.Items)
             {
                 (galleryItem as RibbonGalleryItem).IsEnabled = true;
             }
         }
         foreach (var galleryGroup in connectorEffectStylesGallery.GalleryGroups)
         {
             foreach (var galleryItem in galleryGroup.Items)
             {
                 (galleryItem as RibbonGalleryItem).IsEnabled = true;
             }
         }
         shapeRemoveThemesCheckbox.IsChecked = false;
     }
     if (args.Item is INode)
     {
         connectorEffectStylesGallery.Visibility = Visibility.Collapsed;
         shapeEffectStylesGallery.Visibility     = Visibility.Visible;
         connectorEffectStylesGallery.IsEnabled  = false;
         shapeEffectStylesGallery.IsEnabled      = true;
     }
     else if (args.Item is IConnector)
     {
         connectorEffectStylesGallery.Visibility = Visibility.Visible;
         shapeEffectStylesGallery.Visibility     = Visibility.Collapsed;
         shapeEffectStylesGallery.IsEnabled      = false;
         connectorEffectStylesGallery.IsEnabled  = true;
     }
 }
Exemple #15
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method applies diagram deletes.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessDeleteDiagramPerformed(DiagramEventArgs data)
        {
            try
            {
                bool isItemMatch = false;
                if (data != null && data.Diagram != null)
                {
                    foreach (DiagramViewModel item in Diagrams.ToList <DiagramViewModel>())
                    {
                        if (item.Diagram.DiagramID == data.Diagram.DiagramID)
                        {
                            // remove item from tabs, if present
                            WorkspaceEventArgs message = new WorkspaceEventArgs();
                            message.ItemID = item.Diagram.DiagramID;
                            Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message);

                            // delete children
                            for (int i = item.Items.Count - 1; i >= 0; i--)
                            {
                                if (item.Items[i] is DiagramEntityViewModel)
                                {
                                    DiagramEntityViewModel child        = item.Items[i] as DiagramEntityViewModel;
                                    DiagramEntityEventArgs childMessage = new DiagramEntityEventArgs();
                                    childMessage.DiagramEntity = child.DiagramEntity;
                                    childMessage.DiagramID     = item.Diagram.DiagramID;
                                    childMessage.Solution      = Solution;
                                    childMessage.WorkspaceID   = child.WorkspaceID;
                                    item.ProcessDeleteDiagramEntityPerformed(childMessage);
                                }
                            }

                            // delete item
                            isItemMatch = true;
                            Diagrams.Remove(item);
                            Solution.DiagramList.Remove(item.Diagram);
                            Items.Remove(item);
                            Solution.ResetModified(true);
                            OnUpdated(this, null);
                            break;
                        }
                    }
                    if (isItemMatch == false)
                    {
                        ShowIssue(DisplayValues.Issue_DeleteItemNotFound);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowIssue(ex.Message + ex.StackTrace);
            }
        }
Exemple #16
0
 // only use the saved route points after the layout has completed,
 // because links will get the default routing
 private void UpdateRoutes(object sender, DiagramEventArgs e)
 {
     // just set the Route points once per Load
     myDiagram.LayoutCompleted -= UpdateRoutes;
     foreach (Link link in myDiagram.Links)
     {
         Wire wire = link.Data as Wire;
         if (wire != null && wire.Points != null && wire.Points.Count() > 1)
         {
             link.Route.Points = (IList <Point>)wire.Points;
         }
     }
     myDiagram.PartManager.UpdatesRouteDataPoints = true;  // OK for CustomPartManager to update Transition.Points automatically
 }
        private void diagram_LinkRelinked(object sender, DiagramEventArgs e)
        {
            Link link = (e.Part as Link);
            ClassDiagramLinkData linkData = link.Data as ClassDiagramLinkData;
            ClassDiagramNodeData fromData = link.FromData as ClassDiagramNodeData;
            ClassDiagramNodeData toData   = link.ToData as ClassDiagramNodeData;

            var isValid = CheckLink(fromData, toData, linkData, linkData.Category);

            if (!isValid)
            {
                (diagram.LinksSource as ObservableCollection <ClassDiagramLinkData>).Remove(linkData);
            }
        }
        private void UpdateRoutes(object sender, DiagramEventArgs e)
        {
            this.mainDiagram.LayoutCompleted -= UpdateRoutes;

            foreach (Link link in mainDiagram.Links)
            {
                ActivityLink linkData = link.Data as ActivityLink;
                if (linkData != null && linkData.Points != null && linkData.Points.Count() > 1)
                {
                    link.Route.Points = (IList <Point>)linkData.Points;
                }
            }
            mainDiagram.PartManager.UpdatesRouteDataPoints = true;
        }
Exemple #19
0
        // only use the saved route points after the layout has completed,
        // because links will get the default routing
        private void UpdateRoutes(object sender, DiagramEventArgs e)
        {
            // just set the Route points once per Load
            myDiagram.LayoutCompleted -= UpdateRoutes;
            foreach (var link in myDiagram.Links)
            {
                if (link.Data is LinkModel linkModel && linkModel.Points != null && linkModel.Points.Count() > 1)
                {
                    link.Route.Points = (IList <Point>)linkModel.Points;
                }
            }

            myDiagram.PartManager.UpdatesRouteDataPoints =
                true; // OK for CustomPartManager to update LinkModel.Points automatically
        }
Exemple #20
0
        private void ItemSelectedCommandExecute(object param)
        {
            DiagramEventArgs args = param as DiagramEventArgs;

            if (args.Item is OrganizationChartNodeVM)
            {
                OrganizationChartNodeVM node = args.Item as OrganizationChartNodeVM;
                UpdateQuickCommandsVisibility();
            }

            if (args.Item is OrganizationChartNodeVM && (args.Item as OrganizationChartNodeVM).Type == "root")
            {
                this.Quickcommands_Delete.VisibilityMode = VisibilityMode.Connector;
            }
        }
Exemple #21
0
        /// <summary>
        /// Deactivate the mouse action by deselecting the current toolbox item.
        /// </summary>
        protected override void OnMouseActionDeactivated(DiagramEventArgs e)
        {
            base.OnMouseActionDeactivated(e);
            DiagramClientView clientView;
            Diagram           diagram;
            DiagramView       activeDiagramView;
            IToolboxService   toolbox;

            if (null != (clientView = e.DiagramClientView) &&
                null != (diagram = clientView.Diagram) &&
                null != (activeDiagramView = diagram.ActiveDiagramView) &&
                null != (toolbox = activeDiagramView.Toolbox))
            {
                toolbox.SelectedToolboxItemUsed();
            }
        }
Exemple #22
0
        /// <summary>
        /// Reset the member variables
        /// </summary>
        /// <param name="e">DiagramEventArgs</param>
        protected override void OnMouseActionDeactivated(DiagramEventArgs e)
        {
            base.OnMouseActionDeactivated(e);

            // Set the selection back to pointer after connect action
            DiagramView     activeView;
            IToolboxService toolbox;

            if ((null != (activeView = Diagram.ActiveDiagramView)) &&
                (null != (toolbox = activeView.Toolbox)))
            {
                toolbox.SelectedToolboxItemUsed();
            }

            Reset();
        }
        /// <summary>
        /// Deactivates the <see cref="MouseAction"/> by removing the listening <see cref="EventHandler{TEventArgs}"/>s,
        /// calling the base, and then raising the <see cref="AfterMouseActionDeactivated"/> event.
        /// </summary>
        protected override void OnMouseActionDeactivated(DiagramEventArgs e)
        {
            if (myInOnClicked)
            {
                myDeactivatedDuringOnClick = true;
                return;
            }
            ManageStoreEvents(e.DiagramClientView.Diagram.Store, EventHandlerAction.Remove);
            base.OnMouseActionDeactivated(e);
            MouseActionDeactivatedEventHandler handler = AfterMouseActionDeactivated;

            if (handler != null)
            {
                handler(this, e);
            }
            Reset();
        }
Exemple #24
0
        internal bool RaiseEvent(int evt, DiagramEventArgs args)



        {
            if (this.Diagram != null)
            {
                if (args == null)
                {
                    args = new DiagramEventArgs();
                }
                args.RoutedEvent = evt;
                this.Diagram.RaiseEvent(args);
                return(args.Handled);
            }
            return(false);
        }
        /// <summary>
        /// Method to raise the item tapped event for splitting the segments.
        /// </summary>
        /// <param name="sender">diagram</param>
        /// <param name="args">Event args</param>
        private void MainWindow_ItemTappedEvent(object sender, DiagramEventArgs args)
        {
            if (args.Item is IConnector)
            {
                //Getting the mouse point while tap on the connector
                Point point = ((args as ItemTappedEventArgs).MouseEventArgs as MouseEventArgs).GetPosition(Diagram.Page);
                //Specify the editing point, editing type and hit padding value
                AddRemoveStraightSegmentArgs addremoveargs = new AddRemoveStraightSegmentArgs()
                {
                    Point          = point,
                    SegmentEditing = SegmentEditing.Add,
                    HitPadding     = 5
                };

                //Method to add or remove the segment
                ((args.Item as IConnector).Info as IConnectorInfo).EditSegment(addremoveargs);
            }
        }
Exemple #26
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method processes the new diagram command.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessNewDiagramCommand()
        {
            DiagramEventArgs message = new DiagramEventArgs();

            message.Diagram            = new Diagram();
            message.Diagram.DiagramID  = Guid.NewGuid();
            message.Diagram.SolutionID = Solution.SolutionID;
            message.Diagram.Solution   = Solution;
            message.SolutionID         = Solution.SolutionID;
            message.Diagram.Solution   = Solution;
            message.Solution           = Solution;
            message.WorkspaceID        = WorkspaceID;

            #region protected
            message.Entities = Entities;
            #endregion protected

            Mediator.NotifyColleagues <DiagramEventArgs>(MediatorMessages.Command_EditDiagramRequested, message);
        }
Exemple #27
0
        // if a node next to root moves to the other side, change its layout
        private void myDiagram_SelectionMoved(object sender, DiagramEventArgs e)
        {
            // find all nodes in the selection that are children of the root
            var rootChildren = myDiagram.SelectedParts.OfType <Node>().Where(n => ((MindMapData)n.Data).ParentKey == "/");

            foreach (Node n in rootChildren)
            {
                MindMapData root  = (MindMapData)myDiagram.Model.FindNodeByKey("/");
                double      rootX = root.Location.X;
                double      nodeX = n.Location.X;
                if (rootX < nodeX && n.LayoutId != "Right")
                {
                    FlipChildren(n, "Right");
                }
                else if (rootX > nodeX && n.LayoutId != "Left")
                {
                    FlipChildren(n, "Left");
                }
            }
        }
Exemple #28
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method applies diagram updates.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessEditDiagramPerformed(DiagramEventArgs data)
        {
            try
            {
                bool isItemMatch = false;
                if (data != null && data.Diagram != null)
                {
                    foreach (DiagramViewModel item in Diagrams)
                    {
                        if (item.Diagram.DiagramID == data.Diagram.DiagramID)
                        {
                            isItemMatch = true;
                            item.Diagram.TransformDataFromObject(data.Diagram, null, false);
                            item.OnUpdated(item, null);
                            item.ShowInTreeView();
                            break;
                        }
                    }
                    if (isItemMatch == false)
                    {
                        // add new Diagram
                        data.Diagram.Solution = Solution;

                        #region protected
                        DiagramViewModel newItem = new DiagramViewModel(data.Diagram, Entities, Solution);
                        #endregion protected

                        newItem.Updated += new EventHandler(Children_Updated);
                        Diagrams.Add(newItem);
                        Solution.DiagramList.Add(newItem.Diagram);
                        Items.Add(newItem);
                        OnUpdated(this, null);
                        newItem.ShowInTreeView();
                    }
                }
            }
            catch (Exception ex)
            {
                ShowIssue(ex.Message + ex.StackTrace);
            }
        }
        /// <summary>
        ///     Handler for ZoomChanged event that will persist current zoom level when changed
        /// </summary>
        private void DiagramClientView_ZoomChanged(object sender, DiagramEventArgs e)
        {
            var diagram = CurrentDiagram as EntityDesignerDiagram;
            var docData = DocData as MicrosoftDataEntityDesignDocData;

            // make sure that the Model Diagram has already been created or translated before persisting ZoomLevel
            if (diagram == null ||
                docData == null ||
                !docData.IsModelDiagramLoaded)
            {
                return;
            }
            try
            {
                diagram.PersistZoomLevel();
            }
            catch (FileNotEditableException fileNotEditableException)
            {
                VsUtils.ShowErrorDialog(fileNotEditableException.Message);
            }
        }
Exemple #30
0
        // Make a new object's size be the closest non-zero multiple of ResizeCellSize.
        private void myDiagram_ExternalObjectsDropped(object sender, DiagramEventArgs e)
        {
            Size cellsize = this.Options.CellSize;

            foreach (Node n in myDiagram.SelectedParts)
            {
                if (n == null)
                {
                    continue;
                }
                MyNodeData data = n.Data as MyNodeData;
                double     w    = cellsize.Width * Math.Round(data.Width / cellsize.Width);
                w = Math.Max(w, cellsize.Width);
                double h = cellsize.Height * Math.Round(data.Height / cellsize.Height);
                h = Math.Max(h, cellsize.Height);
                Rect newb = n.LocationSpot.RectForPoint(data.Location, new Size(w, h));
                data.Width  = w;
                data.Height = h;
                n.Move(new Point(newb.X, newb.Y), false);
            }
        }
		/// <summary>
		/// Redraw fact types for any selected roles, deselect the toolbox item,
		/// and chain to a new connect action if this one completed successfully.
		/// </summary>
		/// <param name="e">DiagramEventArgs</param>
		protected override void OnMouseActionDeactivated(DiagramEventArgs e)
		{
			base.OnMouseActionDeactivated(e);
			RedrawOwningFactTypes(mySelectedRoles);
			RedrawOwningFactTypes(myInitialSelectedRoles);

			// Set the selection back to pointer after connect action
			DiagramView activeView;
			IToolboxService toolbox;
			if ((null != (activeView = Diagram.ActiveDiagramView)) &&
				(null != (toolbox = activeView.Toolbox)))
			{
				toolbox.SelectedToolboxItemUsed();
			}

			// The ChainMouseAction call can reactivate this connect action,
			// so make sure we snapshot the state we need and do all requisite
			// cleanup before a potential reactivation.
			ExternalConstraintShape chainOnShape = (myPendingOnClickedAction == OnClickedAction.Complete) ? mySourceShape : null;
			bool chainOnlyIfIncomplete = chainOnShape != null && myInitialSelectedRoles != null && myInitialSelectedRoles.Count != 0;
			bool editingSubtypeFact = mySubtypeConnection;
			Reset();
			if (chainOnShape != null)
			{
				// Depending on the type of constraint you're editing, and possibly depending on the 
				// state of the model at the moment, you may want to activate the ExternalConstraintConnectAction
				// again.  If you want to do any fun tricks after a user's committed the action,
				// this would be the place to do it.
				IConstraint constraint = chainOnShape.AssociatedConstraint;
				if (constraint != null)
				{
					switch (constraint.ConstraintStorageStyle)
					{
						case ConstraintStorageStyle.SetComparisonConstraint:
							if (!editingSubtypeFact)
							{
								IConstraint editConstraint = chainOnShape.AssociatedConstraint;
								int maximum;
								SetComparisonConstraint comparisonConstraint = (SetComparisonConstraint)editConstraint;
								if (chainOnlyIfIncomplete ?
									comparisonConstraint.TooFewRoleSequencesError != null :
									(maximum = ConstraintUtility.RoleSequenceCountMaximum(editConstraint)) < 0 || comparisonConstraint.RoleSequenceCollection.Count < maximum)
								{
									ChainMouseAction(chainOnShape, e.DiagramClientView);
								}
							}
							break;
					}
				}
			}
		}
		/// <summary>
		/// Redraw fact types for any selected roles, deselect the toolbox item,
		/// and chain to a new connect action if this one completed successfully.
		/// </summary>
		/// <param name="e">DiagramEventArgs</param>
		protected override void OnMouseActionDeactivated(DiagramEventArgs e)
		{
			base.OnMouseActionDeactivated(e);
			if (mySourceShape != null)
			{
				mySourceShape.Invalidate(true);
			}

			// Set the selection back to pointer after connect action
			DiagramView activeView;
			IToolboxService toolbox;
			if ((null != (activeView = Diagram.ActiveDiagramView)) &&
				(null != (toolbox = activeView.Toolbox)))
			{
				toolbox.SelectedToolboxItemUsed();
			}

			// Do all requisite cleanup before a potential reactivation.
			Reset();
		}
		/// <summary>
		/// Cancel if the last hit shape is the Diagram by not forwarding
		/// to the base class. Otherwise, complete the action.
		/// </summary>
		/// <param name="e">DiagramEventArgs</param>
		protected override void OnMouseActionCompleted(DiagramEventArgs e)
		{
			base.OnMouseActionCompleted(e);
			myPendingOnClickedAction = OnClickedAction.Complete;
		}
 /// <summary>
 ///     Handler for ZoomChanged event that will persist current zoom level when changed
 /// </summary>
 private void DiagramClientView_ZoomChanged(object sender, DiagramEventArgs e)
 {
     var diagram = CurrentDiagram as EntityDesignerDiagram;
     var docData = DocData as MicrosoftDataEntityDesignDocData;
     // make sure that the Model Diagram has already been created or translated before persisting ZoomLevel
     if (diagram == null
         || docData == null
         || !docData.IsModelDiagramLoaded)
     {
         return;
     }
     try
     {
         diagram.PersistZoomLevel();
     }
     catch (FileNotEditableException fileNotEditableException)
     {
         VsUtils.ShowErrorDialog(fileNotEditableException.Message);
     }
 }
Exemple #35
0
		/// <summary>
		/// Deactivate the mouse action by deselecting the current toolbox item.
		/// </summary>
		protected override void OnMouseActionDeactivated(DiagramEventArgs e)
		{
			base.OnMouseActionDeactivated(e);
			DiagramClientView clientView;
			Diagram diagram;
			DiagramView activeDiagramView;
			IToolboxService toolbox;
			if (null != (clientView = e.DiagramClientView) &&
				null != (diagram = clientView.Diagram) &&
				null != (activeDiagramView = diagram.ActiveDiagramView) &&
				null != (toolbox = activeDiagramView.Toolbox))
			{
				toolbox.SelectedToolboxItemUsed();
			}
		}
Exemple #36
0
			private static void ViewDisplayChanged(object sender, DiagramEventArgs e)
			{
				DiagramClientView view = e.DiagramClientView;
				Diagram diagram;
				DiagramDisplayHasDiagramOrder link;
				if (null != (diagram = view.Diagram) &&
					null != (link = DiagramDisplayHasDiagramOrder.GetLinkToDiagramDisplay(diagram)))
				{
					link.UpdatePosition(view.ViewBounds.Center, view.ZoomFactor);
				}
			}
Exemple #37
0
 /// <summary>
 /// Double click event handler.
 /// </summary>
 public void DiagramDoubleClickHandler(object sender, DiagramEventArgs e)
 {
     float x = e.MousePosition.X - 20 - (e.MousePosition.X % 8);
     float y = e.MousePosition.Y - 20 - (e.MousePosition.Y % 8);
     MakeNode(x, y);
 }
Exemple #38
0
 public void DiagramClickedHandler(Object sender, DiagramEventArgs e)
 {
     ProxyDiagram dia = new ProxyDiagram(diagramView1.Diagram);
     propertyGrid1.SelectedObject = dia;
 }
Exemple #39
0
		/// <summary>
		/// Update commands when the zoom level changes
		/// </summary>
		private void DesignerZoomChanged(object sender, DiagramEventArgs e)
		{
			IVsUIShell shell = (IVsUIShell)GetService(typeof(SVsUIShell));
			if (shell != null)
			{
				ErrorHandler.ThrowOnFailure(shell.UpdateCommandUI(0));
			}
		}
    internal bool RaiseEvent(int evt, DiagramEventArgs args)









    {
      if (this.Diagram != null) {
        if (args == null) args = new DiagramEventArgs();
        args.RoutedEvent = evt;
        this.Diagram.RaiseEvent(args);
        return args.Handled;
      }
      return false;
    }
		/// <summary>
		/// Deactivates the <see cref="MouseAction"/> by removing the listening <see cref="EventHandler{TEventArgs}"/>s,
		/// calling the base, and then raising the <see cref="AfterMouseActionDeactivated"/> event.
		/// </summary>
		protected override void OnMouseActionDeactivated(DiagramEventArgs e)
		{
			if (myInOnClicked)
			{
				myDeactivatedDuringOnClick = true;
				return;
			}
			ManageStoreEvents(e.DiagramClientView.Diagram.Store, EventHandlerAction.Remove);
			base.OnMouseActionDeactivated(e);
			MouseActionDeactivatedEventHandler handler = AfterMouseActionDeactivated;
			if (handler != null)
			{
				handler(this, e);
			}
			Reset();
		}
		/// <summary>
		/// Adds an <see cref="EventHandler{TEventArgs}"/> on the <see cref="Store"/> so we can track the shape for the <see cref="UniquenessConstraint"/>
		/// added during the <see cref="Transaction"/> resulting from completion of the <see cref="MouseAction"/>.
		/// </summary>
		protected override void OnMouseActionActivated(DiagramEventArgs e)
		{
			ManageStoreEvents(Diagram.Store, EventHandlerAction.Add);
		}
Exemple #43
0
		/// <summary>
		/// Reset the member variables
		/// </summary>
		/// <param name="e">DiagramEventArgs</param>
		protected override void OnMouseActionDeactivated(DiagramEventArgs e)
		{
			base.OnMouseActionDeactivated(e);

			// Set the selection back to pointer after connect action
			DiagramView activeView;
			IToolboxService toolbox;
			if ((null != (activeView = Diagram.ActiveDiagramView)) &&
				(null != (toolbox = activeView.Toolbox)))
			{
				toolbox.SelectedToolboxItemUsed();
			}

			Reset();
		}