private void InitializeGrid() { gridBarcodes = new ListView(); ColumnController columnController = new ColumnController(); Column column = new Column(string.Empty, new CellText(string.Empty) { IsEditable = true }, 1); column.ButtonPressEvent += Column_ButtonPressEvent; column.KeyPressEvent += Column_KeyPressEvent; columnController.Add(column); scwGrid.Add(gridBarcodes); gridBarcodes.HeaderVisible = false; gridBarcodes.Show(); BindingListModel <string> bindingListModel = new BindingListModel <string> (barcodes); gridBarcodes.ColumnController = columnController; gridBarcodes.Model = bindingListModel; gridBarcodes.AllowSelect = false; gridBarcodes.CellsFucusable = true; gridBarcodes.ManualFucusChange = true; gridBarcodes.RulesHint = true; gridBarcodes.CellKeyPressEvent += GridBarcodes_CellKeyPressEvent; gridBarcodes.CellFocusIn += GridBarcodes_CellFocusIn; }
private void SelectDocumentType(OperationNumberingInfo operation) { SelectLocation(operation.LocationId); BindingListModel <OperationNumberingInfo> modelNumbers = (BindingListModel <OperationNumberingInfo>)gridDocumentNumbers.Model; int index = modelNumbers.FindIndex(o => o.OperationType == operation.OperationType); gridDocumentNumbers.Selection.Clear(); gridDocumentNumbers.Selection.Select(index); gridDocumentNumbers.ScrollToV(index); }
protected override void GetAllEntities() { if (!selectedGroupId.HasValue || selectedGroupId <= 0) { entities = new BindingListModel <Device> (Device.GetAll()); } else { entities = new BindingListModel <Device> (Device.GetAllByType((DeviceType)selectedGroupId)); } entities.FilterProperties.Add("Name"); grid.Model = entities; }
private string GetShortRangeWarning(OperationNumberingInfo operation, OperationNumberingInfo nextOperation, bool minimal, long maxId) { BindingListModel <Location> locations = (BindingListModel <Location>)gridLocations.Model; string currentLocation = locations.Find(l => l.Id == operation.LocationId).Name; string nextLocation = string.Empty; string message; if (nextOperation != null) { if (minimal) { message = Translator.GetString("The numbers between the start numbers for locations \"{0}\" and \"{1}\" " + "for operations of type \"{2}\" are less than the minimal value of {3}."); } else { message = Translator.GetString("The numbers between the start numbers for locations \"{0}\" and \"{1}\" (possibly other ranges too) " + "for operations of type \"{2}\" are less than the recommended value of {3}. " + "Are you sure you want to continue?"); } nextLocation = locations.Find(l => l.Id == nextOperation.LocationId).Name; } else { if (minimal) { message = Translator.GetString("The numbers between the start number for location \"{0}\" and the maximal operation number {4} " + "for operations of type \"{2}\" are less than the minimal value of {3}."); } else { message = Translator.GetString("The numbers between the start number for location \"{0}\" and the maximal operation number {4} (possibly other ranges too) " + "for operations of type \"{2}\" are less than the recommended value of {3}. " + "Are you sure you want to continue?"); } } string operationType = Translator.GetOperationTypeGlobalName(operation.OperationType); return(string.Format(message, currentLocation, nextLocation, operationType, minimal ? OperationNumberingInfo.MINIMAL_NUMBERS_PER_LOCATION : OperationNumberingInfo.RECOMMENDED_NUMBERS_PER_LOCATION, maxId.ToString("N", formatBigNumber))); }
public ExportDocuments(Type sourceObjectType, string fileName) : base(null, BusinessDomain.DocumentExporters) { defaultFileName = fileName; exchangersModel = new BindingListModel <IDataExchanger> (exchangers .Where(exporter => exporter.SupportsType(sourceObjectType) && exporter.IsAvailable), false); exchangersModel.Sort("ExchangeType", SortDirection.Ascending); grid.Model = exchangersModel; for (int i = 0; i < exchangersModel.Count; i++) { if (exchangersModel [i].GetType().Name != BusinessDomain.AppConfiguration.LastDocsExporter) { continue; } defaultSelectedRow = i; break; } }
private void LoadExchangers() { IEnumerable <IDataExchanger> exchangerNames = exchangers .Where(exporter => exporter.SupportsType(typeof(T)) && exporter.IsAvailable); exchangersModel = new BindingListModel <IDataExchanger> (exchangerNames, false); exchangersModel.Sort("ExchangeType", SortDirection.Ascending); grid = new ListView(); ScrolledWindow sWindow = new ScrolledWindow { HscrollbarPolicy = PolicyType.Automatic, VscrollbarPolicy = PolicyType.Automatic }; sWindow.Add(grid); algGrid.Add(sWindow); sWindow.Show(); grid.Show(); ColumnController cc = new ColumnController(); Column col = new Column(IsExport ? Translator.GetString("Export Type") : Translator.GetString("Import Type"), "ExchangeType", 0.2, "ExchangeType") { MinWidth = 70, ListCell = { IsEditable = false } }; cc.Add(col); grid.ColumnController = cc; grid.Model = exchangersModel; grid.AllowMultipleSelect = false; grid.CellsFucusable = true; grid.RulesHint = true; grid.SortColumnsHint = true; grid.Realized += grid_Realized; grid.Selection.Changed += grid_SelectionChanged; }
/// <summary> /// Initializes the form by reading its *.glade file and setting other necessary properties. /// </summary> protected override void InitializeForm() { XML form = FormHelper.LoadGladeXML("Dialogs.EditDocumentNumbersPerLocation.glade", "dlgEditDocumentNumbersPerLocation"); form.Autoconnect(this); dlgEditDocumentNumbersPerLocation.Icon = FormHelper.LoadImage("Icons.Location16.png").Pixbuf; btnOK.SetChildImage(FormHelper.LoadImage("Icons.Ok24.png")); btnCancel.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png")); base.InitializeForm(); InitializeDocumentNumbersGrid(); InitializeLocationsGrid(); if (allStartNumbersPerLocation.Count > 0) { BindingListModel <OperationNumberingInfo> model = allStartNumbersPerLocation [0].Value; if (model.Count > 0) { spbRangeStart.Value = model [0].StartNumber; } } if (allStartNumbersPerLocation.Count > 1) { BindingListModel <OperationNumberingInfo> model = allStartNumbersPerLocation [1].Value; if (model.Count > 0) { spbRangeSize.Value = model [0].StartNumber - spbRangeStart.Value; } } InitializeFormStrings(); loading = false; }
private ConfirmPriceRules(IEnumerable <PriceRule> rulesToApply, Operation <T> operation, bool priceWithVAT = false) { this.rulesToApply = new List <PriceRule> (rulesToApply); Initialize(); gridOperationDetails = new ListView { Name = "gridOperationDetails", WidthRequest = 600, HeightRequest = 250 }; ColumnController columnController = new ColumnController(); columnController.Add(new Column(Translator.GetString("Item"), "ItemName", 1)); CellTextQuantity cellQuantity = new CellTextQuantity("Quantity"); Column columnQuantity = new Column(Translator.GetString("Qtty"), cellQuantity, 0.1) { MinWidth = 55 }; columnController.Add(columnQuantity); CellTextDouble cellPrice = new CellTextCurrency(priceWithVAT ? "OriginalPriceOutPlusVAT" : "OriginalPriceOut"); Column columnPrice = new Column(Translator.GetString("Price"), cellPrice, 0.1) { MinWidth = 55 }; columnController.Add(columnPrice); CellTextDouble cellDiscount = new CellTextDouble("Discount"); cellDiscount.FixedFaction = BusinessDomain.AppConfiguration.PercentPrecision; Column columnDiscount = new Column(Translator.GetString("Discount %"), cellDiscount, 0.1); columnDiscount.Visible = BusinessDomain.AppConfiguration.AllowPercentDiscounts; columnDiscount.MinWidth = 100; columnController.Add(columnDiscount); BindingListModel <T> model = GetChangedDetails(operation); PriceType priceType = PriceType.SaleTotal; if (model.Count > 0) { priceType = model [0].TotalsPriceType; } CellTextDouble cellTotal = new CellTextCurrency(priceWithVAT ? "TotalPlusVAT" : "Total", priceType); Column columnTotal = new Column(Translator.GetString("Amount"), cellTotal, 0.1) { MinWidth = 55 }; columnController.Add(columnTotal); gridOperationDetails.ColumnController = columnController; gridOperationDetails.Model = model; scwOperationDetails.Add(gridOperationDetails); gridOperationDetails.Show(); CellRendererToggle cellRendererToggle = new CellRendererToggle { Activatable = true }; cellRendererToggle.Toggled += (o, args) => { TreeIter row; TreePath treePath = new TreePath(args.Path); treeviewPriceRules.Model.GetIter(out row, treePath); PriceRule priceRule = (PriceRule)treeviewPriceRules.Model.GetValue(row, 2); bool value = !(bool)treeviewPriceRules.Model.GetValue(row, 0); if (value) { if (treePath.Indices [0] <= this.rulesToApply.Count) { this.rulesToApply.Insert(treePath.Indices [0], priceRule); } else { this.rulesToApply.Add(priceRule); } } else { this.rulesToApply.Remove(priceRule); } gridOperationDetails.Model = GetChangedDetails(operation); treeviewPriceRules.Model.SetValue(row, 0, value); }; treeviewPriceRules.AppendColumn(string.Empty, cellRendererToggle, "active", 0); treeviewPriceRules.AppendColumn(Translator.GetString("Price rule"), new CellRendererText(), "text", 1); treeviewPriceRules.AppendColumn(Translator.GetString("Price rule"), new CellRendererText(), "text", 2).Visible = false; TreeStore treeStore = new TreeStore(typeof(bool), typeof(string), typeof(object)); foreach (PriceRule priceRule in this.rulesToApply) { treeStore.AppendValues(true, priceRule.Name, priceRule); } treeviewPriceRules.Model = treeStore; }
private void InitializeGrid() { model = new BindingListModel <MoneyContainer> (list); model.ListChanged += model_ListChanged; model.Sort("Amount", SortDirection.Ascending); }
public BindingListView(BindingListModel model) { this.model = model; }
public ExportObjects(string fileName, params IDataExchanger [] dataExchangers) : base(null, fileName) { grid.Model = exchangersModel = new BindingListModel <IDataExchanger> (dataExchangers); grid.Selection.Select(0); }