// 채널을 수정하라고 지시하는 함수 private void ChannelEdit() { if (list_Channels.SelectedItem == null || serverProperty.isRunning) { return; } ChannelEditor editor; PackedData.ChannelInfo data; Channel target = (Channel)list_Channels.SelectedItem; data = new PackedData.ChannelInfo(target.Name, target.max_capacity, 0, target.description); editor = new ChannelEditor(false, data); editor.ShowDialog(); switch (editor.DialogResult) { case DialogResult.OK: target.UpdateInfo(editor.data); list_Channels.DisplayMember = null; list_Channels.DisplayMember = "Name"; break; case DialogResult.Abort: serverProperty.channelsList.Remove(target); list_Channels.Items.Remove(target); break; case DialogResult.Cancel: default: break; } editor.Dispose(); }
// 채널을 만들라고 지시하는 함수 private void ChannelCreate() { if (serverProperty.isRunning) { return; } else if (serverProperty.channelsList.Count > 100) { MessageBox.Show("채널 갯수는 100개를 넘길 수 없습니다.", "생성 오류", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ChannelEditor editor; Channel channel; editor = new ChannelEditor(true, new PackedData.ChannelInfo("", 100, 0, "")); editor.ShowDialog(); switch (editor.DialogResult) { case DialogResult.OK: PackedData.ChannelInfo data = editor.data; channel = new Channel(data.name, data.max_capacity, data.description); serverProperty.channelsList.Add(channel); list_Channels.Items.Add(channel); break; case DialogResult.Abort: case DialogResult.Cancel: default: break; } editor.Dispose(); }