コード例 #1
0
        static void DrawUI(Systems system)
        {
            Console.WriteLine($"-----{system}-----");

            var ui = UIFactory.Get(system);

            if (ui == null)
            {
                Console.WriteLine($"UI [{system}] not emplemented error!'");
                return;
            }

            var button = ui.CreateButton();

            button.Render();

            var select = ui.CreateSelect();

            select.Render();
        }
コード例 #2
0
        private static void Main(string[] args)
        {
            UIFactory uiFactory = null;

            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Console.WriteLine("Sorry, program does not contain UI system for Linus OS for now. Keep trying.");
                return;
            }

            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                uiFactory = new WindowsUIFactory();
            }
            else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                uiFactory = new MacUIFactory();
            }

            Console.WriteLine($"UI is built on top of {uiFactory} respectively to OS where you run this program.");
        }