public KnotSaveConfirmDialog(GameScreen screen, WidgetInfo info, DisplayLayer drawOrder, Knot knot) : base(screen, info, drawOrder) { Info.RelativeSize = () => new Vector2 (0.500f, 0.250f); Info.RelativePadding = () => new Vector2 (0.016f, 0.016f); Text = new string[] { "Do you want to save the changes?" }; TextInput.InputText = knot.Name; string originalName = knot.Name; OnYesClick += () => { Console.WriteLine ("OnYesClick"); if (TextInput.InputText.Length == 0) { Console.WriteLine ("Name is empty!"); CanClose = false; } else if (originalName.Length > 0 && originalName == TextInput.InputText) { Console.WriteLine ("Name has not been changed: " + TextInput.InputText); try { knot.Save (); } catch (IOException ex) { Console.WriteLine (ex); knot.Save (new KnotFileIO (), knot.MetaData.Filename); } CanClose = true; } else { Console.WriteLine ("Name has been changed: " + TextInput.InputText); try { knot.Name = TextInput.InputText; knot.Save (); } catch (IOException ex) { Console.WriteLine (ex); knot.Save (new KnotFileIO (), knot.MetaData.Filename); } CanClose = true; } if (CanClose) { screen.NextState = GameScreens.StartScreen; } }; OnNoClick += () => { Console.WriteLine ("OnNoClick"); screen.NextState = GameScreens.StartScreen; }; }