Disable Next button if license agreement is not accepted.

Former-commit-id: 05edd66a34866e57b6966f9a2591da9e83df9268
This commit is contained in:
Scott Ehlert 2013-02-26 02:18:48 -06:00
parent ad46732e12
commit 52178abe4d
3 changed files with 38 additions and 2 deletions

View File

@ -298,8 +298,8 @@ consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
</TextBox>
<RadioButton Content="I accept the terms in the License Agreement" Height="16" HorizontalAlignment="Left" Margin="22,207,0,0" Name="radioButton1" VerticalAlignment="Top" GroupName="accept" />
<RadioButton Content="I do not accept the terms in the License Agreement" Height="16" HorizontalAlignment="Left" Margin="22,227,0,0" Name="radioButton2" VerticalAlignment="Top" GroupName="accept" IsChecked="True" />
<RadioButton Content="I accept the terms in the License Agreement" Height="16" HorizontalAlignment="Left" Margin="22,207,0,0" Name="agreeOption" VerticalAlignment="Top" GroupName="accept" Checked="agreeOption_Checked" />
<RadioButton Content="I do not accept the terms in the License Agreement" Height="16" HorizontalAlignment="Left" Margin="22,227,0,0" Name="disagreeOption" VerticalAlignment="Top" GroupName="accept" IsChecked="True" Checked="disagreeOption_Checked" />
</Grid>
</Grid>
</UserControl>

View File

@ -19,10 +19,38 @@ namespace installtool
/// </summary>
public partial class LicenseAccept : UserControl
{
public bool Accepted { get; private set; }
public static readonly RoutedEvent AgreementStateChangedEvent =
EventManager.RegisterRoutedEvent("AgreementStateChanged",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(LicenseAccept));
public LicenseAccept()
{
InitializeComponent();
license_.Text = license_.Text.Replace("&#10;&#13;", "");
}
public event RoutedEventHandler AgreementStateChanged
{
add { AddHandler(AgreementStateChangedEvent, value); }
remove { RemoveHandler(AgreementStateChangedEvent, value); }
}
private void agreeOption_Checked(object sender, RoutedEventArgs e)
{
RoutedEventArgs args = new RoutedEventArgs(AgreementStateChangedEvent);
Accepted = true;
RaiseEvent(args);
}
private void disagreeOption_Checked(object sender, RoutedEventArgs e)
{
RoutedEventArgs args = new RoutedEventArgs(AgreementStateChangedEvent);
Accepted = false;
RaiseEvent(args);
}
}
}

View File

@ -55,6 +55,7 @@ private void backButton__Click(object sender, RoutedEventArgs e)
}
backButton_.IsEnabled = currentPanel_ != welcomePanel_;
nextButton_.IsEnabled = currentPanel_ != licensePanel_;
}
private void nextButton__Click(object sender, RoutedEventArgs e)
@ -65,11 +66,18 @@ private void nextButton__Click(object sender, RoutedEventArgs e)
{
licensePanel_ = new LicenseAccept();
contentPanel_.Children.Add(licensePanel_);
licensePanel_.AgreementStateChanged += new RoutedEventHandler(licensePanel__AgreementStateChanged);
}
nextButton_.IsEnabled = licensePanel_.Accepted;
swap(licensePanel_);
}
backButton_.IsEnabled = true;
}
void licensePanel__AgreementStateChanged(object sender, RoutedEventArgs e)
{
nextButton_.IsEnabled = licensePanel_.Accepted;
}
}
}