/// <summary> /// Initializes a new instance of the <see cref="DemoParameter"/> class. /// </summary> /// <param name="parameter">The Falcon Connector Parameters.</param> /// <param name="displayName">The display name.</param> /// <param name="macAddress">The MAC address for tunneling connections.</param> /// <param name="isInProgMode">if set to <c>true</c> the device [is in programming mode].</param> public DemoParameter(ConnectorParameters parameter, string displayName, string macAddress, bool isInProgMode) { _parameter = parameter; _macAddress = macAddress; _isInProgMode = isInProgMode; _displayName = displayName; }
static void Main(string[] args) { var parameters = new ConnectorParameters( account: "MyAccount", pathToQuik: Terminal.GetPathToActiveQuik(), ddeServerName: "QServer"); using (var QUIK = new QConnector(parameters)) { QUIK.Connection.Connected += (sender, e) => Console.WriteLine("Connected."); QUIK.ImportStarted += (sender, e) => Console.WriteLine("Import started."); QUIK.Connect(); QUIK.StartImport(); IDataTable <Security> securitiesTable = QUIK.AddDataTable <Security>(); securitiesTable.Updated += securitiesTable_Updated; Console.ReadLine(); OrderChannel lkoh = QUIK.CreateOrderChannel("LKOH", "EQBR"); OrderResult result = lkoh.SendTransaction(Direction.Buy, price: 3000.00M, volume: 1); lkoh.KillOrder(result); Console.ReadLine(); } }
public void Map_ConnectorParameters_To_CommandButton() { ConnectorParameters parameters = new ConnectorParameters { Id = 1, ShortString = "EDT", LongString = "Edit", ConnectorData = new CommandButtonData { ButtonIcon = "fa-step-forward", Cancel = false, ClassString = "btn-secondary", GridCommandButton = true, GridId = 1 } }; CommandButton button = mapper.Map <CommandButton>(parameters); Assert.Equal(1, button.Id); Assert.Equal("EDT", button.ShortString); Assert.Equal("Edit", button.LongString); Assert.Equal("fa-step-forward", button.ButtonIcon); Assert.False(button.Cancel); Assert.Equal("btn-secondary", button.ClassString); Assert.True(button.GridCommandButton); Assert.Equal(1, button.GridId); }
public void Map_CommandButton_To_ConnectorParameters() { CommandButton button = new CommandButton { Id = 1, ShortString = "EDT", LongString = "Edit", ButtonIcon = "fa-step-forward", Cancel = false, ClassString = "btn-secondary", GridCommandButton = true, GridId = 1 }; ConnectorParameters parameters = mapper.Map <ConnectorParameters>(button); CommandButtonData data = (CommandButtonData)parameters.ConnectorData; Assert.Equal(1, parameters.Id); Assert.Equal("EDT", parameters.ShortString); Assert.Equal("Edit", parameters.LongString); Assert.Equal("fa-step-forward", data.ButtonIcon); Assert.False(data.Cancel); Assert.Equal("btn-secondary", data.ClassString); Assert.True(data.GridCommandButton); Assert.Equal(1, data.GridId); }
protected override bool InternalEquals(ConnectorParameters other) { if (other.Equals(_parameter)) { return(true); } return(false); }
/// <summary> /// Deseriliazes the specified XML element to its corresponding /// <seealso cref="ConnectorParameters"/> representation. /// </summary> /// <param name="element">The element containing the connector parameters to be deserialized.</param> public static ConnectorParameters Parse(XElement element) { var parameters = element.Elements().FirstOrDefault(e => e.Name.LocalName == XmlMetadataSchema.ConnectorParametersElement); var excludeUndeclared = element.Attribute(XmlMetadataSchema.ExcludeUndeclared).ValueOrDefault(false); return(null == parameters ? ConnectorParameters.DefaultInstance() : new ConnectorParameters(ParseParameters(parameters), excludeUndeclared)); }
public EntityAttribute([NotNull] string name, [NotNull] string type, bool isRequired, bool isAutoGenerated, [NotNull] ConnectorParameters connectorParameters, string query) { Validate.NotNull(name, "name"); Validate.NotNull(type, "type"); Validate.NotNull(connectorParameters, "connectorParameters"); _name = name; _type = type; Query = query; _isRequired = isRequired; _connectorParameters = connectorParameters; _isAutoGenerated = isAutoGenerated; IgnoreCoalesce = false; }
public EntityMetadata([NotNull] string name, [NotNull] EntitySchema schema, [NotNull] IEnumerable <EntityAssociation> associations, [NotNull] ConnectorParameters connectorParameters) { Validate.NotNull(name, "name"); Validate.NotNull(schema, "schema"); Validate.NotNull(associations, "associations"); Validate.NotNull(connectorParameters, "connectorParameters"); _name = name; _schema = schema; _associations = new HashSet <EntityAssociation>(associations); _connectorParameters = connectorParameters; _relationshipAttributes = new Lazy <IEnumerable <EntityAttribute> >(AddRelationshipAttributes); _nonCollectionrelationshipAttributes = new Lazy <IEnumerable <EntityAttribute> >(AddNonCollectionRelationshipAttributes); }
public static SlicedEntityMetadata GetInstance(EntityMetadata entityMetadata, ApplicationSchemaDefinition appSchema, int?fetchLimit = 300, bool isUnionSchema = false) { var entityAttributes = entityMetadata.Schema.Attributes; var usedRelationships = new HashSet <EntityAssociation>(); ISet <EntityAttribute> usedAttributes = new HashSet <EntityAttribute>(); foreach (var field in appSchema.NonRelationshipFields) { if (field.Attribute.StartsWith("#null")) { usedAttributes.Add(new EntityAttribute(field.Attribute, "varchar", false, true, ConnectorParameters.DefaultInstance(), null)); } else { var entityAttribute = entityAttributes.FirstOrDefault(r => field.Attribute == r.Name); if (entityAttribute != null) { usedAttributes.Add(entityAttribute); } } } usedAttributes.Add(entityMetadata.Schema.IdAttribute); if (!isUnionSchema) { usedAttributes.Add(entityMetadata.Schema.RowstampAttribute); } usedRelationships.UnionWith(HandleAssociations(appSchema.Associations, entityMetadata)); usedRelationships.UnionWith(HandleCompositions(appSchema.Compositions, entityMetadata, appSchema)); var result = SlicedRelationshipBuilderHelper.HandleRelationshipFields(appSchema.RelationshipFields.Select(r => r.Attribute), entityMetadata); usedRelationships.UnionWith(result.DirectRelationships); var schema = new EntitySchema(entityMetadata.Name, usedAttributes, entityMetadata.Schema.IdAttribute.Name, false, false, entityMetadata.Schema.WhereClause, entityMetadata.Schema.ParentEntity, !isUnionSchema); SlicedEntityMetadata unionSchema = null; if (appSchema.UnionSchema != null) { unionSchema = GetUnionInstance(appSchema.UnionSchema); } return(new SlicedEntityMetadata(entityMetadata.Name, schema, usedRelationships, entityMetadata.ConnectorParameters, appSchema, result.InnerEntityMetadatas, fetchLimit, unionSchema)); }
static void Main(string[] args) { var ip = new DiscoveryClient(AdapterTypes.All).Discover().FirstOrDefault(); var usb = UsbDeviceEnumerator.GetAvailableInterfaces(TimeSpan.FromSeconds(2)); ConnectorParameters selectedConnector = usb.First(); using (var bus = new Bus(selectedConnector)) { using (var bus2 = new Bus(new KnxIpTunnelingConnectorParameters(ip.IpAddress.ToString(), 0x0e57, false))) { bus.Connect(); bus2.Connect(); WriteLine("BUS1: Connected to " + bus.OpenParameters); WriteLine("BUS2: Connected to " + bus2.OpenParameters); bus.GroupValueReceived += args => { if (bus.LocalIndividualAddress != args.IndividualAddress) { WriteLine( "BUS1: " + "IndividualAddress: " + args.IndividualAddress + " Value: " + args.Value + " Address:" + args.Address); bus2.WriteValue(args.Address, args.Value, args.TelegramPriority); } }; bus2.GroupValueReceived += args => { if (bus2.LocalIndividualAddress != args.IndividualAddress) { WriteLine( "BUS2: " + "IndividualAddress: " + args.IndividualAddress + " Value: " + args.Value + " Address:" + args.Address); bus.WriteValue(args.Address, args.Value, args.TelegramPriority); } }; while (true) { } } } }
public void Map_ConnectorParameters_To_CommandButtonDescriptor() { ConnectorParameters parameters = new ConnectorParameters { Id = 1, ShortString = "EDT", LongString = "Edit", ConnectorData = new CommandButtonParameters("SubmitCommand", "Save") }; CommandButtonDescriptor button = mapper.Map <CommandButtonDescriptor>(parameters); Assert.Equal(1, button.Id); Assert.Equal("EDT", button.ShortString); Assert.Equal("Edit", button.LongString); Assert.Equal("Save", button.ButtonIcon); Assert.Equal("SubmitCommand", button.Command); }
/// <summary> /// Initializes a new instance of the <see cref="DemoParameter"/> class. /// </summary> /// <param name="info">The serialization info.</param> /// <param name="context">The streaming context.</param> public DemoParameter(SerializationInfo info, StreamingContext context) { string type = info.GetString("Type"); if (type == "KnxIpRouting") { _parameter = new KnxIpSecureRoutingConnectorParameters(info, context); } else if (type == "KnxIpTunneling") { _parameter = new KnxIpTunnelingConnectorParameters(info, context); } else if (type == "USB") { _parameter = new UsbConnectorParameters(info, context); } _macAddress = info.GetString("MacAddress"); _isInProgMode = info.GetBoolean("isInProgMode");; _displayName = info.GetString("DisplayName");; }
public static EntityAttribute RowstampEntityAttribute() { return(new EntityAttribute(RowstampColumnName, TimestampAttributeType(), false, true, ConnectorParameters.DefaultInstance(), null)); }
public TargetParsingResult(EntityTargetSchema targetSchema, ConnectorParameters parameters) { this.TargetSchema = targetSchema; this.Parameters = parameters; }
/// <summary> /// Initializes a new instance of the <see cref="DemoParameter"/> class. /// </summary> /// <param name="parameter">The Falcon Connector Parameters.</param> /// <param name="displayName">The display name.</param> public DemoParameter(ConnectorParameters parameter, string displayName) { _parameter = parameter; _displayName = displayName; }
public SlicedEntityMetadata([NotNull] string name, [NotNull] EntitySchema schema, [NotNull] IEnumerable <EntityAssociation> associations, [NotNull] ConnectorParameters connectorParameters, ApplicationSchemaDefinition appSchema, IEnumerable <SlicedEntityMetadata> innerMetadatas, int?fetchLimit = 300, SlicedEntityMetadata unionSchema = null) : base(name, schema, associations, connectorParameters) { _appSchema = appSchema; _fetchLimit = fetchLimit; _innerMetadatas.AddRange(innerMetadatas); _unionSchema = unionSchema; }
/// <summary> /// Fetch all available connectors /// </summary> /// <returns>An array of connectors</returns> public async Task <PageResults <Connector> > FetchConnectors(ConnectorParameters requestParams = null) { return(await httpService.GetAsync <PageResults <Connector> >(URL_CONNECTORS, null, requestParams?.ToQueryStrings())); }
public ContextualEntityAttribute([NotNull] string name, [NotNull] string type, bool isRequired, bool isAutoGenerated, [NotNull] ConnectorParameters connectorParameters, string query, string context) : base(name, type, isRequired, isAutoGenerated, connectorParameters, query) { Context = context; }
/// <summary> /// This is a walkthrough on how to create an item (connection) first time. /// </summary> /// <param name="sdk">Pluggy's api client</param> /// <returns></returns> private static async Task CreateItem(SDK.PluggyAPI sdk) { // 1 - Let's list all available connectors var reqParams = new ConnectorParameters { Countries = new List <string> { "AR", "BR" }, Types = new List <ConnectorType> { ConnectorType.PERSONAL_BANK, ConnectorType.BUSINESS_BANK, ConnectorType.INVESTMENT }, Name = "", Sandbox = true }; var connectors = await sdk.FetchConnectors(reqParams); Helpers.WriteConnectorList(connectors.Results); // 2 - Select a connector Console.WriteLine("Which connector do you want to execute?"); string connectorNumberResponse = Console.ReadLine(); long connectorId = long.Parse(connectorNumberResponse); // Fetch that connector and display Connector connector = await Helpers.FetchConnector(sdk, connectorId); if (connector == null) { return; } Console.WriteLine("Executing {0}", connector.Name); // 3 - Ask for credentials to execute this connector ItemParameters request = Helpers.AskCredentials(connector.Id, connector.Credentials); // 4 - Validate credentials input if its valid // This step is not mandatory, the CreateItem request will do it for you. ValidationResult validationResult = await sdk.ValidateCredentials(connector.Id, request.Parameters); if (validationResult.Errors.Count > 0) { Console.WriteLine("There were validation errors:"); Helpers.WriteJson(validationResult.Errors); return; } // 5 - Starts & retrieves the item metadata Console.WriteLine("Starting your connection based on the information provided"); DateTime started = DateTime.Now; Item item = await Helpers.CreateItem(sdk, request); if (item == null) { return; } Console.WriteLine("Connection to Item {0} started", item.Id); // 6 - Reviews connection status and collects response item = await Helpers.WaitAndCollectResponse(sdk, item); Console.WriteLine("Connection has been completed"); if (item.Error != null) { switch (item.Error.Code) { case ExecutionErrorCode.INVALID_CREDENTIALS: Console.WriteLine("The credentials sent where invalid"); break; case ExecutionErrorCode.INVALID_CREDENTIALS_MFA: Console.WriteLine("The introduced MFA was invalid"); break; default: Console.WriteLine("Connection encoutered errors, {0}", item.Error.Message); break; } return; } else { Console.WriteLine("Connection was completed successfully in {0}s", (DateTime.Now - started).TotalSeconds); } await Helpers.PrintResults(sdk, item); // 7 - If needed, delete the connection result from the cache. Console.WriteLine("Do you want to delete the Connection? (y/n)"); bool delete = Console.ReadLine() == "y"; if (delete) { // Although this will be deleted in 30', we are forcing clean up await sdk.DeleteItem(item.Id); Console.WriteLine("Deleted response successfully"); } }
public EntityTargetAttribute([NotNull] string name, [NotNull] string type, bool isRequired, [NotNull] ConnectorParameters connectorParameters, string targetPath) : base(name, type, isRequired, false, connectorParameters, null) { TargetPath = targetPath; }