コード例 #1
0
        //Constructor: Primer Designer launched by an L2Module
        public PrimerDesigner2(L2Module l2)
        {
            InitializeComponent();
            Sites.pd2           = this;
            Part.pd2            = this;
            L1Module.pd2        = this;
            L2Module.pd2        = this;
            PrimerDesigner1.pd2 = this;

            //_moduleNum = 2; //launched by L2Module
            //_l2Modulel1Count = l2.Children.Count - 2; //Minus 2 for Element Menu and StackPanel, remaining are L1Modules

            //PD2_auto.Children.Add(new Sites());
            //PD2_manual.Children.Add(new Sites()); //remove duplicate fusion sites

            int forLoopCounter      = 0; //for keeping track of last part to add second fusion site in inner loop
            int lastL1ModuleCounter = 0; //to indicate when for loop is on last L1Module (so can add second fusion site), (l2.Children.Count - 1) to account for ElementMenu and Grid

            foreach (UIElement l1 in l2.Children)
            {
                if (l1.GetType() == typeof(L1Module))
                {
                    foreach (UIElement elem in ((L1Module)l1).L1Grid.Children)
                    {
                        if (elem.GetType() == typeof(Part))
                        {
                            Part p = (Part)elem;

                            if ((forLoopCounter == 3) && (lastL1ModuleCounter == l2.Children.Count - 1)) //4th Part of last L1Module being added, add second fusion site
                            {
                                addPartSiteSets(PD2_auto, p, true);
                                addPartSiteSets(PD2_manual, p, true);
                            }
                            else
                            {
                                addPartSiteSets(PD2_auto, p, false);
                                addPartSiteSets(PD2_manual, p, false);
                            }
                            forLoopCounter++;
                        }
                    }
                    forLoopCounter = 0; //reset inner loop counter
                }
                lastL1ModuleCounter++;
            }
            //PD2_auto.Children.Add(new Sites());
            // PD2_manual.Children.Add(new Sites()); //remove duplicate fusion sites

            //matchSites(PD2_auto);
            //matchSites(PD2_manual);

            //initializeFusionSiteChecker(); //initialize array to hold all possible fusion sites to be added
        }
コード例 #2
0
 //Assigns first L2Module found to global variable targetL2Module and stops HitTest
 public HitTestResultBehavior TargetL2MCallback(HitTestResult result)
 {
     if (result.VisualHit.GetType() == typeof(L2Module))
     {
         targetL2Module = result.VisualHit as L2Module;
         return(HitTestResultBehavior.Stop);
     }
     else
     {
         // Console.WriteLine("Didn't detect a grid.");
         return(HitTestResultBehavior.Continue);
     }
 }
コード例 #3
0
        private L2Module clone()
        {
            L2Module copy = new L2Module();

            foreach (UIElement l1 in this.Children)
            {
                if (l1.GetType() == typeof(L1Module))
                {
                    copy.Children.Add(((L1Module)l1).clone());
                }
            }
            return(copy);
        }
コード例 #4
0
        /// <summary>
        /// Generates and prints device permutations from all available parts.
        /// Obeys set permutation rules.
        /// </summary>
        /// <param name="?"></param>
        /// <param name="?"></param>
        /// <returns> All available device permutations from the parts given. </returns>

        public List <L2Module> Permute(List <L1Module> ListModulesToPermute)
        {
            List <L2Module> L2ModulesToReturn = new List <L2Module>();

            //Get current working directory
            string file = Directory.GetCurrentDirectory();

            //change directory to EugeneFiles directory and read text file based on ListModulesToPermute count
            file = file.Substring(0, file.IndexOf("bin")) + @"Resources\EugeneFiles\permute" + ListModulesToPermute.Count + ".txt";
            string       text = "";
            StreamReader sr   = new StreamReader(file);

            while (!sr.EndOfStream) //read to end of file
            {
                text = sr.ReadLine().ToString();
            }
            sr.Close();

            text = text.Replace("Device hybridDevice_", "");
            text = text.Replace("absDevice", "");
            //parsing text file and adding permutations to the L2 module
            string[] textminusparentheses = text.Split(new char[] { '(', ')' });

            foreach (string numberasstringcomma in textminusparentheses)
            {
                if (numberasstringcomma.Replace(" ", "").Length > 2 && !(numberasstringcomma.StartsWith(","))) //go through each individual permutation
                {
                    string[] permOrderArray = numberasstringcomma.Split(new char[] { ',' });
                    //clean--> to do
                    L2Module tempL2Module = new L2Module();
                    foreach (string permNumberString in permOrderArray)
                    {
                        int index = Convert.ToInt32(permNumberString) - 1;

                        L1Module childToAdd = ListModulesToPermute.ElementAt(index).clone();
                        childToAdd.IsManipulationEnabled = false;
                        //Disable manipulation and assoc. events
                        childToAdd.Background = sw1.L2.L1MColors.ElementAt(tempL2Module.Children.Count - 1);
                        //childToAdd.BorderBrush = childToAdd.Background;
                        tempL2Module.L2M.Children.Add(childToAdd);
                    }
                    L2ModulesToReturn.Add(tempL2Module);
                }
            }

            return(L2ModulesToReturn);
        }
