コード例 #1
0
        private static void AlarmRemovealRequests(ClientProxy proxy)
        {
            var requests = proxy.GetClientRemovalRequests();

            if (requests.Item2)
            {
                Console.WriteLine("Getting clients removal requests...");
                foreach (string item in requests.Item1)
                {
                    Console.WriteLine($"Request from client: {item}");
                    string response;
                    do
                    {
                        Console.Write($"Allow request? (Y/N): ");
                        response = Console.ReadLine();
                    } while (!(response.Equals("Y", StringComparison.OrdinalIgnoreCase) || response.Equals("N", StringComparison.OrdinalIgnoreCase)));

                    if (response.Equals("Y", StringComparison.OrdinalIgnoreCase))
                    {
                        if (proxy.ApprovedRemoval(item))
                        {
                            Console.WriteLine("Request approved.");
                        }
                    }
                    if (response.Equals("N", StringComparison.OrdinalIgnoreCase))
                    {
                        if (proxy.DeniedRemoval(item))
                        {
                            Console.WriteLine("Request denied.");
                        }
                    }
                }
            }
        }