Mechsoft.MFiles.VAF.Workers
3.0.2
dotnet add package Mechsoft.MFiles.VAF.Workers --version 3.0.2
NuGet\Install-Package Mechsoft.MFiles.VAF.Workers -Version 3.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mechsoft.MFiles.VAF.Workers" Version="3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mechsoft.MFiles.VAF.Workers --version 3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mechsoft.MFiles.VAF.Workers, 3.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mechsoft.MFiles.VAF.Workers as a Cake Addin #addin nuget:?package=Mechsoft.MFiles.VAF.Workers&version=3.0.2 // Install Mechsoft.MFiles.VAF.Workers as a Cake Tool #tool nuget:?package=Mechsoft.MFiles.VAF.Workers&version=3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Workers for M-Files Background Operations
Manages and simplifies M-Files background operations
Dependencies
Interop.MFilesAPI
MFiles.VAF.2.1.0.4
Samples
- Sample for running background worker at specified time once a day
public class TCMBCurrencyRateFetcher : BackgroundWorkerOnceADayWithReturn<VaultApplication, Dictionary<string, double>>
{
public TCMBCurrencyRateFetcher() : base("TCMB daily currency rate fetcher", 16, 32, 00)
{
}
public override Dictionary<string, double> DoWork(VaultApplication application, BackgroundOperation operation)
{
var serializer = new XmlSerializer(typeof(CurrenyCollection));
using (var client = new WebClient())
{
using (var stream = client.OpenRead("http://www.tcmb.gov.tr/kurlar/today.xml"))
{
var root = (CurrenyCollection)serializer.Deserialize(stream);
return root.Currencies.ToDictionary(d => d.CurrencyCode, d => double.Parse(d.ForexBuying.Replace('.', ',')));
}
}
}
[XmlRoot(ElementName = "Currency")]
public class Currency
{
[XmlElement(ElementName = "CurrencyName")]
public string CurrencyName { get; set; }
[XmlElement(ElementName = "ForexBuying")]
public string ForexBuying { get; set; }
[XmlElement(ElementName = "ForexSelling")]
public string ForexSelling { get; set; }
[XmlElement(ElementName = "BanknoteBuying")]
public string BanknoteBuying { get; set; }
[XmlElement(ElementName = "BanknoteSelling")]
public string BanknoteSelling { get; set; }
[XmlElement(ElementName = "CrossRateUSD")]
public string CrossRateUSD { get; set; }
[XmlElement(ElementName = "CrossRateOther")]
public string CrossRateOther { get; set; }
[XmlAttribute(AttributeName = "CrossOrder")]
public string CrossOrder { get; set; }
[XmlAttribute(AttributeName = "CurrencyCode")]
public string CurrencyCode { get; set; }
}
[XmlRoot(ElementName = "Tarih_Date")]
public class CurrenyCollection
{
[XmlElement(ElementName = "Currency")]
public List<Currency> Currencies { get; set; }
}
}
Then use it in VaultApplication class
public class VaultApplication : VaultApplicationBase
{
protected override void StartApplication()
{
var currencyFetcher = new TCMBExchangeRateFetcher();
currencyFetcher.Successed += (sender, currencies) =>
{
var usd = currencies["USD"];
SysUtils.ReportInfoToEventLog($"USD: {usd}");
};
currencyFetcher.ErrorOccured += (sender, exception) =>
{
SysUtils.ReportErrorToEventLog("An error occured while fetching currencies. Worker will re-run after specified timespan offset", exception);
};
this.StartWorker(currencyFetcher);
}
}
Authors
- Fatih Güneş - Mechsoft Software Solutions
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
- MFiles.VAF (>= 2.1.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.2 | 1,091 | 11/26/2019 |