private void DisplayConsumerWindow(string workingDirectory, DemoAppLauncherSelection appSelection)
        {
            Console.WriteLine($"Command Parameters: {appSelection.ToString()} {BrokerAppType.Consumer.ToString()}");
            var windowLayout = GetConsumerWindowLayout(appSelection);
            var windowHandle = ProcessCommand.StartProgram(workingDirectory, appSelection, BrokerAppType.Consumer, windowLayout);

            _windowHandles.Add(windowHandle);
        }
        public void DisplayBrokerConsole(string workingDirectory, DemoAppLauncherSelection appSelection)
        {
            while (true)
            {
                Console.WriteLine(Enum.GetName(typeof(DemoAppLauncherSelection), appSelection));
                Console.WriteLine("Type the number of the application to start and then press [enter].");

                foreach (var value in Enum.GetValues(typeof(BrokerAppLauncherSelection)))
                {
                    Console.WriteLine($"{(int)value} - {value}");
                }

                var selection = Console.ReadLine();
                Console.Clear();
                Console.WriteLine($"Working Directory: {workingDirectory}");

                if (string.IsNullOrEmpty(selection))
                {
                    continue;
                }

                BrokerAppLauncherSelection brokerAppSelection = (BrokerAppLauncherSelection)Enum.Parse(typeof(BrokerAppLauncherSelection), selection);

                if (brokerAppSelection != BrokerAppLauncherSelection.Exit)
                {
                    switch (brokerAppSelection)
                    {
                    case BrokerAppLauncherSelection.Publisher:
                        DisplayPublisherWindow(workingDirectory, appSelection);
                        ProcessCommand.FocusProcess(_windowHandles.Last());
                        break;

                    case BrokerAppLauncherSelection.Consumer:
                        DisplayConsumerWindow(workingDirectory, appSelection);
                        break;

                    case BrokerAppLauncherSelection.All:
                        DisplayConsumerWindow(workingDirectory, appSelection);
                        DisplayConsumerWindow(workingDirectory, appSelection);
                        DisplayConsumerWindow(workingDirectory, appSelection);
                        DisplayPublisherWindow(workingDirectory, appSelection);
                        var publisherHandle = _windowHandles.Last();
                        ProcessCommand.FocusProcess(publisherHandle);
                        break;
                    }
                }
                else
                {
                    CloseWindows();
                    _windowLayouts = new List <WindowLayout>();
                    _windowHandles = new List <IntPtr>();
                    break;
                }
            }
        }
 public void CloseWindows()
 {
     ProcessCommand.CloseWindows(_windowHandles);
 }
예제 #4
0
 private static void CloseWindow(IntPtr hwnd)
 {
     ProcessCommand.SendMessage(hwnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
 }