示例#1
0
 public PEImageView()
 {
     view = new GridView();
     view.AddColumn(new GridView.Column("Name", true, 150));
     view.AddColumn(new GridView.Column("Value", false, 450));
     Controls.Add(view);
 }
示例#2
0
        private void InitializeGridView(GridView view, TrainDirection dir)
        {
            var stations = tt.GetLinearStationsOrderedByDirection(dir);

            view.AddColumn <DataElement>(t => t.Train.TName, T._("Zugnummer"));
#pragma warning disable CA2000
            foreach (var sta in stations)
            {
                if (sta != stations.First())
                {
                    view.AddColumn(GetCell(t => t.Arrival, sta, true, view), T._("{0} an", sta.SName));
                }
                if (sta != stations.Last())
                {
                    view.AddColumn(GetCell(t => t.Departure, sta, false, view), T._("{0} ab", sta.SName));
                }
            }
#pragma warning restore CA2000
            view.AddColumn <DataElement>(t => GetTransition(t.Train), T._("Folgezug"));

            var l = tt.Trains.Where(t => t.Direction == dir).Select(tra => new DataElement()
            {
                Train   = tra,
                ArrDeps = tra.GetArrDepsUnsorted()
            }).ToList();

            view.GotFocus += (s, e) => focused = view;
            view.KeyDown  += (s, e) => HandleViewKeystroke(e, view);
            if (mpmode)
            {
                l.Add(null);
            }

            view.DataStore = l.ToArray();
        }
        private void InitializeGridView(GridView view)
        {
            view.Columns.Clear();
            view.AddColumn <DataElement>(t => t.Station.SName, "Bahnhof");
            view.AddColumn(GetCell(t => t.Arrival, true), "Ankunft");
            view.AddColumn(GetCell(t => t.Departure, false), "Abfahrt");

            if (tt.Version.Compare(TimetableVersion.JTG3_1) >= 0)
            {
                view.AddColumn(GetTrackCell(t => t.ArrivalTrack), "Ankunftsgleis", editable: true);
                view.AddColumn(GetTrackCell(t => t.DepartureTrack), "Abfahrtsgleis", editable: true);
            }
            else
            {
                shuntButton.Visible = false;
            }

            view.KeyDown += (s, e) => HandleViewKeystroke(e, view);

            view.DataStore            = path.Select(sta => new DataElement(train, sta, train.GetArrDep(sta))).ToList();
            view.SelectedRowsChanged += (s, e) =>
            {
                var selected = (DataElement)view.SelectedItem;
                shuntButton.Enabled = (selected != null) ? selected.Station.Tracks.Any() : false;
            };
        }
示例#4
0
        public LineEditForm(IInfo info, int route)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.info  = info;
            tt         = info.Timetable;
            this.route = route;

            backupHandle = info.BackupTimetable();

            if (tt.Type == TimetableType.Network)
            {
                loadLineButton.Visible = false;
            }

            gridView.AddColumn <Station>(s => s.SName, "Bahnhof");
            gridView.AddColumn <Station>(s => s.Positions.GetPosition(route).ToString(), "Position");

            gridView.MouseDoubleClick += (s, e) => EditStation(false);

            if (Eto.Platform.Instance.IsWpf)
            {
                KeyDown += HandleKeystroke;
            }
            else
            {
                gridView.KeyDown += HandleKeystroke;
            }

            UpdateStations();

            this.AddCloseHandler();
            this.AddSizeStateHandler();
        }
