-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
53 lines (51 loc) · 1.79 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Threading;
using System.Threading.Tasks;
using SitecoreGraphqlmport;
namespace Client
{
internal class Program
{
/// <summary>
/// Program entry point with wire-up for Ctrl-C handler and exception handling.
/// </summary>
private static async Task Main(string[] args)
{
try
{
using (var cts = new CancellationTokenSource())
{
ConsoleCancelEventHandler handler = (o, e) =>
{
Console.WriteLine("Cancelling...");
cts.CancelAfter(0);
e.Cancel = true;
};
Console.CancelKeyPress += handler;
try
{
await GetItem.GetSitecoreItem(cts.Token, "/sitecore/Content/Home");
await GetSites.GetSitecoreSites(cts.Token);
Guid home = new Guid("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}");
await CreateItem.CreateSampleItem(cts.Token, "test1",home);
await Media.RequestUploadMedia(cts.Token, "Project/jbltenant/jbl/newfolder/new2/newmedia1", "testimage.jpg");
}
finally
{
Console.CancelKeyPress -= handler;
}
}
}
catch (OperationCanceledException)
{
Console.WriteLine("Cancelled query");
}
catch (Exception ex)
{
Console.WriteLine($"Caught exception: {ex.Message}");
}
Console.WriteLine("Press enter to exit");
Console.ReadLine();
}
}
}