Пример #1
0
 public TemplateHelper(Timetable tt)
 {
     filterable = Plugin.FilterRuleContainer;
     this.tt    = tt;
     attrs      = BfplAttrs.GetAttrs(tt);
     analyzer   = new IntersectionAnalyzer(tt);
 }
Пример #2
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.Delegate <ITemplate, string>(t => t.TemplateName);
            templateComboBox.DataStore       = chooser.AvailableTemplates;

            var fntComboBox = new FontComboBox(fontComboBox, exampleLabel);

            attrs                   = BfplAttrs.GetAttrs(tt) ?? BfplAttrs.CreateAttrs(tt);
            fontComboBox.Text       = attrs.Font ?? "";
            cssTextBox.Text         = attrs.Css ?? "";
            commentCheckBox.Checked = attrs.ShowComments;
            daysCheckBox.Checked    = attrs.ShowDays;

            var tmpl = chooser.GetTemplate(tt);

            templateComboBox.SelectedValue = tmpl;

            consoleCheckBox.Checked = settings.Get <bool>("bfpl.console");
        }
Пример #3
0
        public void SaveFilter(Timetable tt, List <FilterRule> stationRules, List <FilterRule> trainRules)
        {
            var attrs = BfplAttrs.GetAttrs(tt);

            attrs.TrainPatterns   = string.Join("|", trainRules.Select(r => r.Pattern));
            attrs.StationPatterns = string.Join("|", stationRules.Select(r => r.Pattern));
        }
Пример #4
0
#pragma warning restore CS0649

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

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

            var fntComboBox = new FontComboBox(fontComboBox, exampleLabel);

            attrs = BfplAttrs.GetAttrs(tt);
            if (attrs != null)
            {
                fontComboBox.Text       = attrs.Font;
                cssTextBox.Text         = attrs.Css ?? "";
                commentCheckBox.Checked = attrs.ShowComments;
                daysCheckBox.Checked    = attrs.ShowDays;
            }
            else
            {
                attrs = new BfplAttrs(tt);
                tt.Children.Add(attrs.XMLEntity);
            }

            var tmpl = chooser.GetTemplate(tt);

            templateComboBox.SelectedValue = tmpl;

            consoleCheckBox.Checked = settings.Get <bool>("bfpl.console");
        }
Пример #5
0
        public VelocityForm(IPluginInterface pluginInterface, Route route) : this()
        {
            this.pluginInterface = pluginInterface;
            tt         = pluginInterface.Timetable;
            this.route = route;

            attrs = BfplAttrs.GetAttrs(tt);
            if (attrs == null)
            {
                attrs = BfplAttrs.CreateAttrs(tt);
            }

            backupHandle = pluginInterface.BackupTimetable();
            UpdateListView();
        }
Пример #6
0
        public VelocityForm(IInfo info, Route route) : this()
        {
            this.info  = info;
            tt         = info.Timetable;
            this.route = route;

            attrs = BfplAttrs.GetAttrs(tt);
            if (attrs == null)
            {
                attrs = new BfplAttrs(tt);
                tt.Children.Add(attrs.XMLEntity);
            }

            backupHandle = info.BackupTimetable();
            UpdateListView();
        }
Пример #7
0
        private void Init(Timetable tt)
        {
            var attrs = BfplAttrs.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 BfplAttrs(tt);
                tt.Children.Add(attrs.XMLEntity);

                trainRules   = new List <FilterRule>();
                stationRules = new List <FilterRule>();
            }
        }
Пример #8
0
 public TemplateHelper(Timetable tt)
 {
     filterable = new Forms.FilterableHandler();
     this.tt    = tt;
     attrs      = BfplAttrs.GetAttrs(tt);
 }