/// <summary> /// Rotate chosen button, and check if the last 2 chosen buttons match /// </summary> /// <param name="button">The button to check</param> public void CheckMatch(MemoryButton button) { button.RotateButton(false); //If there is no chosen button, then this is the _currentButton if (_currentMemoryButton == null) { _currentMemoryButton = button; } //If there is a chosen button - Does his index and the new button's the same? else if (_currentMemoryButton.ButtonNumber == button.ButtonNumber) { if ((_matches += 2) >= _memoryButtons.Count) { MemoryGameWon(); } _currentMemoryButton = null; } //The indices of the chosen buttons don't match, rotate them and return. else { const float delay = 0.8f; button.RotateButton(false, 0.4f); _currentMemoryButton.RotateButton(false, 0.4f); _currentMemoryButton = null; StartCoroutine(DisableButtonColliders(delay)); } }
void OnMemoryFlyoutClosed(object sender, object args) { // Ideally, this would be renamed in the Closing event because the Closed event is too late. // Closing is not available until RS1+ so we set the name again here for TH2 support. AutomationProperties.SetName(MemoryButton, m_openMemoryFlyoutAutomationName); m_fIsMemoryFlyoutOpen = false; EnableControls(true); if (MemoryButton.IsEnabled) { MemoryButton.Focus(FocusState.Programmatic); } FullscreenFlyoutClosed(); }
//S'occupe de l'affichage des villes/departements selectionnes protected void rafraichirEmplacementAffiche() { Label lbltest = new Label(); Panel PNL_resultPanel = new Panel(); if (Parent.FindControl("LBL_nbre_bien") != null) { lbltest = (Label)Parent.FindControl("LBL_nbre_bien"); } if (Parent.FindControl("PNL_resultPanel") != null) { PNL_resultPanel = (Panel)Parent.FindControl("PNL_resultPanel"); } UpdatePanel4.Attributes.CssStyle[HtmlTextWriterStyle.Visibility] = "hidden"; if (emplacementAffiche.Count != 0) { lbltest.Visible = false; PNL_resultPanel.Visible = true; } if (Parent.FindControl("PNL_resultPanel") != null) { PNL_resultPanel = (Panel)Parent.FindControl("PNL_resultPanel"); } PNL_resultPanel.Controls.Clear(); int index = 0; if (emplacementAffiche != null) { foreach (Emplacement ville in emplacementAffiche) { PNL_resultPanel.Controls.Add(new LiteralControl("<div class='cell_lieu_suppr'><table><tr><td valign:'top'>")); MemoryButton boutonSuppr = new MemoryButton(); PNL_resultPanel.Controls.Add(boutonSuppr); boutonSuppr.code = ville.CodeINSEE; if (ville.IsContinent) { boutonSuppr.OnClientClick = "WM_setUnselected('" + ville.CodeINSEE + "')"; //fonction javascript } boutonSuppr.Click += new ImageClickEventHandler(supprimerVille); boutonSuppr.ID = index + "bouttonSuppr" + boutonSuppr.code; UpdatePanelControlTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = boutonSuppr.ID; UpdatePanel1.Triggers.Add(trigger); boutonSuppr.AlternateText = "suppr "; boutonSuppr.ImageUrl = @"~\img_site\bouton_supp_lieu_2.png"; PNL_resultPanel.Controls.Add(new LiteralControl("</td><td valign:'top'>")); //gestion affichage de l emplacement //nom Label labelNom = new Label(); labelNom.Text = "<strong>" + ville.Nom + "</strong>"; PNL_resultPanel.Controls.Add(labelNom); //CP(s) if (!ville.HasArrondissement && !ville.IsPays && !ville.IsContinent) { Label labelCP = new Label(); labelCP.Text = " " + ville.CP; PNL_resultPanel.Controls.Add(labelCP); } if (ville.HasDistance) { Label labelDistance = new Label(); labelDistance.Text = " (~ " + ville.Distance + " km)"; PNL_resultPanel.Controls.Add(labelDistance); } PNL_resultPanel.Controls.Add(new LiteralControl("</td></tr></table></div>")); if (ville.HasArrondissement) { foreach (Arrondissement arr in ville.ListeArrondissement) { PNL_resultPanel.Controls.Add(new LiteralControl("<div class='cell_lieu_suppr'><table><tr><td valign:'top'>")); //le boutton supprimer MemoryButton buttonsupprArrond = new MemoryButton(); PNL_resultPanel.Controls.Add(buttonsupprArrond); buttonsupprArrond.code = arr.CP; buttonsupprArrond.Click += new ImageClickEventHandler(ajouterArrondissementALaListeNoire); buttonsupprArrond.ID = index + "buttonsupprArrond" + buttonsupprArrond.code; UpdatePanelControlTrigger trigg = new AsyncPostBackTrigger(); trigg.ControlID = buttonsupprArrond.ID; UpdatePanel1.Triggers.Add(trigg); buttonsupprArrond.AlternateText = "suppr "; buttonsupprArrond.ImageUrl = @"~\img_site\bouton_supp_lieu_2.png"; PNL_resultPanel.Controls.Add(new LiteralControl("</td><td valign:'top'>")); //le cp Label labelCP = new Label(); labelCP.Text = arr.CP + " "; PNL_resultPanel.Controls.Add(labelCP); PNL_resultPanel.Controls.Add(new LiteralControl("</td></tr></table></div>")); } } index++; //if (!ville.HasArrondissement) } } rafraichirListeEmplacementRecherche(); }
private void PhysicalMemoryWindow1_Loaded(object sender, RoutedEventArgs e) { if (osParent != null) { if (osParent.WindowParent != null) { foreach (MemoryPage page in osParent.WindowParent.Memory.Pages) { MemoryButton b = new MemoryButton(page); b.Content = "Size: " + MemoryPage.PAGE_SIZE + " Frame Number: " + page.FrameNumber + "Start Offset: " + page.StartOffset + "PID: " + page.ProcessId; b.Width = lst_Pages.Width - 5; b.Height = lst_Pages.Height / 10; b.Click += delegate { MemoryWindow wind = new MemoryWindow(this, page); wind.Show(); }; lst_Pages.Items.Add((MemoryButton)b); } } else { MessageBox.Show("ERROR With window manager OSWin Please report this error to your tutor \n" + "The program will now terminate"); Environment.Exit(1); } } else if (utilisationParent != null) { if (utilisationParent.OsParent.WindowParent != null) { foreach (MemoryPage page in utilisationParent.OsParent.WindowParent.Memory.Pages) { MemoryButton b = new MemoryButton(page); b.Content = "Size: " + MemoryPage.PAGE_SIZE + " Frame Number: " + page.FrameNumber + "Start Offset: " + page.StartOffset + "PID: " + page.ProcessId; b.Width = lst_Pages.Width - 5; b.Height = lst_Pages.Height / 10; b.Click += delegate { MemoryWindow wind = new MemoryWindow(this, page); wind.Show(); }; lst_Pages.Items.Add((MemoryButton)b); } } else { MessageBox.Show("ERROR With window manager UtilWin Please report this error to your tutor \n" + "The program will now terminate"); Environment.Exit(1); } } else if (mainParent != null) { foreach (MemoryPage page in mainParent.Memory.Pages) { MemoryButton b = new MemoryButton(page); b.Content = "Size: " + MemoryPage.PAGE_SIZE + " Frame Number: " + page.FrameNumber + "Start Offset: " + page.StartOffset + "PID: " + page.ProcessId; b.Width = lst_Pages.Width - 5; b.Height = lst_Pages.Height / 10; b.Click += delegate { MemoryWindow wind = new MemoryWindow(this, page); wind.Show(); }; lst_Pages.Items.Add((MemoryButton)b); } } else { MessageBox.Show("ERROR With window manager MainWin Please report this error to your tutor \n" + "The program will now terminate"); Environment.Exit(1); } }
protected void rafraichirAffichageAvance() { //affichage listeRecherche TableSelectionAvance.Rows.Clear(); TableListeNoire.Rows.Clear(); if (listeVilleRecherche != null) { foreach (EmplacementRecherche ER in listeVilleRecherche) { TableRow ligne = new TableRow(); TableSelectionAvance.Rows.Add(ligne); TableCell cell1 = new TableCell(); ligne.Cells.Add(cell1); TableCell cell2 = new TableCell(); ligne.Cells.Add(cell2); TableCell cell3 = new TableCell(); ligne.Cells.Add(cell3); MemoryButton buttonsuppr = new MemoryButton(); buttonsuppr.AlternateText = "suppr "; buttonsuppr.ImageUrl = @"~\img_site\boutton_Supprimer.png"; buttonsuppr.code = ER.CodeINSEE; cell1.Controls.Add(buttonsuppr); buttonsuppr.ID = "btnsupprLA" + buttonsuppr.code; UpdatePanelControlTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = buttonsuppr.ID; UpdatePanel1.Triggers.Add(trigger); buttonsuppr.Click += new ImageClickEventHandler(AjouterALaListeNoire); Label labelNom = new Label(); labelNom.Text = ER.Nom; cell2.Controls.Add(labelNom); if (ER.HasArrondissement) { foreach (Arrondissement arr in ER.ListeArrondissement) { cell3.Controls.Add(new LiteralControl("<div class=\"AjoutacquereurCellulleListeVille\">")); //le boutton supprimer MemoryButton buttonsupprArrond = new MemoryButton(); cell3.Controls.Add(buttonsupprArrond); buttonsupprArrond.code = arr.CP; buttonsupprArrond.Click += new ImageClickEventHandler(ajouterArrondissementALaListeNoire); buttonsupprArrond.ID = ER.CodeINSEE + "buttonsupprArrond" + buttonsupprArrond.code; UpdatePanelControlTrigger trigg = new AsyncPostBackTrigger(); trigg.ControlID = buttonsupprArrond.ID; UpdatePanel1.Triggers.Add(trigg); buttonsupprArrond.AlternateText = "suppr "; buttonsupprArrond.ImageUrl = @"~\img_site\boutton_Supprimer.png"; //le cp Label labelCP = new Label(); labelCP.Text = arr.CP; cell3.Controls.Add(labelCP); cell3.Controls.Add(new LiteralControl("</div>")); } } else { Label labelCP = new Label(); labelCP.Text = ER.CP; cell3.Controls.Add(labelCP); } } } if (listeNoire != null) { //affichage liste noire foreach (EmplacementRecherche ER in listeNoire) { TableRow ligne = new TableRow(); TableListeNoire.Rows.Add(ligne); TableCell cell1 = new TableCell(); ligne.Cells.Add(cell1); TableCell cell2 = new TableCell(); ligne.Cells.Add(cell2); MemoryButton buttonsuppr = new MemoryButton(); buttonsuppr.AlternateText = "suppr "; buttonsuppr.ImageUrl = @"~\img_site\boutton_Supprimer.png"; buttonsuppr.code = ER.CodeINSEE; cell1.Controls.Add(buttonsuppr); buttonsuppr.ID = "btnsupprLN" + buttonsuppr.code; UpdatePanelControlTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = buttonsuppr.ID; UpdatePanel1.Triggers.Add(trigger); buttonsuppr.Click += new ImageClickEventHandler(RetirerDeLaListeNoire); Label label = new Label(); label.Text = ER.Nom + " | " + ER.CP; cell2.Controls.Add(label); } } }
protected void rafraichirEmplacementAffiche() { TableSelectionSimple.Rows.Clear(); int index = 0; if (emplacementAffiche != null) { foreach (Emplacement ville in emplacementAffiche) { TableRow row = new TableRow(); TableSelectionSimple.Rows.Add(row); TableCell cellPrincipale = new TableCell(); row.Controls.Add(cellPrincipale); Table tableVisible = new Table(); cellPrincipale.Controls.Add(tableVisible); TableRow rowUniqueVisible = new TableRow(); tableVisible.Controls.Add(rowUniqueVisible); TableCell cell1 = new TableCell(); rowUniqueVisible.Cells.Add(cell1); TableCell cell2 = new TableCell(); rowUniqueVisible.Cells.Add(cell2); TableCell cell3 = new TableCell(); rowUniqueVisible.Cells.Add(cell3); if (ville.ListeVille.Count > 1) { ImageButton bouttonAfficherDetail = new ImageButton(); bouttonAfficherDetail.ImageUrl = @"~\img_site\fleche_tri_bas.png"; bouttonAfficherDetail.ID = index + "bouttonaffichageDetail" + ville.CodeINSEE; cell1.Controls.Add(bouttonAfficherDetail); bouttonAfficherDetail.OnClientClick = "derouleDetaille(this); return false;"; ImageButton bouttonEffacerDetail = new ImageButton(); bouttonEffacerDetail.CssClass = "invisible"; bouttonEffacerDetail.ImageUrl = @"~\img_site\fleche_tri_haut.png"; bouttonEffacerDetail.ID = index + "bouttonEffacerDetail" + ville.CodeINSEE; cell1.Controls.Add(bouttonEffacerDetail); bouttonEffacerDetail.OnClientClick = "EnrouleDetaille(this); return false;"; } MemoryButton boutonSuppr = new MemoryButton(); cell1.Controls.Add(boutonSuppr); boutonSuppr.code = ville.CodeINSEE; boutonSuppr.Click += new ImageClickEventHandler(supprimerVille); boutonSuppr.ID = index + "bouttonSuppr" + boutonSuppr.code; UpdatePanelControlTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = boutonSuppr.ID; UpdatePanel1.Triggers.Add(trigger); boutonSuppr.AlternateText = "suppr "; boutonSuppr.ImageUrl = @"~\img_site\boutton_Supprimer.png"; //gestion affichage de l emplacement //nom Label labelNom = new Label(); labelNom.Text = ville.Nom; cell2.Controls.Add(labelNom); //CP(s) if (ville.HasArrondissement) { cell3.Controls.Add(new LiteralControl("<div class='contientCelluleArrondissement'>")); cell3.Controls.Add(new LiteralControl("<div class=\"celuleArrondissement\">")); foreach (Arrondissement arr in ville.ListeArrondissement) { cell3.Controls.Add(new LiteralControl("<div class=\"AjoutacquereurCellulleListeVille\">")); //le boutton supprimer MemoryButton buttonsupprArrond = new MemoryButton(); cell3.Controls.Add(buttonsupprArrond); buttonsupprArrond.code = arr.CP; buttonsupprArrond.Click += new ImageClickEventHandler(ajouterArrondissementALaListeNoire); buttonsupprArrond.ID = index + "buttonsupprArrond" + buttonsupprArrond.code; UpdatePanelControlTrigger trigg = new AsyncPostBackTrigger(); trigg.ControlID = buttonsupprArrond.ID; UpdatePanel1.Triggers.Add(trigg); buttonsupprArrond.AlternateText = "suppr "; buttonsupprArrond.ImageUrl = @"~\img_site\boutton_Supprimer.png"; //le cp Label labelCP = new Label(); labelCP.Text = arr.CP + " "; cell3.Controls.Add(labelCP); cell3.Controls.Add(new LiteralControl("</div>")); } cell3.Controls.Add(new LiteralControl("<div style='clear:both'></div>")); cell3.Controls.Add(new LiteralControl("</div>")); cell3.Controls.Add(new LiteralControl("</div>")); } else { Label labelCP = new Label(); labelCP.Text = " " + ville.CP; cell3.Controls.Add(labelCP); } //distance if (ville.HasDistance) { Label labelDistance = new Label(); labelDistance.Text = " (~ " + ville.Distance + " km)"; LiteralControl br = new LiteralControl("<br/>"); cell2.Controls.Add(br); cell2.Controls.Add(labelDistance); } index++; //liste detaillé pour cet emplacement Panel divListeInvisible = new Panel(); divListeInvisible.CssClass = "invisible AjoutacquereurScrollCellPetit teuteu"; divListeInvisible.ID = "teuteuInvisible" + ville.CodeINSEE; cellPrincipale.Controls.Add(divListeInvisible); Table tableSelectionIntermediaire = new Table(); divListeInvisible.Controls.Add(tableSelectionIntermediaire); //panneau detaillé caché par defaut foreach (EmplacementRecherche ER in ville.ListeVille) { TableRow ligne = new TableRow(); tableSelectionIntermediaire.Rows.Add(ligne); TableCell cellIntermediaire1 = new TableCell(); ligne.Cells.Add(cellIntermediaire1); TableCell cellIntermediaire2 = new TableCell(); ligne.Cells.Add(cellIntermediaire2); TableCell cellIntermediaire3 = new TableCell(); ligne.Cells.Add(cellIntermediaire3); MemoryButton buttonsuppr = new MemoryButton(); buttonsuppr.AlternateText = "suppr "; buttonsuppr.ImageUrl = @"~\img_site\boutton_Supprimer.png"; buttonsuppr.code = ER.CodeINSEE; cellIntermediaire1.Controls.Add(buttonsuppr); buttonsuppr.ID = ville.CodeINSEE + "btnsupprLI" + buttonsuppr.code; UpdatePanelControlTrigger triggerInter = new AsyncPostBackTrigger(); triggerInter.ControlID = buttonsuppr.ID; UpdatePanel1.Triggers.Add(triggerInter); buttonsuppr.Click += new ImageClickEventHandler(AjouterALaListeNoire); Label labelNomInter = new Label(); labelNomInter.Text = ER.Nom; cellIntermediaire2.Controls.Add(labelNomInter); if (ER.HasArrondissement) { cellIntermediaire3.Controls.Add(new LiteralControl("<div class='contientCelluleArrondissement'>")); cellIntermediaire3.Controls.Add(new LiteralControl("<div class=\"celuleArrondissement\">")); foreach (Arrondissement arr in ER.ListeArrondissement) { cellIntermediaire3.Controls.Add(new LiteralControl("<div class=\"AjoutacquereurCellulleListeVille\">")); //le boutton supprimer MemoryButton buttonsupprArrond = new MemoryButton(); cellIntermediaire3.Controls.Add(buttonsupprArrond); buttonsupprArrond.code = arr.CP; buttonsupprArrond.Click += new ImageClickEventHandler(ajouterArrondissementALaListeNoire); buttonsupprArrond.ID = ville.CodeINSEE + "et" + ER.CodeINSEE + "buttonsupprArrondIntermediaire" + buttonsupprArrond.code; UpdatePanelControlTrigger trigg = new AsyncPostBackTrigger(); trigg.ControlID = buttonsupprArrond.ID; UpdatePanel1.Triggers.Add(trigg); buttonsupprArrond.AlternateText = "suppr "; buttonsupprArrond.ImageUrl = @"~\img_site\boutton_Supprimer.png"; //le cp Label labelCP = new Label(); labelCP.Text = arr.CP; cellIntermediaire3.Controls.Add(labelCP); cellIntermediaire3.Controls.Add(new LiteralControl("</div>")); } cellIntermediaire3.Controls.Add(new LiteralControl("</div>")); cellIntermediaire3.Controls.Add(new LiteralControl("</div>")); } else { Label labelCP = new Label(); labelCP.Text = ER.CP; cellIntermediaire3.Controls.Add(labelCP); } } } } rafraichirListeEmplacementRecherche(); }