示例#5
0
        public TemplatesForm(TemplateManager manager, string templateRoot)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.manager = manager;
            var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            templatesDir = new DirectoryInfo(Path.Combine(appPath, templateRoot));

            var buildName = new Func <string, string>((x) => x.StartsWith("builtin:") ? "(integriert)" : x);

            gridView.AddColumn <ITemplate>(t => ((TemplateHost)t).Enabled ? "X" : "", "Aktiviert");
            gridView.AddColumn <ITemplate>(t => t.TemplateName, "Name");
            gridView.AddColumn <ITemplate>(t => buildName(t.Identifier), "Dateiname");
            gridView.AddColumn <ITemplate>(t => t.TemplateType, "Typ");

            gridView.SelectedItemsChanged += (s, e) =>
            {
                var tmpl = (TemplateHost)gridView.SelectedItem;
                if (tmpl == null)
                {
                    extractButton.Enabled = editButton.Enabled = removeButton.Enabled = enableButton.Enabled = disableButton.Enabled = false;
                    return;
                }
                var builtin = tmpl.Identifier.StartsWith("builtin:");
                extractButton.Enabled = builtin;
                editButton.Enabled    = removeButton.Enabled = !builtin;
                enableButton.Enabled  = !builtin && !tmpl.Enabled;
                disableButton.Enabled = !builtin && tmpl.Enabled;
            };

            this.AddSizeStateHandler();

            RefreshList();
        }
        private void InitializeGridView(GridView view, TrainDirection dir)
        {
            var stations = tt.GetStationsOrderedByDirection(dir);

            view.AddColumn <DataElement>(t => t.Train.TName, "Zugnummer");
            foreach (var sta in stations)
            {
                if (sta != stations.First())
                {
                    view.AddColumn(GetCell(t => t.Arrival, sta, true, view), sta.SName + " an");
                }
                if (sta != stations.Last())
                {
                    view.AddColumn(GetCell(t => t.Departure, sta, false, view), sta.SName + " ab");
                }
            }
            view.AddColumn <DataElement>(t => GetTransition(t.Train), "Folgezug");

            var l = tt.Trains.Where(t => t.Direction == dir).Select(tra => new DataElement()
            {
                Train   = tra,
                ArrDeps = tra.GetArrDeps()
            }).ToList();

            view.GotFocus += (s, e) => focused = view;
            view.KeyDown  += (s, e) => HandleViewKeystroke(e, view);
            if (mpmode)
            {
                l.Add(null);
            }

            view.DataStore = l;
        }
示例#7
0
        public MDTablesStreamView()
        {
            var split = new SplitContainer {
                Orientation = Orientation.Horizontal,
                Dock        = DockStyle.Fill
            };

            Controls.Add(split);

            gridView = new GridView();
            gridView.AddColumn(new GridView.Column("Field", true, 120));
            gridView.AddColumn(new GridView.Column("Offset", true));
            gridView.AddColumn(new GridView.Column("Value", false, 150));
            split.Panel1.Controls.Add(gridView);

            hexView = new HexViewer();
            split.Panel2.Controls.Add(hexView);

            PerformLayout();

            hexView.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            var nav = new ToolStripMenuItem("Show in Raw Data");

            nav.Click += OnShowData;
            hexView.ContextMenuStrip.Items.Add(nav);
        }
        public MDTableHeapView()
        {
            var split1 = new SplitContainer {
                Orientation = Orientation.Vertical,
                Dock        = DockStyle.Fill
            };

            Controls.Add(split1);

            // Since App property isn't initialized in this moment,
            // a callback is setup to initialize treeview later.
            initTreeView = () => {
                treeView = new TreeViewX(App)
                {
                    Dock = DockStyle.Fill
                };
                treeView.AfterSelect     += OnNodeSelected;
                treeView.ContextMenuStrip = GetContextMenu();
                split1.Panel1.Controls.Add(treeView);
            };

            var split2 = new SplitContainer {
                Orientation = Orientation.Horizontal,
                Dock        = DockStyle.Fill
            };

            split1.Panel2.Controls.Add(split2);

            gridView = new GridView();
            gridView.AddColumn(new GridView.Column("Field", true, 120));
            gridView.AddColumn(new GridView.Column("Type", true, 130));
            gridView.AddColumn(new GridView.Column("Offset", true));
            gridView.AddColumn(new GridView.Column("Value", false));
            gridView.AddColumn(new GridView.Column("Description", false, 200));
            split2.Panel1.Controls.Add(gridView);

            hexView = new HexViewer();
            split2.Panel2.Controls.Add(hexView);

            PerformLayout();

            hls = new Dictionary <Table, HexViewer.HighLight[]>();

            hexView.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            var nav = new ToolStripMenuItem("Show in Raw Data");

            nav.Click += OnShowData;
            hexView.ContextMenuStrip.Items.Add(nav);

            followInHex = false;
        }
