public void SaveFilter(Timetable tt, List <FilterRule> stationRules, List <FilterRule> trainRules) { var attrs = KfplAttrs.GetAttrs(tt); attrs.TrainPatterns = string.Join("|", trainRules.Select(r => r.Pattern)); attrs.StationPatterns = string.Join("|", stationRules.Select(r => r.Pattern)); }
public SettingsControl(Timetable tt, IInfo info) { Eto.Serialization.Xaml.XamlReader.Load(this); settings = info.Settings; chooser = new KfplTemplateChooser(info); templateComboBox.ItemTextBinding = Binding.Property <ITemplate, string>(t => t.TemplateName); templateComboBox.DataStore = chooser.AvailableTemplates; var fntComboBox = new FontComboBox(fontComboBox, exampleLabel); var hefntComboBox = new FontComboBox(hefontComboBox, heexampleLabel); attrs = KfplAttrs.GetAttrs(tt); if (attrs != null) { fontComboBox.Text = attrs.Font; hefontComboBox.Text = attrs.HeFont; cssTextBox.Text = attrs.Css ?? ""; } else { attrs = new KfplAttrs(tt); tt.Children.Add(attrs.XMLEntity); } setRouteNumbers = new Dictionary <int, string>(); var col = kbsnListView.AddColumn(new TextBoxCell { Binding = Binding.Delegate <Route, string>(r => { setRouteNumbers.TryGetValue(r.Index, out string val); return(val ?? attrs.KBSn.GetValue(r.Index) ?? NO_KBS_TEXT); }, (r, n) => setRouteNumbers[r.Index] = n) }, "Name"
public SettingsControl(IPluginInterface pluginInterface) { Eto.Serialization.Xaml.XamlReader.Load(this); var tt = pluginInterface.Timetable; settings = pluginInterface.Settings; var chooser = Plugin.GetTemplateChooser(pluginInterface); templateComboBox.ItemTextBinding = Binding.Delegate <ITemplate, string>(t => t.TemplateName); templateComboBox.DataStore = chooser.AvailableTemplates; var fntComboBox = new FontComboBox(fontComboBox, exampleLabel); var hefntComboBox = new FontComboBox(hefontComboBox, heexampleLabel); attrs = KfplAttrs.GetAttrs(tt) ?? KfplAttrs.CreateAttrs(tt); fontComboBox.Text = attrs.Font; hefontComboBox.Text = attrs.HeFont; cssTextBox.Text = attrs.Css ?? ""; setRouteNumbers = new Dictionary <int, string>(); #pragma warning disable CA2000 kbsnListView.AddColumn(new TextBoxCell { Binding = Binding.Delegate <Route, string>(r => { setRouteNumbers.TryGetValue(r.Index, out string val); return(val ?? attrs.KBSn.GetValue(r.Index) ?? NO_KBS_TEXT); }, (r, n) => setRouteNumbers[r.Index] = n) }, "Name", editable: true
public void ToNetwork(Timetable tt) { var attrs = KfplAttrs.GetAttrs(tt); if (attrs == null) { return; } ConvertAttrLinToNet(attrs.KBSn); }
public void ToLinear(Timetable tt) { var attrs = KfplAttrs.GetAttrs(tt); if (attrs == null) { return; } var route = tt.GetRoutes().FirstOrDefault().Index; ConvertAttrNetToLin(attrs.KBSn, route); }
private void Init(Timetable tt) { var attrs = KfplAttrs.GetAttrs(tt); if (attrs != null) { trainRules = attrs.TrainPatterns.Split('|').Where(p => p != "").Select(p => new FilterRule(p)).ToList(); stationRules = attrs.StationPatterns.Split('|').Where(p => p != "").Select(p => new FilterRule(p)).ToList(); } else { attrs = new KfplAttrs(tt); tt.Children.Add(attrs.XMLEntity); trainRules = new List <FilterRule>(); stationRules = new List <FilterRule>(); } }