//Constructor: Primer Designer launched by a Part public PrimerDesigner2(Part p) { InitializeComponent(); Sites.pd2 = this; Part.pd2 = this; L1Module.pd2 = this; L2Module.pd2 = this; PrimerDesigner1.pd2 = this; SurfaceWindow1.pd2 = this; //_moduleNum = 0; //launced by Part PD2_auto.Children.Add(new Sites()); //PD2_manual.Children.Add(new Sites()); //remove duplicate fusion sites addPartSiteSets(PD2_auto, p, true); addPartSiteSets(PD2_manual, p, true); 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 }
//Constructor: Primer Designer launched by a Part public PrimerDesigner2(Part p) { InitializeComponent(); Sites.pd2 = this; Part.pd2 = this; L1Module.pd2 = this; L2Module.pd2 = this; PrimerDesigner1.pd2 = this; SurfaceWindow1.pd2 = this; PD2_auto.Children.Add(new Sites()); PD2_manual.Children.Add(new Sites()); 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); }
//Constructor helper: adds Parts and their fusion sites to panel private void addPartSiteSets(StackPanel parent, Part p) { Part copy = p.clone(); String seq1 = copy.SitesList.ElementAt(0).Sequence; String seq2 = copy.SitesList.ElementAt(1).Sequence; parent.Children.Add(new Sites(seq1)); copy.ElementMenu.Items.Remove(copy.PD); copy.BorderBrush = p.BorderBrush; copy.IsManipulationEnabled = false; parent.Children.Add(copy); parent.Children.Add(new Sites(seq2)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\L1Module.xaml" ((SurfaceApplication1.L1Module)(target)).ContainerManipulationStarted += new Microsoft.Surface.Presentation.Controls.ContainerManipulationStartedEventHandler(this.L1Module_ContainerManipulationStarted); #line default #line hidden #line 13 "..\..\L1Module.xaml" ((SurfaceApplication1.L1Module)(target)).ContainerManipulationDelta += new Microsoft.Surface.Presentation.Controls.ContainerManipulationDeltaEventHandler(this.L1Module_ContainerManipulationDelta); #line default #line hidden #line 14 "..\..\L1Module.xaml" ((SurfaceApplication1.L1Module)(target)).ContainerManipulationCompleted += new Microsoft.Surface.Presentation.Controls.ContainerManipulationCompletedEventHandler(this.L1Module_ContainerManipulationCompleted); #line default #line hidden return; case 2: this.L1Grid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.L1Prom = ((SurfaceApplication1.Part)(target)); return; case 4: this.L1RBS = ((SurfaceApplication1.Part)(target)); return; case 5: this.L1CDS = ((SurfaceApplication1.Part)(target)); return; case 6: this.L1Term = ((SurfaceApplication1.Part)(target)); return; case 7: this.Template = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.L1ElementMenu = ((Microsoft.Surface.Presentation.Controls.ElementMenu)(target)); return; case 9: #line 61 "..\..\L1Module.xaml" ((Microsoft.Surface.Presentation.Controls.ElementMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.select_Sequence); #line default #line hidden return; case 10: this.PD = ((Microsoft.Surface.Presentation.Controls.ElementMenuItem)(target)); #line 64 "..\..\L1Module.xaml" this.PD.Click += new System.Windows.RoutedEventHandler(this.select_PrimerDesigner); #line default #line hidden return; } this._contentLoaded = true; }
//Copies properties from the source Part to the receiver public void copyPartInfoFrom(Part source) { try { partName.Text = source.partName.Text; partCategory.Text = source.partCategory.Text; imgType.Source = source.imgType.Source; //Background = source.Background; _type = source._type; _myRegDS = source._myRegDS; _sitesList.Clear(); foreach (Sites s in source._sitesList) { _sitesList.Add(new Sites(s.Sequence)); } //_sitesList = source._sitesList; Opacity = source.Opacity; mySource = source; } catch (Exception exc) { Console.WriteLine(exc); } }
//Clones the part and copies content values and type //Used in both Part_ContainerManipulationDelta and _...Completed public Part clone() { Part copy = new Part(); copy.copyPartInfoFrom(this); return copy; }
//Differentiates ElementMenu interaction from drag/drop interaction //Once minimum distance met, create copy to leave in original spot private void Part_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e) { try { Point x = this.Center; if (Math.Abs(Original.Y - x.Y) > 20 || Math.Abs(Original.X - x.X) > 20) { Part p = sender as Part; myClone = p.clone(); myClone.Center = Original; //Put clone in original's place myClone.BorderBrush = p.BorderBrush; ScatterView parent = p.Parent as ScatterView; parent.Items.Add(myClone); if (parent.Name == "L0_resultsSV") { //Check if Level0 and give clone L0-appropriate behavior (e.g. dimming/disabling) myClone.Opacity = 0.5; //Visually indicate not selectable myClone.IsManipulationEnabled = false; //Disable manipulation until original's fate determined } else { //Moving Part from L1 parts holder to L1Module build tabs; needs to be in L1_SV during transfer p.changeParents_SV(parent, sw1.L1.L1_SV); } //Prevent it from continuously creating copies p.ContainerManipulationDelta -= Part_ContainerManipulationDelta; } } catch (Exception exc) { Console.WriteLine("Part Delta \n" + exc); } }
/// <summary> /// Constructor helper: adds Parts and their fusion sites to panel /// </summary> /// <param name="parent"></param> /// <param name="p"></param> /// <param name="isLevel0">Boolean flag implemented to indicate whether this method is called in class constructor via Level 0, 1, or 2 /// (to determine whether to add a second fusion site after Part -- deals with duplicate fusion site issue @T.Feng)</param> private void addPartSiteSets(StackPanel parent, Part p, bool isLevel0) { Part copy = p.clone(); String seq1 = copy.SitesList.ElementAt(0).Sequence; String seq2 = copy.SitesList.ElementAt(1).Sequence; parent.Children.Add(new Sites(seq1)); copy.ElementMenu.Items.Remove(copy.PD); copy.BorderBrush = p.BorderBrush; copy.IsManipulationEnabled = false; parent.Children.Add(copy); //only add fusion site for seq2 if in Level 0 (Part), else next Part's seq1 fusion site will do it @T.Feng if (isLevel0) parent.Children.Add(new Sites(seq2)); }
//Displays selected Part's PCR primers (no DV primers) private HitTestResultBehavior getIndexCallback(HitTestResult result) { //If StackPanel detected and is grandchild of a StackPanel (i.e. a set0 inside set1 inside showPanel) if (result.VisualHit.GetType() == typeof(StackPanel) && ((StackPanel)result.VisualHit).Parent.GetType() == typeof(StackPanel) && ((StackPanel)((StackPanel)result.VisualHit).Parent).Parent.GetType() == typeof(StackPanel)) { //Remove previous selection foreach (StackPanel sp1 in showPanel.Children) { foreach (StackPanel sp0 in sp1.Children) { sp0.Background = new SolidColorBrush(Colors.Transparent); } } //Highlight selected set0, get primerlist index, and write in primer data StackPanel set0 = (StackPanel)result.VisualHit; StackPanel set1 = (StackPanel)set0.Parent; int i = showPanel.Children.IndexOf(set1); int j = set1.Children.IndexOf(set0); int listIndex = i * 4 + j; showSetData(listIndex, _partPrimerList); set0.Background = new SolidColorBrush(Colors.WhiteSmoke); pcr.IsChecked = true; Part set0Part = new Part(); foreach (UIElement elem in set0.Children) { if (elem.GetType() == typeof(Part)) set0Part = (Part)elem; } //showSetData(i); //foreach (UIElement elem in testGrid.Children) //{ // if (elem.GetType() == typeof(Grid)) // { // Grid g = (Grid)elem; // foreach (UIElement e in g.Children) // { // if (e.GetType() == typeof(SurfaceCheckBox)) // { // ((SurfaceCheckBox)e).IsChecked = false; // } // if (e.GetType() == typeof(TextBlock)) // { // ((TextBlock)e).Text = "--"; // } // } // } //} return HitTestResultBehavior.Stop; } return HitTestResultBehavior.Continue; }