示例#9
0
 public PESectionsView()
 {
     view = new GridView();
     view.AddColumn(new GridView.Column("Name", false, 90));
     view.AddColumn(new GridView.Column("Virtual Size", false, 90));
     view.AddColumn(new GridView.Column("Virtual Address", false, 90));
     view.AddColumn(new GridView.Column("Raw Size", false, 90));
     view.AddColumn(new GridView.Column("Raw Address", false, 90));
     view.AddColumn(new GridView.Column("Reloc", false, 90));
     view.AddColumn(new GridView.Column("Linenums.", false, 90));
     view.AddColumn(new GridView.Column("Reloc No.", false, 90));
     view.AddColumn(new GridView.Column("Linenums. No.", false, 90));
     view.AddColumn(new GridView.Column("Characteristics", false, 90));
     Controls.Add(view);
 }
示例#10
0
        public PEDDView()
        {
            view = new GridView();
            view.AddColumn(new GridView.Column("Directory", true, 200));
            view.AddColumn(new GridView.Column("RVA", false));
            view.AddColumn(new GridView.Column("Size", false));
            view.AddColumn(new GridView.Column("Section", false));
            Controls.Add(view);

            ctxMenu = new ContextMenuStrip();
            var nav = new ToolStripMenuItem("Show in Raw Data");

            nav.Click += OnShowData;
            ctxMenu.Items.Add(nav);
        }
        public static void AddSpinEditColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            bool isAllowEdit            = true,
            string formatString         = "#,###0",
            SummaryItemType summaryType = SummaryItemType.None,
            string summaryFormat        = "",
            KeyEventHandler keyDown     = null)
        {
            RepositoryItemSpinEdit itemCtrl = new RepositoryItemSpinEdit();

            itemCtrl.DisplayFormat.FormatString = formatString;
            itemCtrl.DisplayFormat.FormatType   = FormatType.Custom;
            itemCtrl.EditFormat.FormatString    = formatString;
            itemCtrl.EditFormat.FormatType      = FormatType.Custom;
            itemCtrl.EditMask = formatString;

            GridColumnSummaryItem summaryItem = new GridColumnSummaryItem();

            if (summaryType != SummaryItemType.None)
            {
                summaryFormat = string.IsNullOrEmpty(summaryFormat) ? "{0: " + formatString + "}" : summaryFormat;
                summaryItem   = new GridColumnSummaryItem(summaryType, fieldName, summaryFormat);
            }

            if (keyDown != null)
            {
                itemCtrl.KeyDown += new KeyEventHandler(keyDown);
            }

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl, summaryItem: summaryItem);
        }
示例#12
0
        public ShuntForm(ArrDep arrDep, Station sta)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.arrDep  = arrDep;
            this.station = sta;

            arrivalLabel.Font   = new Font(arrivalLabel.Font.FamilyName, arrivalLabel.Font.Size, FontStyle.Bold);
            departureLabel.Font = new Font(departureLabel.Font.FamilyName, departureLabel.Font.Size, FontStyle.Bold);
            arrivalLabel.Text   = arrivalLabel.Text.Replace("{time}", arrDep.Arrival != default ? arrDep.Arrival.ToShortTimeString() : "-");
            arrivalLabel.Text   = arrivalLabel.Text.Replace("{track}", arrDep.ArrivalTrack);
            departureLabel.Text = departureLabel.Text.Replace("{time}", arrDep.Departure != default ? arrDep.Departure.ToShortTimeString() : "-");
            departureLabel.Text = departureLabel.Text.Replace("{track}", arrDep.DepartureTrack);

            Title = Title.Replace("{station}", station.SName);

            var tracks = sta.Tracks.Select(t => t.Name);

            gridView.AddColumn <ShuntMove, TimeSpan>(s => s.Time, ts => ts.ToShortTimeString(), s => { TimeSpan.TryParse(s, out var res); return(res); }, "Zeit", editable: true);
            gridView.AddDropDownColumn <ShuntMove>(s => s.SourceTrack, tracks, "Startgleis", editable: true);
            gridView.AddDropDownColumn <ShuntMove>(s => s.TargetTrack, tracks, "Zielgleis", editable: true);
            gridView.AddCheckColumn <ShuntMove>(s => s.EmptyAfterwards, "Alle Wagen?", editable: true);

            gridView.SelectedItemsChanged += (s, e) => removeButton.Enabled = gridView.SelectedItem != null;


            this.AddSizeStateHandler();

            shuntBackup = arrDep.ShuntMoves.Select(s => s.Clone <ShuntMove>()).ToList();

            RefreshList();
        }
