public DialogConfigurationNotifier(NotifierBase notifier) { InitializeComponent(); _notifier = notifier; //init base _soundChanged = false; _imageChanged = false; GroupSound.AllowDrop = true; GroupImage.AllowDrop = true; //init from data IsEnabled.Checked = notifier.IsEnabled; PlaysSound.Checked = notifier.PlaysSound; SoundPath.Text = notifier.SoundPath; DrawsImage.Checked = notifier.DialogData.DrawsImage; ImagePath.Text = notifier.DialogData.ImagePath; ShowsDialog.Checked = notifier.ShowsDialog; TopMostFlag.Checked = notifier.DialogData.TopMost; Alignment.SelectedIndex = (int)notifier.DialogData.Alignment; LocationX.Value = notifier.DialogData.Location.X; LocationY.Value = notifier.DialogData.Location.Y; DrawsMessage.Checked = notifier.DialogData.DrawsMessage; HasFormBorder.Checked = notifier.DialogData.HasFormBorder; AccelInterval.Value = notifier.AccelInterval / 1000; ClosingInterval.Value = notifier.DialogData.ClosingInterval / 1000; CloseOnMouseOver.Checked = notifier.DialogData.CloseOnMouseMove; ShowWithActivation.Checked = notifier.DialogData.ShowWithActivation; ForeColorPreview.ForeColor = notifier.DialogData.ForeColor; BackColorPreview.ForeColor = notifier.DialogData.BackColor; NotifierDamage ndmg = notifier as NotifierDamage; if (ndmg != null) { NotifiesBefore.Checked = ndmg.NotifiesBefore; NotifiesNow.Checked = ndmg.NotifiesNow; NotifiesAfter.Checked = ndmg.NotifiesAfter; ContainsNotLockedShip.Checked = ndmg.ContainsNotLockedShip; ContainsSafeShip.Checked = ndmg.ContainsSafeShip; ContainsFlagship.Checked = ndmg.ContainsFlagship; LevelBorder.Value = ndmg.LevelBorder; NotifiesAtEndpoint.Checked = ndmg.NotifiesAtEndpoint; } else { GroupDamage.Visible = false; GroupDamage.Enabled = false; } }
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); }
public DialogConfigurationNotifier(NotifierBase notifier) { InitializeComponent(); _notifier = notifier; //init base _soundChanged = false; _imageChanged = false; GroupSound.AllowDrop = true; GroupImage.AllowDrop = true; //init from data IsEnabled.Checked = notifier.IsEnabled; PlaysSound.Checked = notifier.PlaysSound; SoundPath.Text = notifier.SoundPath; SoundVolume.Value = notifier.SoundVolume; LoopsSound.Checked = notifier.LoopsSound; DrawsImage.Checked = notifier.DialogData.DrawsImage; ImagePath.Text = notifier.DialogData.ImagePath; ShowsDialog.Checked = notifier.ShowsDialog; TopMostFlag.Checked = notifier.DialogData.TopMost; Alignment.SelectedIndex = (int)notifier.DialogData.Alignment; LocationX.Value = notifier.DialogData.Location.X; LocationY.Value = notifier.DialogData.Location.Y; DrawsMessage.Checked = notifier.DialogData.DrawsMessage; HasFormBorder.Checked = notifier.DialogData.HasFormBorder; AccelInterval.Value = notifier.AccelInterval / 1000; ClosingInterval.Value = notifier.DialogData.ClosingInterval / 1000; for (int i = 0; i < (int)NotifierDialogClickFlags.HighestBit; i++) { CloseList.SetItemChecked(i, ((int)notifier.DialogData.ClickFlag & (1 << i)) != 0); } CloseList.SetItemChecked((int)NotifierDialogClickFlags.HighestBit, notifier.DialogData.CloseOnMouseMove); ShowWithActivation.Checked = notifier.DialogData.ShowWithActivation; ForeColorPreview.ForeColor = notifier.DialogData.ForeColor; BackColorPreview.ForeColor = notifier.DialogData.BackColor; LevelBorder.Maximum = ExpTable.ShipMaximumLevel; NotifierDamage ndmg = notifier as NotifierDamage; if (ndmg != null) { NotifiesBefore.Checked = ndmg.NotifiesBefore; NotifiesNow.Checked = ndmg.NotifiesNow; NotifiesAfter.Checked = ndmg.NotifiesAfter; ContainsNotLockedShip.Checked = ndmg.ContainsNotLockedShip; ContainsSafeShip.Checked = ndmg.ContainsSafeShip; ContainsFlagship.Checked = ndmg.ContainsFlagship; LevelBorder.Value = ndmg.LevelBorder; NotifiesAtEndpoint.Checked = ndmg.NotifiesAtEndpoint; } else { GroupDamage.Visible = false; GroupDamage.Enabled = false; } NotifierAnchorageRepair nanc = notifier as NotifierAnchorageRepair; if (nanc != null) { AnchorageRepairNotificationLevel.SelectedIndex = nanc.NotificationLevel; } else { GroupAnchorageRepair.Visible = false; GroupAnchorageRepair.Enabled = false; } DialogOpenSound.Filter = "音楽ファイル|" + string.Join(";", Utility.MediaPlayer.SupportedExtensions.Select(s => "*." + s)) + "|File|*"; }
private bool SetConfiguration() { if (_soundChanged) { if (!_notifier.LoadSound(SoundPath.Text) && PlaysSound.Checked) { MessageBox.Show(NotifyRes.FailedLoadSound, ConfigRes.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (_imageChanged) { if (!_notifier.DialogData.LoadImage(ImagePath.Text) && DrawsImage.Checked) { MessageBox.Show(NotifyRes.FailedLoadImage, ConfigRes.Error, 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; 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); }