Esempio n. 1
0
        private void g_GPrimitive_Tapped(object sender, TappedRoutedEventArgs e)
        {
            GPrimitive g = sender as GPrimitive;
            if (g.ChildWireHandle != null)
            {
                CircuitCanvas.Children.Remove(g.ChildWireHandle);
                g.ChildWireHandle = null;
            }
            else
            {
                GWireHandle outputHandle = new GWireHandle();
                outputHandle.ParentPrimitive = g;
                g.ChildWireHandle = outputHandle;

                if (g.GateType == 5)
                {
                    CircuitCanvas.Children.Add(outputHandle);
                    Canvas.SetLeft(outputHandle, Canvas.GetLeft(g) + 55);
                    Canvas.SetTop(outputHandle, Canvas.GetTop(g) + 15);
                }
                else
                {
                    CircuitCanvas.Children.Add(outputHandle);
                    Canvas.SetLeft(outputHandle, Canvas.GetLeft(g) + 55);
                    Canvas.SetTop(outputHandle, Canvas.GetTop(g) + 15);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Show the i/o clickzones on pointer enter
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void g_GPrimitive_PointerEntered(object sender, PointerRoutedEventArgs e)
        {
            GPrimitive g = sender as GPrimitive;
            GWireHandle outputHandle = new GWireHandle();
            outputHandle.PointerEntered += outputHandle_PointerEntered;
            outputHandle.PointerExited += outputHandle_PointerExited;
            outputHandle.ManipulationStarted += outputHandle_ManipulationStarted;
            outputHandle.ManipulationDelta += outputHandle_ManipulationDelta;
            outputHandle.ManipulationCompleted += outputHandle_ManipulationCompleted;
            outputHandle.ParentPrimitive = g;
            g.ChildWireHandle = outputHandle;

            if (g.GateType == 5)
            {
                CircuitCanvas.Children.Add(outputHandle);
                Canvas.SetLeft(outputHandle, Canvas.GetLeft(g) + 55);
                Canvas.SetTop(outputHandle, Canvas.GetTop(g) + 15);
            }
            else
            {
                CircuitCanvas.Children.Add(outputHandle);
                Canvas.SetLeft(outputHandle, Canvas.GetLeft(g) + 55);
                Canvas.SetTop(outputHandle, Canvas.GetTop(g) + 15);
            }
        }