Exemplo n.º 1
0
        private void EventSinkService_NodeMouseDown(NNodeMouseEventArgs args)
        {
            if (args.Button != MouseButtons.Left || !(args.Node is NTableShape || args.Node is NGroupSampleUC))
            {
                pEmployee.Visible = false;
                return;
            }

            INNode node = args.Node;

            while (!(node is NTableShape))
            {
                node = node.ParentNode;
            }

            NEmployee employee = m_Dict[(NTableShape)node];

            pbPhoto.Image     = employee.Photo;
            lblName.Text      = employee.Name;
            lblPosition.Text  = employee.Position;
            lblBirthDate.Text = string.Format(CULTURE, "Birth Date: {0:MMMM dd, yyyy}", employee.BirthDate);
            lblSalary.Text    = "Salary: " + employee.Salary.ToString("C", CULTURE);
            lblBiography.Text = employee.Biography;

            pEmployee.Visible = true;
            args.Handled      = !(args.Node is NGroupSampleUC);
        }
Exemplo n.º 2
0
        private void OnNodeMouseDown(NNodeMouseEventArgs args)
        {
            NShape shape = args.Node as NShape;

            if (shape == null)
            {
                return;
            }

            if (shape.StyleSheetName == "reserved")
            {
                shape.Tag            = false;
                shape.StyleSheetName = "free";
                m_nFreeSeats++;
                m_nReservedSeats--;
                m_nRevenue -= 50;
            }
            else
            {
                shape.StyleSheetName = "reserved";
                m_nFreeSeats--;
                m_nReservedSeats++;
                m_nRevenue += 50;
            }

            UpdateTexts();
            view.Refresh();
        }
Exemplo n.º 3
0
        private void EventSinkService_NodeMouseDown(NNodeMouseEventArgs args)
        {
            // if left mouse down and node is shape -> focus it and stop bubbling and processing
            if (args.Button == MouseButtons.Left && (args.Node is NShape))
            {
                FocusShape(args.Node as NShape);

                // mark as handled and processed to stop bubbling and processing
                args.Handled   = true;
                args.Processed = markEventsAsProcessedCheck.Checked;
            }
        }
Exemplo n.º 4
0
        private void OnNodeMouseDown(NNodeMouseEventArgs args)
        {
            INNode node = args.Node;

            while (node != null && node is NShape == false)
            {
                node = node.ParentNode;
            }

            NShape shape = (NShape)node;

            args.Handled = true;

            if (document.Tag == null)
            {
                if (shape == null)
                {
                    return;
                }

                // The user has clicked a state
                document.Tag = shape;
                LoadStateMap(shape.Name);
                document.SizeToContent();
            }
            else
            {
                if (shape == null)
                {
                    // Return to the States map
                    document.Tag = null;
                    LoadUsaMap();
                    document.SizeToContent();
                }
                else
                {
                    if (shape.StyleSheetName == "ClickedCounty")
                    {
                        // The user has clicked a selected county - unselect it
                        shape.StyleSheetName = String.Empty;
                        shape.Text           = String.Empty;
                    }
                    else
                    {
                        // The user has clicked a non selected county - select it (make it red)
                        shape.StyleSheetName = "ClickedCounty";
                        shape.Text           = shape.Name;
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void EventSinkService_NodeMouseDown(NNodeMouseEventArgs args)
        {
            NTableCell cell = args.Node as NTableCell;

            if (cell == null)
            {
                return;
            }

            if (cell.ParentNode.ParentNode != table)
            {
                return;
            }

            if (cell.StyleSheetName != null && cell.StyleSheetName != string.Empty)
            {
                if (CellClicked(cell))
                {
                    UpdateInfo();

                    // Check for end of the game
                    string status = string.Empty;
                    if (AllClear())
                    {
                        score *= 2;
                        status = "Congratulations you've cleared all cells !!!" + Environment.NewLine;
                    }

                    if (status == string.Empty && GameOver())
                    {
                        status = "Game Over !" + Environment.NewLine;
                    }

                    if (status != string.Empty)
                    {
                        status += "Your score is " + score.ToString();
                        MessageBox.Show(status);
                    }
                }
            }

            args.Handled = true;
        }
Exemplo n.º 6
0
        private void document_MouseMove(NNodeMouseEventArgs args)
        {
            NPointF point = args.ScenePoint;

            lblX.Text = point.X.ToString();
            lblY.Text = point.Y.ToString();

            try
            {
                // Get the inverted point for the current projection
                point = m_MapImporter.Projection.DeprojectPoint(point);
            }
            catch
            {
                lblLongitude.Text = "Not Available";
                lblLattitude.Text = "Not Available";
                return;
            }

            // Check if the longitude or the lattitude are out of bounds
            if (point.X < -180)
            {
                point.X = -180;
            }
            else if (point.X > 180)
            {
                point.X = 180;
            }

            if (point.Y < -90)
            {
                point.Y = -90;
            }
            else if (point.Y > 90)
            {
                point.Y = 90;
            }

            lblLongitude.Text = point.X.ToString("F3");
            lblLattitude.Text = point.Y.ToString("F3");
        }
Exemplo n.º 7
0
        private void EventSinkService_NodeMouseUp(NNodeMouseEventArgs args)
        {
            // if right mouse up and node is active layer child -> show message box and stop bubbling and processing
            if (args.Button == MouseButtons.Right && (args.Node.ParentNode == document.ActiveLayer))
            {
                PointF viewCoordinates  = new PointF(args.X, args.Y);
                PointF sceneCoordinates = view.SceneToWorld.InvertPoint(viewCoordinates);

                MessageBox.Show(string.Format(
                                    "Mouse up event data\nNode: {0};\nView coordinates: (in px) {1};\nScene coordinates: (in {2}) {3};\nMouse Button: {4}.",
                                    (args.Node as INDiagramElement).Name,
                                    viewCoordinates.ToString(),
                                    document.MeasurementUnit.Abbreviation,
                                    sceneCoordinates.ToString(),
                                    args.Button.ToString()
                                    ));

                // mark as handled and processed to stop bubbling and processing
                args.Handled   = true;
                args.Processed = markEventsAsProcessedCheck.Checked;
            }
        }