Created
October 9, 2019 10:18
-
-
Save SirRufo/496f0c76193c25d9bf48af0f50b1f619 to your computer and use it in GitHub Desktop.
Async Await sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async Task Main(string[] args) | |
{ | |
args = new string[] { "ARGUMENT1" };//test | |
if (args != null && args.Length > 0) | |
{ | |
var task = args[0]; | |
if (task == "ARGUMENT1") | |
{ | |
var form = new SerializerForm(); | |
try | |
{ | |
await form.SerializeDbToSQLiteAsync(); | |
await form.CompressDatabaseAsync(); | |
await form.FtpUploadAsync(); | |
await form.SendMailAsync($"Serializer complete"); | |
} | |
catch (Exception ex) | |
{ | |
string errorMessage = $"ex..."; | |
await form.SendMailAsync(errorMessage); | |
await form.LogAsync("SerializationScheduled", errorMessage); | |
} | |
} | |
else | |
{ | |
var form = new DeserializerForm(); | |
//perform deserialization | |
} | |
else | |
{ | |
//normal esecution windows form | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment