Exemplo n.º 1
0
        //Determines user intent by checking location of drop against threshold and whether a clone exists (i.e. drag intent)
        private void Part_ContainerManipulationCompleted(object sender, ContainerManipulationCompletedEventArgs e)
        {
            Part        p      = sender as Part;
            ScatterView parent = p.Parent as ScatterView;

            try
            {
                if (!(myClone == null))
                { //Clone has been created, indicating drag interaction
                    if (parent == null)
                    {
                        sw1.L0.L0_resultsSV.Items.Add(p);
                        p.PartInL0();
                        sw1.L0.L0_resultsSV.Items.Remove(p);
                    }
                    else
                    {
                        if (parent.Name == "L0_resultsSV")
                        { //Drops Part into L1
                            p.PartInL0();
                        }
                        else
                        { //Drops Part in L1Module
                            p.PartInL1();
                        }
                        parent.Items.Remove(p);
                    }
                }
                else
                {
                    if (parent == null)
                    {
                        return;        //In Primer Designer's StackPanel
                    }
                    Center = Original; //Reset center so non-drag interactions don't mess up positioning
                    if (parent.Name == "L1_prom" || parent.Name == "L1_rbs" || parent.Name == "L1_cds" || parent.Name == "L1_term")
                    {                  //If in an L1 palette
                        if (p.BorderBrush != Brushes.Gray)
                        {
                            //Restore original border
                            p.BorderBrush = Brushes.Gray;
                        }
                        else
                        {
                            p.BorderBrush = Brushes.Navy;
                        } //highlights border
                    }
                }
            }
            catch (Exception exc) { Console.WriteLine("Part Completed \n" + exc); }
        }