private void btnOK_Click(object sender, EventArgs e) { if (this.radioCMF.Checked) { Gateway gw = (Gateway)this.cbGateway.SelectedItem; TimeSpan span = this.timespan[this.cbLast.Text]; DbSettings setting = (DbSettings)this.comboBoxEnv.SelectedItem; lastSelectedEnv = this.comboBoxEnv.SelectedIndex; lastSelectedGat = this.cbGateway.SelectedIndex; lastSelectedTime = this.cbLast.SelectedIndex; this.fixlogfile = FixLogFile.FromDatabase(gw, setting, span); } else { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { this.fixlogfile = FixLogFile.FromCmfLog(this.openFileDialog1.FileName); } else { DialogResult = DialogResult.Cancel; } } Settings.Instance.LogDialog.LastEnvironment = lastSelectedEnv; Settings.Instance.LogDialog.LastGateway = lastSelectedGat; Settings.Instance.LogDialog.LastTime = lastSelectedTime; }
public FormLogFile(IFixMessageViewer viewer, FixLogFile logFile) { this.logfile = logFile; this.viewer = viewer; InitializeComponent(); InitGrid(); this.lines = logFile.Lines; LoadLines(); IOrderedEnumerable <string> qryClOrdId = this.lines .Where(x => x.FixMessage[11] != null) .GroupBy(x => x.FixMessage[11].Value) .Select(x => x.Key) .OrderBy(x => x); this.comboBoxClOrdId.Items.Add(""); foreach (string id in qryClOrdId) { if (!this.comboBoxClOrdId.Items.Contains(id)) { this.comboBoxClOrdId.Items.Add(id); } } IObservable <Filter> filterChanged = Observable .FromEventPattern <EventArgs>(this.textBoxMessageType, "TextChanged") .Select(x => ((TextBox)x.Sender).Text.ToUpper()) .DistinctUntilChanged() .Select(x => new FitlerMessageType { Value = x } as Filter) .Throttle(TimeSpan.FromMilliseconds(500)) .Merge(Observable.FromEventPattern <EventArgs>( this.comboBoxClOrdId, "SelectedIndexChanged").Select( x => new FilterClOrdId { Value = ((System.Windows.Forms.ComboBox)x.Sender).SelectedItem.ToString() } as Filter)) .Merge(Observable.FromEventPattern <EventArgs>( this.textBoxKeywords, "TextChanged").Select( x => ((TextBox)x.Sender).Text.ToUpper()) .Throttle(TimeSpan.FromMilliseconds(700)) .DistinctUntilChanged() .Select(x => new FilterKeywords { Value = x } as Filter)) .ObserveOn(Scheduler.CurrentThread); this.grid1.Selection.SelectionChanged += Selection_SelectionChanged; filterChanged.Subscribe(HandleFilterChanged); }