private void StartGame() { Serializer serializer = new Serializer(); SettingsState state = new SettingsState(); state.tidFortoning = numericUpDownTimeFade.Value; state.tidFoerFortoning = numericUpDownTimeNotification.Value; state.tidVist = NumericUpDownTimeShown.Value; state.tidVend = numericUpDownTimeTurn.Value; state.screen = (string)listBoxSkærme.SelectedItem; serializer.SerializeObject("settings.bin", state); if (listBoxSkærme.SelectedItem == null) { GlobalValues.currentScreen = Screen.AllScreens.First(s => s.Primary); } else { GlobalValues.currentScreen = Screen.AllScreens.First(s => s.DeviceName == listBoxSkærme.SelectedItem.ToString()); } this.Hide(); using (var game = new Vendespillet()) game.Run(); this.Show(); }
private void loadSettings() { Serializer serializer = new Serializer(); SettingsState state = serializer.DeSerializeObject("settings.bin"); if (state != null) { numericUpDownTimeFade.Value = state.tidFortoning; numericUpDownTimeNotification.Value = state.tidFoerFortoning; NumericUpDownTimeShown.Value = state.tidVist; numericUpDownTimeTurn.Value = state.tidVend; if (state.screen != null) { var it = listBoxSkærme.Items.GetEnumerator(); while (it.MoveNext()) { if (it.Current.ToString() == state.screen.ToString()) { listBoxSkærme.SelectedItem = it.Current; return; } } } } }