示例#13
0
        private VelocityForm()
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            gridView.AddColumn <IStation>(s => s.Positions.GetPosition(route.Index).ToString(), "km");
            gridView.AddColumn <IStation>(s => s.SName, "Name");
            gridView.AddColumn <IStation>(s => s.Vmax.GetValue(route.Index), "Vmax");
            gridView.AddColumn <IStation>(s => s.Wellenlinien.GetValue(route.Index).ToString(), "Wellenlinien");

            gridView.MouseDoubleClick += (s, e) => EditPoint(false);

            gridView.SelectedItemsChanged += (s, e) => SelectPoint();

            this.AddCloseHandler();
            this.AddSizeStateHandler();
        }
示例#14
0
#pragma warning restore CS0649

        public TrainStyleForm(IPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;
            var tt    = pluginInterface.Timetable;
            var attrs = new TimetableStyle(tt);

            backupHandle = pluginInterface.BackupTimetable();

            Eto.Serialization.Xaml.XamlReader.Load(this);

            var cc = new ColorCollection(pluginInterface.Settings);
            var ds = new DashStyleHelper();

            var lineWidths = Enumerable.Range(1, 5).Cast <object>().ToArray();

            gridView.AddColumn <TrainStyle>(t => t.Train.TName, "Zugnummer");
            gridView.AddDropDownColumn <TrainStyle>(t => t.HexColor, cc.ColorHexStrings, EtoBindingExtensions.ColorBinding(cc), "Farbe", true);
            gridView.AddDropDownColumn <TrainStyle>(t => t.TrainWidthInt, lineWidths, Binding.Delegate <int, string>(i => i.ToString()), "Linienstärke", true);
            gridView.AddDropDownColumn <TrainStyle>(t => t.LineStyle, ds.Indices.Cast <object>(), Binding.Delegate <int, string>(i => ds.GetDescription(i)), "Linientyp", true);
            gridView.AddCheckColumn <TrainStyle>(t => t.Show, "Zug zeichnen", true);

            gridView.DataStore = tt.Trains.Select(t => new TrainStyle(t, attrs));

            this.AddCloseHandler();
        }
示例#15
0
        public void AddColumn(DataType data)
        {
            var dt = View.DataSource;

            if (dt == null)
            {
                dt = new DataTable();
            }
            else
            {
                if (dt.RowCount > 0)
                {
                    new MessageBoxForm("You cannot add columns when there is data, Would you like to clear view?", MessageBoxLayout.Question).ShowDialog((new DialogResult(DialogResultEnum.Yes, () => {
                        View.ClearView();
                        View.RenderGrid();
                    })));
                    return;
                }
            }
            string name = "Column " + dt.ColumnCount;

            dt.AddColumn(name, data);

            View.DataSource = dt;

            View.AddColumn(new GridViewColumn(View)
            {
                Caption = name, Column = dt.Columns.Last(), Visible = true
            });
        }
示例#16
0
        private FForm GetForm()
        {
            var stack = new TableLayout(1, 1)
            {
                Padding = new Eto.Drawing.Padding(10),
                Spacing = new Eto.Drawing.Size(5, 5),
            };

            gridView = new GridView();
            gridView.AddColumn <string>(s => s, T._("Meldung"));
            stack.Add(gridView, 0, 0);

            form = new FForm()
            {
                Content   = stack,
                Resizable = true,
                Size      = new Eto.Drawing.Size(600, 400),
                Title     = T._("Überprüfungen"),
            };
            form.Closing += (s, e) =>
            {
                this.form     = null;
                this.gridView = null;
            };
            return(form);
        }
        private void InitListView(GridView view, Button[] buttons)
        {
            view.AddColumn <ITrain>(t => t.IsLink ? T._("L") : "", "");
            view.AddColumn <ITrain>(t => t.TName, T._("Zugnummer"));
            view.AddColumn <ITrain>(t => t.Locomotive, T._("Tfz"));
            view.AddColumn <ITrain>(t => t.Mbr, T._("Mbr"));
            view.AddColumn <ITrain>(t => t.Last, T._("Last"));
            view.AddColumn <ITrain>(t => t.Days.DaysToString(false), T._("Verkehrstage"));
            view.AddColumn <ITrain>(t => t.Comment, T._("Kommentar"));

            view.GotFocus += (s, e) => active = view;

            if (!Eto.Platform.Instance.IsWpf)
            {
                view.KeyDown += HandleKeystroke;
            }

            view.SelectedItemsChanged += (s, e) =>
            {
                foreach (var button in buttons)
                {
                    button.Enabled = view.SelectedItem != null && !((ITrain)view.SelectedItem).IsLink;
                }
            };
        }
