public void UpdateFields(Line selected) { if (selected == null) { return; } fields.Clear(); foreach (var v in selected.tag.fields) { fields.Add(new Field(FixDictionary.get().GetField(v.Key).name, v.Key, v.Value)); } }
public MainWindow() { l.MinLogLevel = l.Level.Debug; l.MinConsoleLogLevel = l.Level.Info; l.To("fixw.log"); if (Environment.GetCommandLineArgs().Length == 2) { fixFileName = Environment.GetCommandLineArgs()[1]; } else { fixFileName = ConfigurationManager.AppSettings["FILE"]; } if (fixFileName == "") { l.Fatal("No FIX file specified"); } if (!File.Exists(fixFileName)) { l.Fatal("Specified file does not exist:" + fixFileName); } fdict = new FixDictionary(); if (!fdict.Load(ConfigurationManager.AppSettings["FIXDICTIONARY"])) { l.Fatal("Can't load dictionary"); } DataContext = fixGui; InitializeComponent(); GridView myGridView = new GridView(); myGridView.AllowsColumnReorder = true; myGridView.ColumnHeaderToolTip = "Fix Fields"; NameValueCollection tsection = ConfigurationManager.GetSection("COLUMNS") as NameValueCollection; foreach (string key in tsection) { string attr = tsection[key]; GridViewColumn gvc1 = new GridViewColumn(); Binding b = new Binding(); b.Path = new PropertyPath("."); b.Converter = new FixFieldConverter(); int id = -1; if (Int32.TryParse(key, out id)) { b.ConverterParameter = id.ToString(); } else { b.ConverterParameter = fdict.GetId(key); } gvc1.DisplayMemberBinding = b; gvc1.Header = key; gvc1.Width = Int32.Parse(attr); myGridView.Columns.Add(gvc1); } listView.View = myGridView; fixFile = new FixFile(fixFileName); this.Title = fixFile.GetStatus(); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += OnTimer; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); dispatcherTimer.Start(); }
public FixDictionary() { instance = this; }