private void logTimeCombo_SelectedIndexChanged(object sender, EventArgs e) { if (!internalSet) { bool isCustom = logTimeCombo.SelectedIndex == logTimeCombo.Items.Count - 1; bool isInserted = logTimeCombo.Items.Count == 8 && logTimeCombo.SelectedIndex == 6; if (isCustom) { using (var dlg = new EventActionFilterTimeEditor()) { if (ql.Query.Times != null && ql.Query.Times.HasDates) { dlg.FromDateTime = ql.Query.Times.low; dlg.ToDateTime = ql.Query.Times.high; } if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { ql.Query.Times = new EventQuery.CQuery.CTimeCreated(dlg.FromDateTime, dlg.ToDateTime); InitLogTime(ql.Query.Times); } else { logTimeCombo.SelectedIndex = lastLogTimeComboIndex; } } } else if (isInserted) { } else { lastLogTimeComboIndex = logTimeCombo.SelectedIndex; if (logTimeCombo.Items.Count == 8) { logTimeCombo.Items.RemoveAt(6); } ql.Query.Times = new EventQuery.CQuery.CTimeCreated(((LogTimeItem)logTimeCombo.Items[lastLogTimeComboIndex]).DiffTime); } } }
private void logTimeCombo_SelectedIndexChanged(object sender, EventArgs e) { if (!internalSet) { bool isCustom = logTimeCombo.SelectedIndex == logTimeCombo.Items.Count - 1; bool isInserted = logTimeCombo.Items.Count == 8 && logTimeCombo.SelectedIndex == 6; if (isCustom) { using (var dlg = new EventActionFilterTimeEditor()) { if (ql.Query.Times != null && ql.Query.Times.HasDates) { dlg.FromDateTime = ql.Query.Times.low; dlg.ToDateTime = ql.Query.Times.high; } if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { ql.Query.Times = new EventQuery.CQuery.CTimeCreated(dlg.FromDateTime, dlg.ToDateTime); InitLogTime(ql.Query.Times); } else logTimeCombo.SelectedIndex = lastLogTimeComboIndex; } } else if (isInserted) { } else { lastLogTimeComboIndex = logTimeCombo.SelectedIndex; if (logTimeCombo.Items.Count == 8) logTimeCombo.Items.RemoveAt(6); ql.Query.Times = new EventQuery.CQuery.CTimeCreated(((LogTimeItem)logTimeCombo.Items[lastLogTimeComboIndex]).DiffTime); } } }