示例#18
0
#pragma warning restore CS0649

        public TrainsEditingForm(IInfo info) : base(info.Timetable)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.info    = info;
            tt           = info.Timetable;
            backupHandle = info.BackupTimetable();

            gridView.AddColumn <Train>(t => t.TName, "Zugnummer");
            gridView.AddColumn <Train>(t => t.Locomotive, "Tfz");
            gridView.AddColumn <Train>(t => t.Mbr, "Mbr");
            gridView.AddColumn <Train>(t => t.Last, "Last");
            gridView.AddColumn <Train>(t => t.Days.DaysToString(false), "Verkehrstage");
            gridView.AddColumn <Train>(t => BuildPath(t), "Laufweg");
            gridView.AddColumn <Train>(t => t.Comment, "Kommentar");

            gridView.MouseDoubleClick += (s, e) => EditTrain(gridView, TrainDirection.tr, false);

            UpdateListView(gridView, TrainDirection.tr);

            if (Eto.Platform.Instance.IsWpf)
            {
                KeyDown += HandleKeystroke;
            }
            else
            {
                gridView.KeyDown += HandleKeystroke;
            }

            this.AddCloseHandler();
            this.AddSizeStateHandler();
        }
示例#19
0
        public PECLIView()
        {
            view = new GridView();
            view.AddColumn(new GridView.Column("Field", true, 200));
            view.AddColumn(new GridView.Column("Value", false, 200));
            Controls.Add(view);

            showDataMenu = new ContextMenuStrip();
            var item = new ToolStripMenuItem("Show in Raw Data");

            item.Click += OnShowData;
            showDataMenu.Items.Add(item);

            showEntryMenu          = new ContextMenuStrip();
            item                   = new ToolStripMenuItem("Show in MD Tables");
            item.Click            += OnShowEntry;
            showEntryMenu.Opening += showEntryMenu_Opening;
            showEntryMenu.Items.Add(item);
        }
示例#20
0
        public MetaDataView()
        {
            var split1 = new SplitContainer {
                Orientation = Orientation.Horizontal,
                Dock        = DockStyle.Fill
            };

            Controls.Add(split1);

            var split2 = new SplitContainer {
                Orientation = Orientation.Vertical,
                Dock        = DockStyle.Fill
            };

            split1.Panel1.Controls.Add(split2);

            hdrGridView = new GridView();
            hdrGridView.AddColumn(new GridView.Column("Field", true, 120));
            hdrGridView.AddColumn(new GridView.Column("Offset", true));
            hdrGridView.AddColumn(new GridView.Column("Value", false));
            split2.Panel1.Controls.Add(hdrGridView);

            strGridView = new GridView();
            strGridView.AddColumn(new GridView.Column("Offset", false));
            strGridView.AddColumn(new GridView.Column("Size", false));
            strGridView.AddColumn(new GridView.Column("Name", false));
            strGridView.SelectionChanged += OnStreamSelectionChanged;
            split2.Panel2.Controls.Add(strGridView);

            hexView = new HexViewer();
            split1.Panel2.Controls.Add(hexView);

            PerformLayout();

            split2.SplitterDistance = split2.Width / 2;

            hexView.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            var nav = new ToolStripMenuItem("Show in Raw Data");

            nav.Click += OnShowData;
            hexView.ContextMenuStrip.Items.Add(nav);
        }
