protected override void InitializeGrid() { base.InitializeGrid(); grid.CellStyleProvider = grid_CellStyleProvider; grid.WidthRequest = 600; grid.HeightRequest = 250; ColumnController columnController = new ColumnController(); Dictionary <bool, string> lookup = new Dictionary <bool, string> { { false, Translator.GetString("No") }, { true, Translator.GetString("Yes") } }; CellTextLookup <bool> cellTextLookup = new CellTextLookup <bool> ("Enabled") { Lookup = lookup, Alignment = Alignment.Center }; columnController.Add(new Column(Translator.GetString("Active"), cellTextLookup, 0.1, null) { MinWidth = 70 }); columnController.Add(new Column(Translator.GetString("Rule Name"), "Name", 1, null) { MinWidth = 70 }); columnController.Add(new Column(Translator.GetString("Priority"), "Priority", 0.1, null) { MinWidth = 90 }); grid.ColumnController = columnController; grid.Selection.Changed += Selection_Changed; }
protected override void InitializeGrid() { base.InitializeGrid(); ColumnController cc = new ColumnController(); Column col = new Column(Translator.GetString("Name"), "Name", 0.2, "Name") { MinWidth = 100 }; cc.Add(col); CellTextLookup <int> cellPaymentType = new CellTextLookup <int> ("BaseType") .Load(PaymentType.GetAllBaseTypePairs()); col = new Column(Translator.GetString("Type"), cellPaymentType, 0.1, "BaseType") { MinWidth = 100 }; cc.Add(col); grid.ColumnController = cc; btnGroups.Visible = false; btnGroups.Active = false; btnGroups_Toggled(null, null); }
private void InitializeDocumentNumbersGrid() { ColumnController columnController = new ColumnController(); CellTextLookup <OperationType> cellOperationType = new CellTextLookup <OperationType> ("OperationType") { Lookup = Enum.GetValues(typeof(OperationType)) .Cast <OperationType> () .Where(operationType => operationType > 0) .ToDictionary(k => k, Translator.GetOperationTypeGlobalName) }; columnController.Add(new Column(Translator.GetString("Operation"), cellOperationType, 1)); CellTextNumber cellNum = new CellTextNumber("StartNumber") { IsEditable = true, FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; Column colStart = new Column(Translator.GetString("Start number"), cellNum, 0.1) { MinWidth = 110 }; colStart.ButtonPressEvent += ColumnDocumentNumber_ButtonPressEvent; colStart.KeyPressEvent += ColumnDocumentNumber_KeyPressEvent; columnController.Add(colStart); columnController.Add(new Column(Translator.GetString("Used numbers"), new CellProgress("UsageDescription", "Usage"), 0.1) { MinWidth = 180 }); gridDocumentNumbers = new ListView { Name = "gridDocumentNumbers", ColumnController = columnController, WidthRequest = 400, AllowMultipleSelect = false, CellsFucusable = true, RulesHint = true }; scwDocumentNumbers.Add(gridDocumentNumbers); gridDocumentNumbers.Show(); }
protected override void InitializeGrid() { base.InitializeGrid(); grid.WidthRequest = 620; grid.HeightRequest = 300; ColumnController columnController = new ColumnController(); CellTextNumber cellTextNumber = new CellTextNumber("OperationId") { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; string documentNumber = Translator.GetString("Document No."); columnController.Add(new Column(documentNumber, cellTextNumber, 1, cellTextNumber.PropertyName) { MinWidth = 70 }); CellTextLookup <int> cellOperation = new CellTextLookup <int> ("OperationType"); foreach (OperationType operationType in Enum.GetValues(typeof(OperationType))) { if (operationType > 0) { cellOperation.Lookup.Add((int)operationType, Translator.GetOperationTypeGlobalName(operationType)); } } string operation = Translator.GetString("Operation"); columnController.Add(new Column(operation, cellOperation, 1, cellOperation.PropertyName) { MinWidth = 70 }); string partner = Translator.GetString("Partner"); columnController.Add(new Column(partner, "PartnerName", 2, "PartnerName") { MinWidth = 100 }); string location = Translator.GetString("Location"); columnController.Add(new Column(location, "LocationName", 2, "LocationName") { MinWidth = 100 }); CellTextCurrency cellTextDouble = new CellTextCurrency("Quantity"); string balance = Translator.GetString("Balance"); columnController.Add(new Column(balance, cellTextDouble, 1, cellTextDouble.PropertyName) { MinWidth = 70 }); grid.ColumnController = columnController; }
private void InitializeGrid() { try { if (initialized) { return; } ColumnController cc = new ColumnController(); supportsSumming = false; for (int i = 0; i < dataQueryResult.Result.Columns.Count; i++) { DbField field = dataQueryResult.Columns [i].Field; DataType fieldType = ReportProvider.GetDataFieldType(field); string columnName = dataQueryResult.Result.Columns [i]; string columnHeaderText = ReportProvider.GetReportFieldColumnName(dataQueryResult, i); CellText cell; bool thisColumnSummable = false; switch (fieldType) { case DataType.Date: cell = new CellTextDate(columnName); break; case DataType.DateTime: cell = new CellTextDateTime(columnName); break; case DataType.Quantity: cell = new CellTextQuantity(columnName); thisColumnSummable = true; break; case DataType.CurrencyIn: cell = new CellTextCurrency(columnName, PriceType.Purchase); thisColumnSummable = true; break; case DataType.CurrencyOut: cell = new CellTextCurrency(columnName); thisColumnSummable = true; break; case DataType.Currency: cell = new CellTextCurrency(columnName, PriceType.Unknown); thisColumnSummable = true; break; case DataType.Percent: cell = new CellTextDouble(columnName) { FixedFaction = BusinessDomain.AppConfiguration.PercentPrecision }; break; case DataType.Id: case DataType.UserId: cell = new CellTextNumber(columnName); break; case DataType.DocumentNumber: cell = new CellTextNumber(columnName) { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; break; case DataType.OperationType: cell = new CellTextLookup <int> (columnName); CellTextLookup <int> cellOperationType = (CellTextLookup <int>)cell; foreach (OperationType operationType in Enum.GetValues(typeof(OperationType))) { if (operationType > 0) { cellOperationType.Lookup.Add((int)operationType, Translator.GetOperationTypeName(operationType)); } } break; case DataType.DocumentType: cell = new CellTextLookup <int> (columnName).Load(DocumentBase.GetAllDocumentTypes()); break; case DataType.BasePaymentType: cell = new CellTextLookup <int> (columnName).Load(PaymentType.GetAllBaseTypePairs()); break; case DataType.PaymentType: cell = new CellTextLookup <long> (columnName); CellTextLookup <long> cellPaymentType = (CellTextLookup <long>)cell; foreach (PaymentType paymentType in PaymentType.GetAll()) { cellPaymentType.Lookup.Add(paymentType.Id, paymentType.Name); } break; case DataType.PriceGroupType: cell = new CellTextLookup <int> (columnName).Load(Currency.GetAllPriceGroups()); break; case DataType.PartnerType: cell = new CellTextLookup <int> (columnName).Load(Partner.GetAllTypes()); break; case DataType.ItemType: cell = new CellTextLookup <int> (columnName).Load(Item.GetAllTypes()); break; case DataType.UserAccessLevel: cell = new CellTextLookup <int> (columnName).Load(User.GetAllAccessLevels()); break; case DataType.TurnoverType: cell = new CellTextLookup <int> (columnName).Load(CashBookEntry.GetAllTurnoverTypes()); break; case DataType.TurnoverDirection: cell = new CellTextLookup <int> (columnName).Load(CashBookEntry.GetAllTurnoverDirections()); break; case DataType.TaxGroupCode: cell = new CellTextLookup <string> (columnName).Load(VATGroup.AllCodes); break; case DataType.Sign: cell = new CellTextLookup <int> (columnName).Load(Payment.GetAllSignTypes()); break; case DataType.PaymentMode: cell = new CellTextLookup <int> (columnName).Load(Payment.GetAllModeTypes()); break; case DataType.Text: cell = new CellText(columnName); break; default: continue; } Column col = new Column(columnHeaderText, cell, 0.1, columnName) { MinWidth = 100, Visible = !skip.Contains(field) && CheckColumnVisible(dataQueryResult, i) }; cc.Add(col); supportsSumming |= thisColumnSummable && col.Visible; } grid.ColumnController = cc; // Prevent the grid from reapplying the old sort grid.Model = null; grid.Model = model; grid.AllowSelect = true; grid.AllowMultipleSelect = true; grid.CellsFucusable = true; grid.RulesHint = true; grid.SortColumnsHint = true; grid.RowActivated -= grid_RowActivated; grid.RowActivated += grid_RowActivated; initialized = true; } finally { EventHandler onInitialized = Initialized; if (onInitialized != null) { onInitialized(this, EventArgs.Empty); } } }
protected override void InitializeGrid() { base.InitializeGrid(); ColumnController cc = new ColumnController(); CellTextLookup <bool> ctl = new CellTextLookup <bool> ("Enabled") { Alignment = Pango.Alignment.Center, Lookup = new Dictionary <bool, string> { { false, string.Empty }, { true, Translator.GetString("Yes") } } }; Column col = new Column(Translator.GetString("Enabled"), ctl, 0.1, "Enabled") { MinWidth = 70 }; cc.Add(col); col = new Column(Translator.GetString("Driver"), "DriverName", 0.1, "DriverName") { MinWidth = 200 }; cc.Add(col); col = new Column(Translator.GetString("Name"), "Name", 0.8, "Name") { MinWidth = 100 }; cc.Add(col); //ctl = new CellTextLookup<bool> ("PrintCashReceipts"); //ctl.Lookup = lookup; //ctl.Alignment = Pango.Alignment.Center; //col = new Column (Translator.GetString ("Default Printer"), ctl, 0.1, "PrintCashReceipts"); //col.MinWidth = 70; //cc.Add (col); //ctl = new CellTextLookup<bool> ("DisplaySaleInfo"); //ctl.Lookup = lookup; //ctl.Alignment = Pango.Alignment.Center; //col = new Column (Translator.GetString ("Default Display"), ctl, 0.1, "DisplaySaleInfo"); //col.MinWidth = 70; //cc.Add (col); //ctl = new CellTextLookup<bool> ("ReadIdCards"); //ctl.Lookup = lookup; //ctl.Alignment = Pango.Alignment.Center; //col = new Column (Translator.GetString ("Default Card Reader"), ctl, 0.1, "ReadIdCards"); //col.MinWidth = 70; //cc.Add (col); grid.ColumnController = cc; btnGroups.Active = BusinessDomain.AppConfiguration.ShowDevicesGroups; btnGroups.Toggled += btnGroups_Toggled; grid.RowsDraggable = false; algGridGroups.Shown += (sender, e) => grid.RowsDraggable = false; groupsPanel.GroupsTree.Selection.Changed += GroupsTreeSelection_Changed; btnGroups_Toggled(null, null); }