Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
Obě strany předchozí revize Předchozí verze Následující verze | Předchozí verze Následující verze Obě strany příští revize | ||
cs:mervis-db:10-api [2021/10/25 09:05] v.kohout [C#] |
cs:mervis-db:10-api [2023/03/29 17:19] 127.0.0.1 upraveno mimo DokuWiki |
||
---|---|---|---|
Řádek 157: | Řádek 157: | ||
class Program | class Program | ||
{ | { | ||
- | static | + | static |
{ | { | ||
- | // | + | try |
- | // Demo of asynchronous methods. | + | |
- | // | + | |
- | var task = Task.Run(async () => | + | |
{ | { | ||
// | // | ||
Řádek 169: | Řádek 166: | ||
// The client is automatically generated from the WSDL file available here: https:// | // The client is automatically generated from the WSDL file available here: https:// | ||
// | // | ||
- | using (HistoryDbAccessClient client = new HistoryDbAccessClient("HistoryAccess", " | + | using (HistoryDbAccessClient client = new HistoryDbAccessClient(HistoryDbAccessClient.EndpointConfiguration.HistoryAccess, |
{ | { | ||
// Authentication credetials in the database. | // Authentication credetials in the database. | ||
Řádek 186: | Řádek 183: | ||
rec.DoubleValue = 23.4; // value itself | rec.DoubleValue = 23.4; // value itself | ||
rec.Interval = 60.0; // sampling period in seconds. When the difference of timestamps of subsequent values if greater than 1.1 multiple of the interval, the data should be considered incomplete. | rec.Interval = 60.0; // sampling period in seconds. When the difference of timestamps of subsequent values if greater than 1.1 multiple of the interval, the data should be considered incomplete. | ||
- | rec.Keys = new KeyValuePair[] // | + | rec.Keys = new ESG.Db.Server.Shared.KeyValuePair[] // |
{ | { | ||
- | new KeyValuePair | + | new |
- | new KeyValuePair | + | new |
- | new KeyValuePair | + | new |
- | new KeyValuePair | + | new |
- | new KeyValuePair | + | new |
- | new KeyValuePair | + | new |
}; | }; | ||
Řádek 203: | Řádek 200: | ||
Console.WriteLine(" | Console.WriteLine(" | ||
} | } | ||
- | }); | ||
- | Console.WriteLine(" | ||
- | |||
- | try | ||
- | { | ||
- | task.Wait(); | ||
} | } | ||
catch (Exception exc) | catch (Exception exc) | ||
Řádek 277: | Řádek 268: | ||
} | } | ||
- | var res = await dbClient.ReplaceDataAsync(new List< | + | var res = await dbClient.ReplaceDataAsync(new List< |
} | } | ||
} | } | ||
Řádek 293: | Řádek 284: | ||
class Program | class Program | ||
{ | { | ||
- | static | + | static |
{ | { | ||
// | // | ||
- | // Demo of asynchronous method. | + | // Create access to the real server. |
+ | // Without SSL connections, | ||
+ | // The client is automatically generated from the WSDL file available here: https:// | ||
// | // | ||
- | var task = Task.Run(async () => | + | try |
{ | { | ||
- | // | + | using (HistoryDbAccessClient client = new HistoryDbAccessClient(HistoryDbAccessClient.EndpointConfiguration.HistoryAccess, |
- | // Create access to the real server. | + | |
- | // Without SSL connections, | + | |
- | // The client is automatically generated from the WSDL file available here: https:// | + | |
- | // | + | |
- | using (HistoryDbAccessClient client = new HistoryDbAccessClient("HistoryAccess", " | + | |
{ | { | ||
// Authentication credentials in the database. | // Authentication credentials in the database. | ||
Řádek 312: | Řádek 300: | ||
// Specification of the variables through Key-Value. | // Specification of the variables through Key-Value. | ||
// Here we use 2 variables. | // Here we use 2 variables. | ||
- | KeyValuePair[][] variableKeys = new KeyValuePair[][] { | + | ESG.Db.Server.Shared.KeyValuePair[][] variableKeys = new ESG.Db.Server.Shared.KeyValuePair[][] { |
- | new KeyValuePair[] { | + | new |
- | new KeyValuePair (false, /*Key*/ " | + | new |
- | new KeyValuePair (false, /*Key*/ " | + | new |
}, | }, | ||
- | new KeyValuePair[] { | + | new |
- | new KeyValuePair (false, /*Key*/ " | + | new |
- | new KeyValuePair (false, /*Key*/ " | + | new |
} | } | ||
}; | }; | ||
Řádek 330: | Řádek 318: | ||
aggregation.IsoPattern = new string[] { " | aggregation.IsoPattern = new string[] { " | ||
aggregation.From = new DateTime(2018, | aggregation.From = new DateTime(2018, | ||
- | aggregation.To = | + | aggregation.To = new DateTime(2018, |
aggregation.TimeZone = @" | aggregation.TimeZone = @" | ||
Řádek 384: | Řádek 372: | ||
} while (variableOffset != -1); | } while (variableOffset != -1); | ||
} | } | ||
- | }); | ||
Console.WriteLine(" | Console.WriteLine(" | ||
- | try | ||
- | { | ||
- | task.Wait(); | ||
} | } | ||
catch (Exception exc) | catch (Exception exc) | ||
Řádek 401: | Řádek 385: | ||
Console.ReadLine(); | Console.ReadLine(); | ||
} | } | ||
- | |||
} | } | ||
} | } |