示例#21
0
        public static void AddCheckBoxColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            bool isAllowEdit = true)
        {
            RepositoryItemCheckEdit itemCtrl = new RepositoryItemCheckEdit();

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
示例#22
0
#pragma warning restore CS0649

        public StationStyleForm(IInfo info)
        {
            this.info    = info;
            tt           = info.Timetable;
            attrs        = new TimetableStyle(tt);
            backupHandle = info.BackupTimetable();

            Eto.Serialization.Xaml.XamlReader.Load(this);

            cc = new ColorCollection(info.Settings);
            ds = new DashStyleHelper();

            gridView.AddColumn <Station>(t => t.SName, "Name");
            gridView.AddColumn <Station>(t => cc.ToName(new StationStyle(t).StationColor ?? attrs.StationColor), "Farbe");
            gridView.AddColumn <Station>(t => (new StationStyle(t).StationWidth ?? attrs.StationWidth).ToString(), "Linienstärke");
            gridView.AddColumn <Station>(t => ds.GetDescription(new StationStyle(t).LineStyle), "Linientyp");
            gridView.AddColumn <Station>(t => new StationStyle(t).Show.ToString(), "Station zeichnen");

            gridView.CellDoubleClick += (s, e) => EditColor(false);

            UpdateStations();

            this.AddCloseHandler();
        }
示例#23
0
        public static GridColumn AddDropDownColumn <T>(this GridView view, Func <T, object> value, IEnumerable <object> dataStore, IIndirectBinding <string> textBinding, string header, bool editable = false)
        {
            var  internalBinding = Binding.Delegate(value);
            Cell cell;

            // hack for eto/gtk not supporting ItemTextBinding on ComboBoxCells
            if (Platform.Instance.IsGtk)
            {
                const char zws = '\u200B'; // This is a zero width (ZWS) space Unicode character.

                var lDataStore = dataStore.ToList();

                var tDataStore = lDataStore.Select(i =>
                                                   string.Empty.PadLeft(lDataStore.IndexOf(i) + 1, zws) // Pad with index+1 ZWS chars to be able to check later. If no ZWS is there, this did not work.
                                                   + textBinding.GetValue(i))
                                 .ToList();
                var hasNonUnique = tDataStore.Distinct().Count() != tDataStore.Count; // Check if textBinding produced the same string for more than one data item.

                var binding = Binding.Delegate <T, string>(
                    (T s) => textBinding.GetValue(internalBinding.GetValue(s)),
                    (T t, string s) =>
                {
                    int idx = s.Split(zws).Length - 2;
                    if (idx == -1)
                    {
                        idx = tDataStore.IndexOf(s);     // Fallback if ZWS is not supported.
                        if (hasNonUnique)
                        {
                            throw new Exception("ComboBoxCell ComboTextBinding Polyfill: Duplicate text entry encountered and Zero-Width-Space Hack not supported by platform!");
                        }
                    }

                    internalBinding.SetValue(t, lDataStore[idx]);
                }).Cast <object>();

                cell = new ComboBoxCell {
                    Binding = binding, DataStore = tDataStore
                };
            }
            else
            {
                cell = new ComboBoxCell {
                    Binding = internalBinding, DataStore = dataStore, ComboTextBinding = textBinding
                }
            };

            return(view.AddColumn(cell, header, editable));
        }
示例#24
0
        public static void AddTextEditColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            bool isAllowEdit = true,
            CharacterCasing characterCasing = CharacterCasing.Normal,
            char passwordChar = '\0')
        {
            RepositoryItemTextEdit itemCtrl = new RepositoryItemTextEdit();

            itemCtrl.CharacterCasing = characterCasing;
            itemCtrl.PasswordChar    = passwordChar;

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
        //private static void ItemCtrl_SearchLookUpEdit_Popup(object sender, EventArgs e)
        //{
        //    SearchLookUpEdit edit = sender.CastTo<SearchLookUpEdit>();
        //    PopupSearchLookUpEditForm popupForm = edit.GetPopupEditForm();
        //    popupForm.KeyPreview = true;
        //    popupForm.KeyPress += PopupForm_KeyPress;
        //}

        //private static void PopupForm_KeyPress(object sender, KeyPressEventArgs e)
        //{
        //    if (e.KeyChar == (char)Keys.Enter)
        //    {
        //        PopupSearchLookUpEditForm popupForm = sender as PopupSearchLookUpEditForm;
        //        GridView view = popupForm.OwnerEdit.Properties.View;
        //        view.FocusedRowHandle = 0;
        //        popupForm.OwnerEdit.ClosePopup();
        //    }
        //}

        public static void AddDateEditColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            bool isAllowEdit            = true,
            HorzAlignment textAlignment = HorzAlignment.Center,
            string formatString         = "dd/MM/yyyy")
        {
            RepositoryItemDateEdit itemCtrl = new RepositoryItemDateEdit();

            itemCtrl.DisplayFormat.FormatString = formatString;
            itemCtrl.DisplayFormat.FormatType   = FormatType.Custom;
            itemCtrl.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTimeAdvancingCaret;

            gridView.AddColumn(fieldName, caption, width, isAllowEdit: isAllowEdit, itemCtrl: itemCtrl, textAlignment: textAlignment);
        }
