//deserialisation gate public Gate LoadGate(XElement gate) { Gate abgate = CreateGate(gate); //l'emplacement //anchorpoint double x = double.Parse(gate.Element("anchorPoint").Attribute("X").Value, CultureInfo.InvariantCulture); double y = double.Parse(gate.Element("anchorPoint").Attribute("Y").Value, CultureInfo.InvariantCulture); abgate.anchorPoint = new Point(x, y); //transform point x = double.Parse(gate.Element("transform").Attribute("X").Value, CultureInfo.InvariantCulture); y = double.Parse(gate.Element("transform").Attribute("Y").Value, CultureInfo.InvariantCulture); abgate.transform.X += x; abgate.transform.Y += y; abgate.RenderTransform = abgate.transform; abgate.outil.id = int.Parse(gate.Attribute("ID").Value); int i = abgate.outil.getnbrentrees(), entree = int.Parse(gate.Attribute("Entree").Value); if (!(abgate is CircuitComplet)) {//norbre d'entrées mis à jour while (i < entree) { abgate.AddEntree(abgate.outil.GetType()); i++; } } if (abgate is CircuitComplet)//le cass d'un circuit personalisé { foreach (XElement element in gate.Element("Gates").Elements()) { Gate Cgate = LoadGate(element); Cgate.outil.end = bool.Parse(element.Attribute("end").Value); ((CircuitPersonnalise)abgate.outil).AddComponent(Cgate.outil); ((CircuitPersonnalise)abgate.outil).gates.Add(Cgate); } foreach (XElement element1 in gate.Element("Wires").Elements()) { Wire wire = LoadWire(element1, ((CircuitPersonnalise)abgate.outil)); ((CircuitPersonnalise)abgate.outil).wires.Add(wire); } foreach (XElement element2 in gate.Element("Entrees").Elements()) { int x0 = int.Parse(element2.Attribute("id").Value); int y0 = int.Parse(element2.Attribute("num").Value); ((CircuitPersonnalise)abgate.outil).Entrée.Add(new Point(x0, y0)); Gate gate1 = Recuplist(x0, ((CircuitPersonnalise)abgate.outil).gates); ClasseEntree classeEntree = gate1.outil.getListeentrees()[y0]; classeEntree.setDispo(Disposition.left); classeEntree.setRelated(false); ((Grid)(classeEntree.Parent)).Children.Remove(classeEntree); abgate.outil.AjoutEntree(classeEntree); abgate.getE_left().Insert(0, classeEntree); } foreach (XElement element3 in gate.Element("Sorties").Elements()) { int x1 = int.Parse(element3.Attribute("id").Value); int y1 = int.Parse(element3.Attribute("num").Value); ((CircuitPersonnalise)abgate.outil).Entrée.Add(new Point(x1, y1)); Gate gate2 = Recuplist(x1, ((CircuitPersonnalise)abgate.outil).gates); Sortie sortie = gate2.outil.getListesorties()[y1]; sortie.set_Sorties(new List <OutStruct>()); sortie.setDispo(Disposition.right); ((Grid)(sortie.Parent)).Children.Remove(sortie); abgate.outil.AjoutSortie(sortie); abgate.getS_right().Insert(0, sortie); } abgate.MAJ(); abgate.Creation(); abgate.MAJ_Path(); } return(abgate); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Outil = ((WpfApp2.Gate)(target)); return; case 2: this.OutilShape = ((System.Windows.Controls.Canvas)(target)); return; case 3: this.path = ((System.Windows.Shapes.Path)(target)); #line 14 "..\..\..\Graphique\Gate.xaml" this.path.MouseMove += new System.Windows.Input.MouseEventHandler(this.path_MouseMove); #line default #line hidden return; case 4: this.menu = ((System.Windows.Controls.ContextMenu)(target)); return; case 5: #line 17 "..\..\..\Graphique\Gate.xaml" ((System.Windows.Controls.ListBoxItem)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.AjouterEntrée); #line default #line hidden return; case 6: #line 18 "..\..\..\Graphique\Gate.xaml" ((System.Windows.Controls.ListBoxItem)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.SupprimerEntrée); #line default #line hidden return; case 7: #line 19 "..\..\..\Graphique\Gate.xaml" ((System.Windows.Controls.ListBoxItem)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.AjouterLabel); #line default #line hidden return; case 8: #line 20 "..\..\..\Graphique\Gate.xaml" ((System.Windows.Controls.ListBoxItem)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.Supprimer); #line default #line hidden return; case 9: this.TopGate = ((System.Windows.Controls.Grid)(target)); return; case 10: this.BottomGate = ((System.Windows.Controls.Grid)(target)); return; case 11: this.LeftGate = ((System.Windows.Controls.Grid)(target)); return; case 12: this.RightGate = ((System.Windows.Controls.Grid)(target)); return; } this._contentLoaded = true; }