async public void MoveMF(string elmName) { Globals.i_correct = Globals.i_correct + 1; LayoutView layoutView = LayoutView.Active; Layout layout = layoutView.Layout; if (elmName == "Rectangle 1") { MapFrame mf1 = layout.FindElement("MF1") as MapFrame; await QueuedTask.Run(() => mf1.SetX(4)); await QueuedTask.Run(() => mf1.SetY(0.5)); } if (elmName == "Rectangle 2") { MapFrame mf2 = layout.FindElement("MF2") as MapFrame; await QueuedTask.Run(() => mf2.SetX(7)); await QueuedTask.Run(() => mf2.SetY(0.5)); } if (elmName == "Rectangle 3") { MapFrame mf3 = layout.FindElement("MF3") as MapFrame; await QueuedTask.Run(() => mf3.SetX(10)); await QueuedTask.Run(() => mf3.SetY(0.5)); } if (elmName == "Rectangle 4") { MapFrame mf4 = layout.FindElement("MF4") as MapFrame; await QueuedTask.Run(() => mf4.SetX(10)); await QueuedTask.Run(() => mf4.SetY(3.5)); } if (elmName == "Rectangle 5") { MapFrame mf5 = layout.FindElement("MF5") as MapFrame; await QueuedTask.Run(() => mf5.SetX(7)); await QueuedTask.Run(() => mf5.SetY(3.5)); } if (elmName == "Rectangle 6") { MapFrame mf6 = layout.FindElement("MF6") as MapFrame; await QueuedTask.Run(() => mf6.SetX(4)); await QueuedTask.Run(() => mf6.SetY(3.5)); } TextElement statusText = layout.FindElement("Status") as TextElement; TextProperties statusProp = statusText.TextProperties; if (Globals.i_correct == 1) { statusProp.Text = "Nice job! You got " + Globals.i_correct.ToString() + " correct out of " + Globals.i_guesses + " attempt."; } else { statusProp.Text = "Nice job! You got " + Globals.i_correct.ToString() + " correct out of " + Globals.i_guesses + " attempts."; } await QueuedTask.Run(() => statusText.SetTextProperties(statusProp)); if (Globals.i_correct == 6) //YOU WIN { statusProp.Text = "GAME OVER! You got " + Globals.i_correct.ToString() + " correct out of " + Globals.i_guesses + " attempts."; await QueuedTask.Run(() => statusText.SetTextProperties(statusProp)); //Turn off rectangles GraphicElement rec1 = layout.FindElement("Rectangle 1") as GraphicElement; await QueuedTask.Run(() => rec1.SetVisible(false)); GraphicElement rec2 = layout.FindElement("Rectangle 2") as GraphicElement; await QueuedTask.Run(() => rec2.SetVisible(false)); GraphicElement rec3 = layout.FindElement("Rectangle 3") as GraphicElement; await QueuedTask.Run(() => rec3.SetVisible(false)); GraphicElement rec4 = layout.FindElement("Rectangle 4") as GraphicElement; await QueuedTask.Run(() => rec4.SetVisible(false)); GraphicElement rec5 = layout.FindElement("Rectangle 5") as GraphicElement; await QueuedTask.Run(() => rec5.SetVisible(false)); GraphicElement rec6 = layout.FindElement("Rectangle 6") as GraphicElement; await QueuedTask.Run(() => rec6.SetVisible(false)); //Toggle MFs MapFrame mf1 = layout.FindElement("MF1") as MapFrame; await QueuedTask.Run(() => mf1.SetVisible(false)); MapFrame mf2 = layout.FindElement("MF2") as MapFrame; await QueuedTask.Run(() => mf2.SetVisible(false)); MapFrame mf3 = layout.FindElement("MF3") as MapFrame; await QueuedTask.Run(() => mf3.SetVisible(false)); MapFrame mf4 = layout.FindElement("MF4") as MapFrame; await QueuedTask.Run(() => mf4.SetVisible(false)); MapFrame mf5 = layout.FindElement("MF5") as MapFrame; await QueuedTask.Run(() => mf5.SetVisible(false)); MapFrame mf6 = layout.FindElement("MF6") as MapFrame; await QueuedTask.Run(() => mf6.SetVisible(false)); MapFrame mainMF = layout.FindElement("Main MF") as MapFrame; await QueuedTask.Run(() => mainMF.SetVisible(true)); //Update title TextElement titleText = layout.FindElement("Title") as TextElement; TextProperties titleProp = titleText.TextProperties; titleProp.Text = "Not any more!"; await QueuedTask.Run(() => titleText.SetTextProperties(titleProp)); //New Game TextElement instrText = layout.FindElement("Instructions") as TextElement; TextProperties instrProp = instrText.TextProperties; instrProp.Text = "<bol>Instructions: </bol> " + "\n\n\n\n\n\n\n\n\n - Click the 'New Game' command if you want to play again."; await QueuedTask.Run(() => instrText.SetTextProperties(instrProp)); //Zoomto finished puzzle area Coordinate2D ll = new Coordinate2D(3, 0); Coordinate2D ur = new Coordinate2D(14, 7.5); await QueuedTask.Run(() => { Envelope env = EnvelopeBuilderEx.CreateEnvelope(ll, ur); layoutView.ZoomTo(env); }); //Turn off selection changed events Globals.selEvents = false; } }