コード例 #5
0
        /// <summary>
        /// Generates and prints device permutations from all available parts.  
        /// Obeys set permutation rules.
        /// </summary>
        /// <param name="?"></param>
        /// <param name="?"></param>
        /// <returns> All available device permutations from the parts given. </returns>
        public List<L2Module> Permute(List<L1Module> ListModulesToPermute)
        {
            List<L2Module> L2ModulesToReturn = new List<L2Module>();

            //Get current working directory
            string file = Directory.GetCurrentDirectory();
            //change directory to EugeneFiles directory and read text file based on ListModulesToPermute count
            file = file.Substring(0,file.IndexOf("bin")) + @"Resources\EugeneFiles\permute" + ListModulesToPermute.Count + ".txt";
            string text = "";
            StreamReader sr = new StreamReader(file);
            while (!sr.EndOfStream) //read to end of file
            {
                text = sr.ReadLine().ToString();
            }
            sr.Close();

            text = text.Replace("Device hybridDevice_", "");
            text = text.Replace("absDevice", "");
            //parsing text file and adding permutations to the L2 module
            string[] textminusparentheses = text.Split(new char[]{'(',')'});

            foreach (string numberasstringcomma in textminusparentheses)
            {
                if (numberasstringcomma.Replace(" ", "").Length > 2 && !(numberasstringcomma.StartsWith(","))) //go through each individual permutation
                {
                    string[] permOrderArray = numberasstringcomma.Split(new char[] { ',' });
                    //clean--> to do
                    L2Module tempL2Module = new L2Module();
                    foreach (string permNumberString in permOrderArray)
                    {
                        int index = Convert.ToInt32(permNumberString) -1;

                        L1Module childToAdd = ListModulesToPermute.ElementAt(index).clone();
                        childToAdd.IsManipulationEnabled = false;
                        //Disable manipulation and assoc. events
                        childToAdd.Background = sw1.L2.L1MColors.ElementAt(tempL2Module.Children.Count - 1);
                        //childToAdd.BorderBrush = childToAdd.Background;
                        tempL2Module.L2M.Children.Add(childToAdd);
                    }
                    L2ModulesToReturn.Add(tempL2Module);
                }

            }

            return L2ModulesToReturn;
        }
コード例 #6
0
        public Level2()
        {
            InitializeComponent();
            double parentHeight = 1080;
            double parentWidth  = 1920;

            this.Height = parentHeight - 150; //Height of all tabs together
            low.Y       = parentHeight - 50 + this.Height / 2;
            low.X       = parentWidth / 2;

            this.Center         = low;
            high                = low;
            high.Y              = high.Y - this.Height + 50; //50 for height of tabs?
            snapThreshold       = 200;
            snapThreshold_Level = 50;

            L2Module l2 = new L2Module();

            L2_manTab.Children.Add(l2);
        }
