private void mulaiButton_Click(object sender, RoutedEventArgs e) { //Check idSenjata Boolean idSenjataCheck = true; foreach (Prajurit prajurit in prajurits) { if (prajurit.senjata == null) { MessageBoxResult result = MessageBox.Show("Belum prajurit memiliki senjata. Apakah ingin melanjutkan?", "Konfirmasi", MessageBoxButton.YesNo); idSenjataCheck = result == MessageBoxResult.Yes; break; } } if (idSenjataCheck == true) { //check checkbox value mapDrawer.setVisibility(showACheckBox.IsChecked.Value, showBCheckBox.IsChecked.Value); prajuritDatabase.saveNamesToDatabase(prajurits); pendaftaranButton.IsEnabled = false; mulaiButton.IsEnabled = false; akhiriButton.IsEnabled = true; pesertaDataGrid.IsEnabled = false; liveGameController.startExercise(); } }
public MainWindow() { //Change locale US (make sure language in application) CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US"); XmlLanguage lang = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(lang)); FrameworkContentElement.LanguageProperty.OverrideMetadata(typeof(System.Windows.Documents.TextElement), new FrameworkPropertyMetadata(lang)); InitializeComponent(); logger = LogManager.GetCurrentClassLogger(); prajuritDatabase = new PrajuritDatabase(); prajurits = new List <Prajurit>(); pesertaDataGrid.DataContext = prajurits; senjatas = new Dictionary <int, Senjata>(); recorder = new EventsRecorder(); liveGameController = new LiveGameController(this); replayController = new ReplayGameController(this); watchController = new WatchGameController(this); mapDrawer = new MapDrawer(map, prajurits); mapDrawer.setVisibility(showACheckBox.IsChecked.Value, showBCheckBox.IsChecked.Value); //check checkbox Tim }