示例#26
0
 public static void AddColumn(
     this GridView gridView,
     ColumnInfo column,
     bool isAllowEdit                  = false,
     bool fixedWidth                   = true,
     HorzAlignment textAlignment       = HorzAlignment.Default,
     RepositoryItem itemCtrl           = null,
     GridColumnSummaryItem summaryItem = null)
 {
     gridView.AddColumn(column.FieldName, column.Caption,
                        column.Width,
                        isAllowEdit: isAllowEdit,
                        fixedWidth: fixedWidth,
                        textAlignment: textAlignment,
                        itemCtrl: itemCtrl,
                        summaryItem: summaryItem);
 }
        public void SetHeader(string[] _header)
        {
            //clear all header
            for (int i = 0; i < GridView.ColumnCount; i++)
            {
                GridView.RemoveColumn(GridView.TableColumns()[i]);
            }

            //import headers
            foreach (var h in _header)
            {
                GridView.AddColumn(new NSTableColumn()
                {
                    Title = h
                });
            }
        }
        public static void AddTextEditColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            bool isAllowEdit        = true,
            KeyEventHandler keyDown = null)
        {
            RepositoryItemTextEdit itemCtrl = new RepositoryItemTextEdit();

            if (keyDown != null)
            {
                itemCtrl.KeyDown += new KeyEventHandler(keyDown);
            }

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
示例#29
0
        public static void AddSearchLookupEditColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            object itemSource,
            string valueMember,
            string displayMember,
            List <ColumnInfo> columns     = null,
            bool isAllowEdit              = true,
            string nullText               = "",
            EventHandler editValueChanged = null,
            int popupFormWidth            = -1,
            int popupFormHeight           = -1,
            bool enterChoiceFirstRow      = true,
            KeyEventHandler keyDown       = null,
            bool isBestFitColumn          = false)
        {
            RepositoryItemSearchLookUpEdit itemCtrl = new RepositoryItemSearchLookUpEdit();

            itemCtrl.SetupLookUpEdit(
                valueMember,
                displayMember,
                itemSource, columns,
                nullText: nullText,
                enterChoiceFirstRow: enterChoiceFirstRow,
                popupFormWidth: popupFormWidth,
                popupFormHeight: popupFormHeight,
                isBestFitColumn: isBestFitColumn);

            if (editValueChanged != null)
            {
                itemCtrl.EditValueChanged += editValueChanged;
                //itemCtrl.EditValueChanged += ItemCtrl_EditValueChanged;
            }

            if (keyDown != null)
            {
                itemCtrl.KeyDown += new KeyEventHandler(keyDown);
            }

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
示例#30
0
        private void InitListView(GridView view)
        {
            view.AddColumn <Train>(t => t.TName, "Zugnummer");
            view.AddColumn <Train>(t => t.Locomotive, "Tfz");
            view.AddColumn <Train>(t => t.Mbr, "Mbr");
            view.AddColumn <Train>(t => t.Last, "Last");
            view.AddColumn <Train>(t => t.Days.DaysToString(false), "Verkehrstage");
            view.AddColumn <Train>(t => t.Comment, "Kommentar");

            view.GotFocus += (s, e) => active = view;

            if (!Eto.Platform.Instance.IsWpf)
            {
                view.KeyDown += HandleKeystroke;
            }
        }