class Program : NUIApplication
{
const string TAG = "clipboard";
+ const string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
protected override void OnCreate()
{
Window.Instance.WindowSize = new Size(1, 1);
Window.Instance.BackgroundColor = Color.White;
-
Tizen.NUI.WindowSystem.Shell.TizenShell tzShell;
tzShell = new Tizen.NUI.WindowSystem.Shell.TizenShell();
Window.Instance.SetAcceptFocus(false);
Tizen.NUI.WindowSystem.Shell.KVMService kvmService;
- // window that will act as KVM Service.
+ // Window that will act as KVM Service.
kvmService = new Tizen.NUI.WindowSystem.Shell.KVMService(tzShell, Window.Instance);
kvmService.SetSecondarySelction();
- // Add a dummy view for easy debugging.
+ // This view has nothing to do with this test, just for easy debugging.
+ // If there is a view, it is exposed to the process monitor.
View view = NewView();
Window.Instance.GetDefaultLayer().Add(view);
// Register event handler.
Clipboard.Instance.DataSelected += OnClipboardDataSelected;
+
+ // Self copy test.
+ CopyTest();
}
// When copy occurs somewhere, this callback is invoked.
Tizen.Log.Info(TAG, $"OnClipboardDataReceived type:{clipEvent.MimeType}, data:{clipEvent.Data}\n");
}
+ public void CopyTest()
+ {
+ // Self copy test.
+ // * SetData() is called 5 seconds after app execution.
+ // * Observe the Log of OnClipboardDataSelected.
+ // * If the log is output, there is a problem somewhere.
+ // * DataSelected event should not be invoked
+ // * by the SetData() called within the SecondarySelection.
+ Timer timer = new Timer(5000);
+ timer.Tick += (s, e) =>
+ {
+ string data = "Lorem ipsum dolor sit amet consectetuer";
+ Tizen.Log.Info(TAG, $"SetData type:{MIME_TYPE_PLAIN_TEXT}, data:{data}\n");
+ Clipboard.Instance.SetData(MIME_TYPE_PLAIN_TEXT, data);
+ return false;
+ };
+ timer.Start();
+ }
+
public View NewView()
{
var view = new View()