Esempio n. 1
0
#pragma warning restore CS0649

        public SettingsControl(Timetable tt, IInfo info)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            settings = info.Settings;
            chooser  = new AfplTemplateChooser(info);
            templateComboBox.ItemTextBinding = Binding.Property <ITemplate, string>(t => t.TemplateName);
            templateComboBox.DataStore       = chooser.AvailableTemplates;

            var fntComboBox   = new FontComboBox(fontComboBox, exampleLabel);
            var hwfntComboBox = new FontComboBox(hwfontComboBox, hwexampleLabel);

            attrs = AfplAttrs.GetAttrs(tt);
            if (attrs != null)
            {
                fontComboBox.Text      = attrs.Font;
                hwfontComboBox.Text    = attrs.HwFont;
                cssTextBox.Text        = attrs.Css ?? "";
                tracksCheckBox.Checked = attrs.ShowTracks;
            }
            else
            {
                attrs = new AfplAttrs(tt);
                tt.Children.Add(attrs.XMLEntity);
            }

            var tmpl = chooser.GetTemplate(tt);

            templateComboBox.SelectedValue = tmpl;

            consoleCheckBox.Checked = settings.Get <bool>("afpl.console");
        }
Esempio n. 2
0
        public void SaveFilter(Timetable tt, List <FilterRule> stationRules, List <FilterRule> trainRules)
        {
            var attrs = AfplAttrs.GetAttrs(tt);

            attrs.TrainPatterns   = string.Join("|", trainRules.Select(r => r.Pattern));
            attrs.StationPatterns = string.Join("|", stationRules.Select(r => r.Pattern));
        }
Esempio n. 3
0
#pragma warning restore CS0649

        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.Property <ITemplate, string>(t => t.TemplateName);
            templateComboBox.DataStore       = chooser.AvailableTemplates;

            var fntComboBox   = new FontComboBox(fontComboBox, exampleLabel);
            var hwfntComboBox = new FontComboBox(hwfontComboBox, hwexampleLabel);

            attrs                  = AfplAttrs.GetAttrs(tt) ?? AfplAttrs.CreateAttrs(tt);
            fontComboBox.Text      = attrs.Font;
            hwfontComboBox.Text    = attrs.HwFont;
            cssTextBox.Text        = attrs.Css ?? "";
            tracksCheckBox.Checked = attrs.ShowTracks;

            var tmpl = chooser.GetTemplate(tt);

            templateComboBox.SelectedValue = tmpl;

            consoleCheckBox.Checked = settings.Get <bool>("afpl.console");

            omitTracksSingleCheckBox.Checked = attrs.OmitTracksWhenSingle;
        }
Esempio n. 4
0
        private void Init(Timetable tt)
        {
            var attrs = AfplAttrs.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 AfplAttrs(tt);
                tt.Children.Add(attrs.XMLEntity);

                trainRules   = new List <FilterRule>();
                stationRules = new List <FilterRule>();
            }
        }