4 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Samples
10 public class CaptureTest : IExample
12 public void Activate()
14 log.Debug(tag, $"Activate(): start \n");
15 resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
17 window = NUIApplication.GetDefaultWindow();
18 window.TouchEvent += Win_TouchEvent;
23 Size = new Size(500, 500),
24 Position = new Position(10, 10),
25 BackgroundColor = Color.White,
30 log.Debug(tag, $"root view added \n");
32 capturedView0 = new ImageView(resourcePath + "/images/image1.jpg")
35 Size = new Size(100, 100),
36 BackgroundColor = Color.Red,
38 root.Add(capturedView0);
40 capturedView1 = new ImageView(resourcePath + "/images/image2.jpg")
43 Size = new Size(150, 150),
44 Position = new Position(150, 150),
45 BackgroundColor = Color.Yellow,
47 root.Add(capturedView1);
54 private void onCaptureFinished(object sender, CaptureFinishedEventArgs e)
56 log.Debug(tag, $"onCaptureFinished() statue={e.Success} \n");
58 if (sender is Capture)
60 log.Debug(tag, $"sender is Capture \n");
61 var url = capture.GenerateUrl();
62 capturedImage = new ImageView(url);
63 log.Debug(tag, $"url={url} \n");
65 capturedImage.Size = new Size(300, 300);
66 capturedImage.Position = new Position(10, 10);
67 root.Add(capturedImage);
72 private void Win_TouchEvent(object sender, Window.TouchEventArgs e)
74 if (e.Touch.GetState(0) == PointStateType.Down)
79 capture = new Capture();
80 capture.Start(root, new Size(345, 543), @"/opt/usr/nui_captured.jpg");
81 capture.Finished += onCaptureFinished;
82 log.Debug(tag, $"capture done \n");
87 private void tddTest()
89 log.Debug(tag, $"TDD test before Assert");
91 Assert.IsFalse(true, "TDD test, Exception throw");
93 Assert.IsFalse(false, "TDD test, Exception throw");
95 log.Debug(tag, $"TDD test after Assert");
98 private void checkCaptureNew()
100 var target = new Capture();
101 Assert.IsNotNull(target, "target should not be null");
102 Assert.IsTrue(target is Capture, "target should be Capture class");
105 public void Deactivate()
109 const string tag = "NUITEST";
110 private Window window;
111 private View root, capturedView0, capturedView1;
112 private Capture capture;
113 private ImageView capturedImage;
114 private bool done = false;
115 private string resourcePath;