コード例 #1
0
ファイル: Program.cs プロジェクト: Kvesss/RPPOON_LV
        static void Main(string[] args)
        {
            NotificationManager  manager  = new NotificationManager();
            NotificationDirector director = new NotificationDirector();
            NotificationBuilder  Builder  = new NotificationBuilder();

            director.ConstructAlertNotification(Builder, "David Kvesic");
            ConsoleNotification alertNote = Builder.Build();

            manager.Display(alertNote);

            //NotificationBuilder ErrorBuilder = new NotificationBuilder();
            Builder.SetColor(ConsoleColor.Magenta);
            director.ConstructErrorNotification(Builder, "John Doe");
            Builder.SetText("Hello World!");
            ConsoleNotification errorNote = Builder.Build();

            manager.Display(errorNote);

            Builder.SetColor(ConsoleColor.Green);
            Builder.SetText("Information");
            ConsoleNotification infoNote = Builder.Build();

            director.ConstructInfoNotification(Builder, "Unknown");
            manager.Display(infoNote);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            NotificationDirector director            = new NotificationDirector();
            IBuilder             notificationBuilder = new NotificationBuilder();

            director.ConstructAlertNotification(notificationBuilder, "David Kvesic");
            ConsoleNotification note    = notificationBuilder.Build();
            NotificationManager manager = new NotificationManager();

            manager.Display(note);
        }