private void buttonNewOverlay_Click(object sender, EventArgs e) { var newOverlayDialog = new NewOverlayDialog(pluginMain); newOverlayDialog.NameValidator = (name) => { // 空もしくは空白文字のみの名前は許容しない if (string.IsNullOrWhiteSpace(name)) { MessageBox.Show("Name must not be empty or white space only."); return(false); } // 名前の重複も許容しない else if (config.Overlays.Where(x => x.Name == name).Any()) { MessageBox.Show("Name should be unique."); return(false); } else { return(true); } }; if (newOverlayDialog.ShowDialog(this.ParentForm) == DialogResult.OK) { if (this.tabControl.TabCount == 1 && this.tabControl.TabPages[0].Equals(this.tabPageMain)) { this.tabControl.TabPages.Remove(this.tabPageMain); } CreateAndRegisterOverlay(newOverlayDialog.SelectedOverlayType, newOverlayDialog.OverlayName); } newOverlayDialog.Dispose(); }
private void buttonNewOverlay_Click(object sender, EventArgs e) { var newOverlayDialog = new NewOverlayDialog(_container); newOverlayDialog.NameValidator = (name) => { // 空もしくは空白文字のみの名前は許容しない if (string.IsNullOrWhiteSpace(name)) { MessageBox.Show(Resources.ErrorOverlayNameEmpty); return(false); } // 名前の重複も許容しない else if (_config.Overlays.Where(x => x.Name == name).Any()) { MessageBox.Show(Resources.ErrorOverlayNameNotUnique); return(false); } else { return(true); } }; if (newOverlayDialog.ShowDialog(this.ParentForm) == DialogResult.OK) { if (this.tabControl.TabCount == 1 && this.tabControl.TabPages[0].Equals(this.tabPageMain)) { this.tabControl.TabPages.Remove(this.tabPageMain); } CreateAndRegisterOverlay(newOverlayDialog.SelectedOverlay); } newOverlayDialog.Dispose(); }
private void buttonNewOverlay_Click(object sender, EventArgs e) { var newOverlayDialog = new NewOverlayDialog(pluginMain); newOverlayDialog.NameValidator = (name) => { // 空もしくは空白文字のみの名前は許容しない if (string.IsNullOrWhiteSpace(name)) { MessageBox.Show("Name must not be empty or white space only."); return false; } // 名前の重複も許容しない else if (config.Overlays.Where(x => x.Name == name).Any()) { MessageBox.Show("Name should be unique."); return false; } else { return true; } }; if (newOverlayDialog.ShowDialog(this.ParentForm) == DialogResult.OK) { CreateAndRegisterOverlay(newOverlayDialog.SelectedOverlayType, newOverlayDialog.OverlayName); } newOverlayDialog.Dispose(); }