@@ -7,54 +7,49 @@ namespace Cloaks
77{
88 public partial class DialogueBox : Window
99 {
10- private Action < bool > callback ;
1110 private string title ;
1211 private string message ;
1312 private bool error ;
1413 private MainWindow main ;
1514 private bool eula ;
1615
17- private DialogueBox ( string title , string message , bool error , Action < bool > callback , MainWindow main , bool eula )
16+ private bool result ;
17+
18+ private DialogueBox ( string title , string message , bool error , MainWindow main , bool eula )
1819 {
1920 this . title = title ;
2021 this . message = message ;
2122 this . error = error ;
22- this . callback = callback ;
2323 this . main = main ;
2424 this . eula = eula ;
2525
2626 InitializeComponent ( ) ;
2727 Hide ( ) ;
2828 }
2929
30- public static void Show ( string title , string message , MainWindow main )
30+ public static bool Show ( string title , string message , MainWindow main )
3131 {
32-
33- new DialogueBox ( title , message , false , null , main , false ) . ShowDialog ( ) ;
34- }
3532
36- public static void ShowWithCallback ( string title , string message , Action < bool > callback , MainWindow main )
37- {
38-
39- new DialogueBox ( title , message , false , callback , main , false ) . ShowDialog ( ) ;
40- }
33+ DialogueBox w = new DialogueBox ( title , message , false , main , false ) ;
34+ w . ShowDialog ( ) ;
4135
42- public static void ShowError ( string title , string message , MainWindow main )
43- {
44-
45- new DialogueBox ( title , message , true , null , main , false ) . ShowDialog ( ) ;
36+ return w . result ;
4637 }
4738
48- public static void ShowErrorWithCallback ( string title , string message , Action < bool > callback , MainWindow main )
39+ public static bool ShowError ( string title , string message , MainWindow main )
4940 {
50-
51- new DialogueBox ( title , message , true , callback , main , false ) . ShowDialog ( ) ;
41+ DialogueBox w = new DialogueBox ( title , message , true , main , false ) ;
42+ w . ShowDialog ( ) ;
43+
44+ return w . result ;
5245 }
5346
54- public static void ShowEULA ( Action < bool > callback , MainWindow main )
47+ public static bool ShowEULA ( MainWindow main )
5548 {
56-
57- new DialogueBox ( "Cloaks+ End User License Agreement" , @"By clicking 'I Agree' below, you agree to the Cloaks+ End User License Agreement. To view the contents of the agreement, click the 'EULA' button below." , false , callback , main , true ) . ShowDialog ( ) ;
49+ DialogueBox w = new DialogueBox ( "Cloaks+ End User License Agreement" , @"By clicking 'I Agree' below, you agree to the Cloaks+ End User License Agreement. To view the contents of the agreement, click the 'EULA' button below." , false , main , true ) ;
50+ w . ShowDialog ( ) ;
51+
52+ return w . result ;
5853 }
5954
6055 private void Box_Loaded ( object sender , RoutedEventArgs e )
@@ -100,15 +95,16 @@ private void OKButton_Click(object sender, RoutedEventArgs e)
10095
10196 private void CloseDialogue ( bool result )
10297 {
103- Close ( ) ;
98+ this . result = result ;
99+
104100 try
105101 {
106102 main . Show ( ) ;
107103 main . Activate ( ) ;
108104 }
109105 catch ( Exception ) { } ;
110106
111- callback ? . Invoke ( result ) ;
107+ Close ( ) ;
112108 }
113109
114110 private void EULAButton_Click ( object sender , RoutedEventArgs e )
0 commit comments