private bool SetConfiguration() { if (_soundChanged) { if (!_notifier.LoadSound(SoundPath.Text) && PlaysSound.Checked) { MessageBox.Show("音声ファイルの読み込みに失敗しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (_imageChanged) { if (!_notifier.DialogData.LoadImage(ImagePath.Text) && DrawsImage.Checked) { MessageBox.Show("画像ファイルの読み込みに失敗しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } //set configuration _notifier.IsEnabled = IsEnabled.Checked; _notifier.PlaysSound = PlaysSound.Checked; _notifier.DialogData.DrawsImage = DrawsImage.Checked; _notifier.ShowsDialog = ShowsDialog.Checked; _notifier.DialogData.TopMost = TopMostFlag.Checked; _notifier.DialogData.Alignment = (NotifierDialogAlignment)Alignment.SelectedIndex; _notifier.DialogData.Location = new Point((int)LocationX.Value, (int)LocationY.Value); _notifier.DialogData.DrawsMessage = DrawsMessage.Checked; _notifier.DialogData.HasFormBorder = HasFormBorder.Checked; _notifier.AccelInterval = (int)(AccelInterval.Value * 1000); _notifier.DialogData.ClosingInterval = (int)(ClosingInterval.Value * 1000); _notifier.DialogData.CloseOnMouseMove = CloseOnMouseOver.Checked; _notifier.DialogData.ForeColor = ForeColorPreview.ForeColor; _notifier.DialogData.BackColor = BackColorPreview.ForeColor; _notifier.DialogData.ShowWithActivation = ShowWithActivation.Checked; NotifierDamage ndmg = _notifier as NotifierDamage; if (ndmg != null) { ndmg.NotifiesBefore = NotifiesBefore.Checked; ndmg.NotifiesNow = NotifiesNow.Checked; ndmg.NotifiesAfter = NotifiesAfter.Checked; ndmg.ContainsNotLockedShip = ContainsNotLockedShip.Checked; ndmg.ContainsSafeShip = ContainsSafeShip.Checked; ndmg.ContainsFlagship = ContainsFlagship.Checked; ndmg.LevelBorder = (int)LevelBorder.Value; ndmg.NotifiesAtEndpoint = NotifiesAtEndpoint.Checked; } return(true); }
private bool SetConfiguration() { if (_soundChanged) { if (!_notifier.LoadSound(SoundPath.Text) && PlaysSound.Checked) { MessageBox.Show("音声ファイルの読み込みに失敗しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (_imageChanged) { if (!_notifier.DialogData.LoadImage(ImagePath.Text) && DrawsImage.Checked) { MessageBox.Show("画像ファイルの読み込みに失敗しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } //set configuration _notifier.IsEnabled = IsEnabled.Checked; _notifier.PlaysSound = PlaysSound.Checked; _notifier.DialogData.DrawsImage = DrawsImage.Checked; _notifier.SoundVolume = (int)SoundVolume.Value; _notifier.LoopsSound = LoopsSound.Checked; _notifier.ShowsDialog = ShowsDialog.Checked; _notifier.DialogData.TopMost = TopMostFlag.Checked; _notifier.DialogData.Alignment = (NotifierDialogAlignment)Alignment.SelectedIndex; _notifier.DialogData.Location = new Point((int)LocationX.Value, (int)LocationY.Value); _notifier.DialogData.DrawsMessage = DrawsMessage.Checked; _notifier.DialogData.HasFormBorder = HasFormBorder.Checked; _notifier.AccelInterval = (int)(AccelInterval.Value * 1000); _notifier.DialogData.ClosingInterval = (int)(ClosingInterval.Value * 1000); { int flag = 0; for (int i = 0; i < (int)NotifierDialogClickFlags.HighestBit; i++) { flag |= (CloseList.GetItemChecked(i) ? 1 : 0) << i; } _notifier.DialogData.ClickFlag = (NotifierDialogClickFlags)flag; } _notifier.DialogData.CloseOnMouseMove = CloseList.GetItemChecked((int)NotifierDialogClickFlags.HighestBit); _notifier.DialogData.ForeColor = ForeColorPreview.ForeColor; _notifier.DialogData.BackColor = BackColorPreview.ForeColor; _notifier.DialogData.ShowWithActivation = ShowWithActivation.Checked; var ndmg = _notifier as NotifierDamage; if (ndmg != null) { ndmg.NotifiesBefore = NotifiesBefore.Checked; ndmg.NotifiesNow = NotifiesNow.Checked; ndmg.NotifiesAfter = NotifiesAfter.Checked; ndmg.ContainsNotLockedShip = ContainsNotLockedShip.Checked; ndmg.ContainsSafeShip = ContainsSafeShip.Checked; ndmg.ContainsFlagship = ContainsFlagship.Checked; ndmg.LevelBorder = (int)LevelBorder.Value; ndmg.NotifiesAtEndpoint = NotifiesAtEndpoint.Checked; } var nanc = _notifier as NotifierAnchorageRepair; if (nanc != null) { nanc.NotificationLevel = AnchorageRepairNotificationLevel.SelectedIndex; } return(true); }