private void SetStreamDelayButton_Click(object sender, EventArgs e) { if (streamListView.SelectedIndices.Count == 0 || streamListView.SelectedIndices[0] == 0) { SetStreamDelayButton.Enabled = false; return; } int oldValue = 0; StreamListItem item = (StreamListItem)streamListView.SelectedItems[0]; oldValue = item.StreamDelay; for (int i = 1; i < streamListView.SelectedItems.Count; i++) { item = (StreamListItem)streamListView.SelectedItems[i]; if (item.StreamDelay != oldValue) { oldValue = 0; break; } } if (GetIntegerValueDialog.Show("Delay", "ms", 0, 4000, ref oldValue) == DialogResult.Cancel) { return; } for (int i = 0; i < streamListView.SelectedItems.Count; i++) { item = (StreamListItem)streamListView.SelectedItems[i]; item.StreamDelay = oldValue; } }
static public DialogResult Show(string Caption, string UnitsString, int MinimumValue, int MaximumValue, ref int Result) { GetIntegerValueDialog dialog = new GetIntegerValueDialog { Text = Caption, UnitsString = UnitsString, MinimumValue = MinimumValue, MaximumValue = MaximumValue, Value = Result }; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { Result = dialog.Value; } return(result); }