Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine();
            Console.WriteLine(" test Action Result ");
            //text class actioResult
            ActionResult actionResult = new ActionResult("***this message ***", true);

            Console.WriteLine($"action result {actionResult.Message} and {actionResult.Succes}");

            Console.WriteLine();
            Console.WriteLine(" test Class ImagePhoto ");
            //text class ImagePhoto
            ImagePhoto imagePhoto = new ImagePhoto(@"C:\myImages\myImage", DateTime.Now, ".jpg", true);
            string     result     = imagePhoto.GetSnap();

            Console.WriteLine($"ImagePhoto {result} ");

            //test class ImgePhoto noCamera
            imagePhoto = new ImagePhoto(@"C:\myImages\myImage", DateTime.Now, ".jpg", false);
            result     = imagePhoto.GetSnap();
            Console.WriteLine($"ImagePhoto {result} ");

            //test interface per HUAWEI
            Console.WriteLine();
            Console.WriteLine(" test ICamera ");
            //test activate
            //
            HuaweiCamera huaweiCamera = new HuaweiCamera();
            ActionResult HuaweiResult = huaweiCamera.Activate();

            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive: {HuaweiResult.Succes}");
            //activate when already active
            HuaweiResult = huaweiCamera.Activate();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            //deActivate when already active
            HuaweiResult = huaweiCamera.DeActivate();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            //deActivate when already deactive
            HuaweiResult = huaweiCamera.DeActivate();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            //ChargeCamera
            HuaweiResult = huaweiCamera.ChargeCamera();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            //set Camera when non activated
            HuaweiResult = huaweiCamera.SetCamera();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            //test new activate
            huaweiCamera = new HuaweiCamera();
            HuaweiResult = huaweiCamera.Activate();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            //set Camera after activated
            HuaweiResult = huaweiCamera.SetCamera();
            Console.WriteLine($"HuaweiResult {HuaweiResult.Message} and isActive {HuaweiResult.Succes}");

            ImagePhoto HuaweiPhotoResult = huaweiCamera.TakeSnap();

            Console.WriteLine($"HuaweiPhotoResult { HuaweiPhotoResult.GetSnap()}");

            //$"snapTaken {_snapName}{_snapDate.ToString("dMMyyyy")}{_snapFormat}
            //Console.WriteLine($"HuaweiPhotoResult {HuaweiPhotoResult.SnapName}{HuaweiPhotoResult.DateSnap.ToString("dMMyyyy")}{HuaweiPhotoResult.SnapFormat}");

            //test interface per IPHONE
            Console.WriteLine();
            Console.WriteLine(" test ICamera ");


            IPhoneCamera iphoneCamera = new IPhoneCamera();
            ActionResult iphoneResult = iphoneCamera.Activate();

            //
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive: {iphoneResult.Succes}");
            //activate when already active
            iphoneResult = iphoneCamera.Activate();
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            //deActivate when already active
            iphoneResult = iphoneCamera.DeActivate();
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            //deActivate when already deactive
            iphoneResult = iphoneCamera.DeActivate();
            Console.WriteLine($"IPhoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            //ChargeCamera
            iphoneResult = iphoneCamera.ChargeCamera();
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            //set Camera when non activated
            iphoneResult = iphoneCamera.SetCamera();
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            //test new activate
            huaweiCamera = new HuaweiCamera();
            iphoneResult = iphoneCamera.Activate();
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            //set Camera after activated
            iphoneResult = iphoneCamera.SetCamera();
            Console.WriteLine($"IphoneResult {iphoneResult.Message} and isActive {iphoneResult.Succes}");

            ImagePhoto IphonePhotoResult = iphoneCamera.TakeSnap();

            Console.WriteLine($" IphonePhotoResult {  IphonePhotoResult.GetSnap()}");

            Console.WriteLine();
            Console.WriteLine(" test noCamera ");
            // test NoCamera for Nokia
            NoCamera     nokiaCamera = new NoCamera();
            ActionResult nokiaResult = nokiaCamera.Activate();

            Console.WriteLine($"NokiaResult {nokiaResult.Message} and isActive: {nokiaResult.Succes}");

            //
            ImagePhoto NokiaPhotoResult = nokiaCamera.TakeSnap();

            Console.WriteLine($" NokiaPhotoResult {  NokiaPhotoResult.GetSnap()}");


            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //instane IphoneCamera
            Console.WriteLine("_______");
            IphoneCamera iphoneCamera = new IphoneCamera("Iphone's Camera", TypeCamera.FRONT, false);

            Console.WriteLine("***IPHONE*****");
            //with getDescrption non override in IphoneCamera commented
            Console.WriteLine($"result {iphoneCamera.GetDescription("Iphone's Camera", TypeCamera.FRONT)} is activate ? {iphoneCamera.Activate()} ");
            //with getDescription override in IphoneCamera uncommented
            //Console.WriteLine($"result {iphoneCamera.GetDescription("Iphone's Camera", TypeCamera.FRONT)} is activate ? {iphoneCamera.Activate()} ");
            Console.WriteLine($"result after deactivated {iphoneCamera.GetDescription("Iphone's Camera", TypeCamera.FRONT)} is activate ? {iphoneCamera.DeActivate()} ");
            Console.WriteLine("********");
            Console.WriteLine($"result after setCamera {iphoneCamera.SetCamera()}");
            Console.WriteLine("********");
            Console.WriteLine($"result after Charge Camera {iphoneCamera.ChargeCamera()}");
            Console.WriteLine("********");
            Console.WriteLine($"result after Take Picture {iphoneCamera.TakePicture()}");
            Console.WriteLine("_______");

            //instane Samsung Camera
            Console.WriteLine("***SAMSUNG*****");
            SamsungCamera samsungCamera = new SamsungCamera("Samsung Camera", TypeCamera.REAR, false);

            //with getDescrption non override in IphoneCamera commented
            Console.WriteLine($"result {samsungCamera.GetDescription("Samsung Camera", TypeCamera.REAR)} is activate ? {samsungCamera.Activate()} ");
            //with getDescription override in samsungCamera uncommented
            //Console.WriteLine($"result {samsungCamera.GetDescription("Samsung's Camera", TypeCamera.FRONT)} is activate ? {samsungCamera.Activate()} ");
            // Console.WriteLine($"result after deactivated {samsungCamera.GetDescription("Samsung Camera", TypeCamera.REAR)} is activate ? {samsungCamera.DeActivate()} ");
            // Console.WriteLine("********");
            Console.WriteLine($"result after setCamera {samsungCamera.SetCamera()}");
            Console.WriteLine("********");
            Console.WriteLine($"result after Charge Camera {samsungCamera.ChargeCamera()}");
            Console.WriteLine("********");
            Console.WriteLine($"result after Take Picture {samsungCamera.TakePicture()}");
            Console.WriteLine("********");

            //istanziate nocamera
            Console.WriteLine("***NOKIA NO CAMERA*****");
            NoCamera nokiaNocamera = new NoCamera("Nokia no Camera", TypeCamera.NOCAMERA, false);

            //with getDescrption non override in IphoneCamera commented
            Console.WriteLine($"result {nokiaNocamera.GetDescription("Nokia no Camera", TypeCamera.NOCAMERA)} is activate ? {nokiaNocamera.Activate()} ");
            //with getDescription override in samsungCamera uncommented
            Console.ReadLine();
        }