示例#1
0
        /// <summary>
        /// Here when we need to show our item comparison table.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnShowTable(object sender, EventArgs e)
        {
            // Stop our "hide" timer, in case it's already running
            hideTableTimer.Stop();

            // Set the contents of the table
            item1 = itemData.Find((byte)ComparedItem1.VisualizedTag.Value);
            item2 = itemData.Find((byte)ComparedItem2.VisualizedTag.Value);

            if (visualizationAxis.IsInverted)
            {
                Items.Item swap = item1;
                item1 = item2;
                item2 = swap;
            }
            Table.SetItems(itemData.Properties, item1, item2);

            // Hide the individual visualizations for our compared
            // objects, since we'll have the table to work with
            HideElement(ComparedItem1);
            HideElement(ComparedItem2);

            // Set the table's position and display it
            UpdateTablePosition();
            ShowElement(Table);
        }
示例#2
0
        /// <summary>
        /// Update the positioning of our comparison table.
        /// </summary>
        private void UpdateTablePosition()
        {
            // Don't do anything if VisualizationAxis is not active.
            if (visualizationAxis.IsActive)
            {
                // Adjust the table's width and height appropriately based on the distance
                // between the items.
                Debug.Assert(!Double.IsNaN(visualizationAxis.Length));
                Table.Width = 2 * tableHorizontalMargin + visualizationAxis.Length;
                Table.Height = visualizationAxis.Length;

                if (wasPreviouslyInverted != visualizationAxis.IsInverted)
                {
                    wasPreviouslyInverted = !wasPreviouslyInverted;

                    // flip table columns order.
                    Items.Item swap = item1;
                    item1 = item2;
                    item2 = swap;

                    Table.SetItems(itemData.Properties, item1, item2);
                }

                // Set its orientation and position
                Matrix matrix = Matrix.Identity;
                Debug.Assert(!Double.IsNaN(visualizationAxis.Orientation));
                matrix.Rotate(visualizationAxis.Orientation);
                matrix.Translate(-0.5 * Table.ActualWidth, -0.5 * Table.ActualHeight);
                Debug.Assert(!Double.IsNaN(visualizationAxis.Center.X) && !Double.IsNaN(visualizationAxis.Center.Y));
                matrix.Translate(visualizationAxis.Center.X, visualizationAxis.Center.Y);
                tableTransform.Matrix = matrix;
            }
        }