private static void Main()
        {
            using (var authenticator = new Authenticator())
            {
                var siteSelector              = new SiteSelector();
                var sourceSelector            = new SourceSelector(siteSelector, authenticator);
                var variableSelector          = new VariableSelector(sourceSelector);
                var dataCreator               = new DataCreator(variableSelector, authenticator);
                var reporter                  = new Reporter(variableSelector, authenticator);
                var siteDeletor               = new SiteDeletor(siteSelector, authenticator);
                var sourceDeletor             = new SourceDeletor(sourceSelector, authenticator);
                var importer                  = new Importer(authenticator);
                var storageLoader             = new StorageLoader(authenticator);
                var calculatedVariableManager = new CalculatedVariableManager(authenticator, sourceSelector);

                var exitCode = 99;
                int userInput;
                do
                {
                    userInput = DisplayMenu(exitCode);
                    try
                    {
                        switch (userInput)
                        {
                        case 1:
                            sourceSelector.DisplaySources().Wait();
                            break;

                        case 2:
                            dataCreator.DemoSetup().Wait();
                            break;

                        case 3:
                            dataCreator.UpdateData().Wait();
                            break;

                        case 4:
                            reporter.DisplayData().Wait();
                            break;

                        case 5:
                            siteDeletor.DeleteSite().Wait();
                            break;

                        case 6:
                            sourceDeletor.DeleteSource().Wait();
                            break;

                        case 7:
                            importer.ImportSites().Wait();
                            break;

                        case 8:
                            importer.ImportSources().Wait();
                            break;

                        case 9:
                            sourceSelector.SearchSources().Wait();
                            break;

                        case 10:
                            storageLoader.LoadFileFromString("test_upload_console.txt", "This is a simple test").Wait();
                            break;

                        case 11:
                            authenticator.RefreshToken().Wait();
                            break;

                        case 12:
                            calculatedVariableManager.CrudCalculatedVariables().Wait();
                            break;
                        }
                    }
                    catch (Exception exc)
                    {
                        Console.WriteLine(exc.Message);
                        Console.WriteLine(exc.StackTrace);
                        Console.WriteLine("Something bad happened. Please try again...");
                    }
                } while (userInput != exitCode);
                authenticator.Dispose();
            }
        }
 public CalculatedVariableManager(Authenticator authenticator, SourceSelector sourceSelector)
 {
     this.authenticator  = authenticator;
     this.sourceSelector = sourceSelector;
 }
Ejemplo n.º 3
0
 public SourceDeletor(SourceSelector sourceSelector, Authenticator authenticator)
 {
     this.sourceSelector = sourceSelector;
     this.authenticator  = authenticator;
 }
Ejemplo n.º 4
0
 public VariableSelector(SourceSelector sourceSelector)
 {
     this.sourceSelector = sourceSelector;
 }