Пример #1
0
        public static void Main(string[] args)
        {
            CommandServiceProxy commandService = new CommandServiceProxy();

            commandService.TcpClient = new TcpClient();

            Application.Init();
            MainWindow win = new MainWindow();

            win.CommandService = commandService;
            win.Show();
            Application.Run();
        }
        public static void Generate(string[] args)
        {
            if (args.Length != 3)
            {
                throw new ArgumentException("Expected 3 arguments", nameof(args));
            }

            var serviceUrl    = args[1];
            var numberOfGames = int.Parse(args[2]);

            Console.WriteLine($"serviceUrl: {serviceUrl}");
            Console.WriteLine($"numberOfGames: {numberOfGames}");

            using (var svc = new CommandServiceProxy())
            {
                svc.SetUrl(serviceUrl);

                foreach (var cmd in GenerateSampleDataCommands(numberOfGames))
                {
                    Console.WriteLine($"Executing Command: {cmd.GetType().Name}");
                    try
                    {
                        svc.ExecuteCommand(cmd);
                    }
                    catch (AggregateException ex)
                    {
                        foreach (var x in ex.InnerExceptions)
                        {
                            Console.WriteLine(x.ToString());
                            Console.WriteLine($"Agg Inner: {x.InnerException?.ToString()}");
                        }

                        throw;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        Console.WriteLine($"Inner: {ex.InnerException?.ToString()}");
                        throw;
                    }
                }
            }
        }
Пример #3
0
        public static void Main(string[] args)
        {
            InterfaceType interfaceType = InterfaceType.GTK; // Default is GTK2

            foreach (string arg in args)
            {
                switch (arg)
                {
                case "--cli":
                    interfaceType = InterfaceType.CLI;
                    break;

                case "--gtk":
                    interfaceType = InterfaceType.GTK;
                    break;
                }
            }

            CommandServiceProxy commandService = new CommandServiceProxy();

            commandService.TcpClient = new TcpClient();

            switch (interfaceType)
            {
            case InterfaceType.GTK:
                Application.Init();
                MainWindow win = new MainWindow();
                win.CommandService = commandService;
                win.Show();
                Application.Run();
                break;

            case InterfaceType.CLI:
                MainMenu ui = new MainMenu();
                ui.CommandService = commandService;
                ui.Show();
                break;
            }
        }
Пример #4
0
        public static void Generate(string[] args)
        {
            if (args.Length != 3)
            {
                throw new ArgumentException("Expected 3 arguments", "args");
            }

            var serviceUrl    = args[1];
            var numberOfGames = int.Parse(args[2]);

            Console.WriteLine($"serviceUrl: {serviceUrl}");
            Console.WriteLine($"numberOfGames: {numberOfGames}");

            using (var svc = new CommandServiceProxy())
            {
                svc.SetUrl(serviceUrl);

                foreach (var cmd in GenerateSampleDataCommands(numberOfGames))
                {
                    Console.WriteLine($"Executing Command: {cmd.GetType().Name}");
                    svc.ExecuteCommand(cmd);
                }
            }
        }