在Genexus中,如何知道是针对智能设备中的Android还是IOS进行编译?
示例:
程序:
// Updating the detail lines of a sales order
public static void UpdateSO(DefaultSoapClient soapClient)
{
Console.WriteLine("Updating a sales order...");
//Sales order data
string orderType = "SO";
string customerOrder = "SO248-563-06";
// A unique value that
// identifies a sales order
string firstItemInventoryID = "CONTABLE1";
string firstItemWarehouse = "MAIN";
string secondItemInventoryID = "AALEGO500";
string secondItemWarehouse = "MAIN";
decimal secondItemQuantity = 4;
// Find the sales order to be updated
SalesOrder soToBeFound = new SalesOrder
{
OrderType = new StringSearch { Value = orderType },
CustomerOrder = new StringSearch { Value = customerOrder },
};
SalesOrder order = (SalesOrder)soapClient.Get(soToBeFound);
// Find the line to be deleted and mark it for deletion
// The Single method makes the program find
// the only SalesOrderDetail of order.Details
// that has the specified InventoryID and WarehouseID
SalesOrderDetail orderLine = order.Details.Single(orderLineToBeDeleted =>
orderLineToBeDeleted.InventoryID.Value == firstItemInventoryID &&
orderLineToBeDeleted.WarehouseID.Value == firstItemWarehouse);
orderLine.Delete = true;
// Find the line to be updated and update the quantity in it
orderLine = order.Details.Single(orderLineToBeUpdated => orderLineToBeUpdated.InventoryID.Value == secondItemInventoryID &&
orderLineToBeUpdated.WarehouseID.Value == secondItemWarehouse);
orderLine.Quantity = new DecimalValue { Value = secondItemQuantity };
// Clear the Hold check box
order.Hold = new BooleanValue { Value = false };
// Update the sales order
order = (SalesOrder)soapClient.Put(order);
// Display the summary of the updated record
Console.WriteLine("Order type: " + order.OrderType.Value);
Console.WriteLine("Order number: " + order.OrderNbr.Value);
Console.WriteLine("Ordered quantity: " + order.OrderedQty.Value);
Console.WriteLine("Order total: " + order.OrderTotal.Value);
Console.WriteLine();
Console.WriteLine("Press any key to continue");
Console.ReadLine();
}
答案 0 :(得分:1)
在编译时无法知道,但是您可以在运行时签入。
您可以在DeviceType
中使用ClientInformation
属性
&deviceType = ClientInformation.DeviceType
if &deviceType = SmartDeviceType.iOS
&variavel = 1
else // if &deviceType = SmartDeviceType.Android
&variavel = 2
endif
请参阅官方文档中的更多信息:ClientInformation external object