コード例 #7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.L2M = ((SurfaceApplication1.L2Module)(target));

            #line 13 "..\..\L2Module.xaml"
                this.L2M.PreviewTouchDown += new System.EventHandler <System.Windows.Input.TouchEventArgs>(this.L2M_PreviewTouchDown);

            #line default
            #line hidden

            #line 14 "..\..\L2Module.xaml"
                this.L2M.PreviewTouchUp += new System.EventHandler <System.Windows.Input.TouchEventArgs>(this.L2M_PreviewTouchUp);

            #line default
            #line hidden
                return;

            case 2:

            #line 32 "..\..\L2Module.xaml"
                ((Microsoft.Surface.Presentation.Controls.ElementMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.select_Sequence);

            #line default
            #line hidden
                return;

            case 3:
                this.PD = ((Microsoft.Surface.Presentation.Controls.ElementMenuItem)(target));

            #line 34 "..\..\L2Module.xaml"
                this.PD.Click += new System.Windows.RoutedEventHandler(this.select_PrimerDesigner);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
コード例 #8
0
        private void select_PrimerDesigner(object sender, RoutedEventArgs e)
        {
            //Iterate through parts and get data for each before entering Primer Designer
            foreach (UIElement elem in L2M.Children)
            {
                if (elem.GetType() == typeof(L1Module))
                {
                    L1Module l1 = (L1Module)elem;
                    foreach (UIElement p in l1.L1Grid.Children)
                    {
                        if (p.GetType() == typeof(Part))
                        {
                            ((Part)p).getDataForPrimerDesigner();
                        }
                    }
                }
            }
            L2Module copy = clone();

            copy.PD.IsEnabled  = false;
            copy.PD.Visibility = Visibility.Collapsed;
            sw1.SW_SV.Items.Add(new PrimerDesigner2(copy));
        }
コード例 #9
0
        //Constructor: Primer Designer launched by an L2Module
        public PrimerDesigner2(L2Module l2)
        {
            InitializeComponent();
            Sites.pd2 = this;
            Part.pd2 = this;
            L1Module.pd2 = this;
            L2Module.pd2 = this;
            PrimerDesigner1.pd2 = this;

            PD2_auto.Children.Add(new Sites());
            PD2_manual.Children.Add(new Sites());
            foreach (UIElement l1 in l2.Children)
            {
                if (l1.GetType() == typeof(L1Module))
                {
                    foreach (UIElement elem in ((L1Module)l1).L1Grid.Children)
                    {
                        if (elem.GetType() == typeof(Part))
                        {
                            Part p = (Part)elem;
                            addPartSiteSets(PD2_auto, p);
                            addPartSiteSets(PD2_manual, p);
                        }
                    }
                }
            }
            PD2_auto.Children.Add(new Sites());
            PD2_manual.Children.Add(new Sites());

            matchSites(PD2_auto);
            matchSites(PD2_manual);
        }
コード例 #10
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.L2M = ((SurfaceApplication1.L2Module)(target));
     
     #line 13 "..\..\L2Module.xaml"
     this.L2M.PreviewTouchDown += new System.EventHandler<System.Windows.Input.TouchEventArgs>(this.L2M_PreviewTouchDown);
     
     #line default
     #line hidden
     
     #line 14 "..\..\L2Module.xaml"
     this.L2M.PreviewTouchUp += new System.EventHandler<System.Windows.Input.TouchEventArgs>(this.L2M_PreviewTouchUp);
     
     #line default
     #line hidden
     return;
     case 2:
     
     #line 32 "..\..\L2Module.xaml"
     ((Microsoft.Surface.Presentation.Controls.ElementMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.select_Sequence);
     
     #line default
     #line hidden
     return;
     case 3:
     this.PD = ((Microsoft.Surface.Presentation.Controls.ElementMenuItem)(target));
     
     #line 34 "..\..\L2Module.xaml"
     this.PD.Click += new System.Windows.RoutedEventHandler(this.select_PrimerDesigner);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
コード例 #11
0
        //Testing out global variable checking with addition of new Parts
        private void partAdder_Click(object sender, RoutedEventArgs e)
        {
            L2Module l2 = new L2Module();

            L2_manTab.Children.Add(l2);
        }
コード例 #12
0
        //Constructor: Primer Designer launched by an L2Module
        public PrimerDesigner2(L2Module l2)
        {
            InitializeComponent();
            Sites.pd2 = this;
            Part.pd2 = this;
            L1Module.pd2 = this;
            L2Module.pd2 = this;
            PrimerDesigner1.pd2 = this;

            //_moduleNum = 2; //launched by L2Module
            //_l2Modulel1Count = l2.Children.Count - 2; //Minus 2 for Element Menu and StackPanel, remaining are L1Modules

            //PD2_auto.Children.Add(new Sites());
            //PD2_manual.Children.Add(new Sites()); //remove duplicate fusion sites

            int forLoopCounter = 0; //for keeping track of last part to add second fusion site in inner loop
            int lastL1ModuleCounter = 0; //to indicate when for loop is on last L1Module (so can add second fusion site), (l2.Children.Count - 1) to account for ElementMenu and Grid

            foreach (UIElement l1 in l2.Children)
            {
                if (l1.GetType() == typeof(L1Module))
                {
                    foreach (UIElement elem in ((L1Module)l1).L1Grid.Children)
                    {
                        if (elem.GetType() == typeof(Part))
                        {
                            Part p = (Part)elem;

                            if ((forLoopCounter == 3) && (lastL1ModuleCounter == l2.Children.Count - 1)) //4th Part of last L1Module being added, add second fusion site
                            {
                                addPartSiteSets(PD2_auto, p, true);
                                addPartSiteSets(PD2_manual, p, true);
                            }
                            else
                            {
                                addPartSiteSets(PD2_auto, p, false);
                                addPartSiteSets(PD2_manual, p, false);
                            }
                            forLoopCounter++;
                        }
                    }
                    forLoopCounter = 0; //reset inner loop counter
                }
                lastL1ModuleCounter++;

            }
            //PD2_auto.Children.Add(new Sites());
            // PD2_manual.Children.Add(new Sites()); //remove duplicate fusion sites

            //matchSites(PD2_auto);
            //matchSites(PD2_manual);

            //initializeFusionSiteChecker(); //initialize array to hold all possible fusion sites to be added
        }