Beispiel #1
0
        /// <summary>
        /// Creates a new Quickpanel Client handle.
        /// </summary>
        /// <param name="tzShell">The TizenShell instance.</param>
        /// <param name="win">The window to provide service of the quickpanel.</param>
        /// <param name="type">The type of quickpanel service.</param>
        /// <exception cref="Tizen.Applications.Exceptions.OutOfMemoryException">Thrown when the memory is not enough to allocate.</exception>
        /// <exception cref="ArgumentException">Thrown when failed of invalid argument.</exception>
        /// <exception cref="ArgumentNullException">Thrown when a argument is null.</exception>
        /// <since_tizen> 8 </since_tizen>
        public QuickPanelClient(TizenShell tzShell, Window win, Types type)
        {
            int width = 0, height = 0;

            if (tzShell == null)
            {
                throw new ArgumentNullException((string)"tzShell");
            }
            if (tzShell.GetNativeHandle() == IntPtr.Zero)
            {
                throw new ArgumentException("tzShell is not initialized.");
            }
            if (win == null)
            {
                throw new ArgumentNullException((string)"win");
            }

            _tzsh         = tzShell;
            _tzshWin      = win.GetNativeId();
            _tzshQpClient = Interop.QuickPanelClient.CreateWithType(_tzsh.GetNativeHandle(), (IntPtr)_tzshWin, (int)type);
            if (_tzshQpClient == IntPtr.Zero)
            {
                int err = Tizen.Internals.Errors.ErrorFacts.GetLastResult();
                _tzsh.ErrorCodeThrow(err);
            }

            Information.TryGetValue("http://tizen.org/feature/screen.width", out width);
            Information.TryGetValue("http://tizen.org/feature/screen.height", out height);
            if (width > height)
            {
                _screenOrientation = Window.WindowOrientation.Landscape;
            }
        }
Beispiel #2
0
        public void WindowSetAvailableOrientations()
        {
            tlog.Debug(tag, $"WindowSetAvailableOrientations START");
            try
            {
                List<Window.WindowOrientation> l1 = new List<Window.WindowOrientation>();
                Window.WindowOrientation o1 = new Window.WindowOrientation();

                l1.Add(o1);
                myWin.SetAvailableOrientations(l1);
            }
            catch (Exception e)
            {
                Tizen.Log.Error(tag, "Caught Exception" + e.ToString());

                Assert.Fail("Caught Exception" + e.ToString());
            }
            tlog.Debug(tag, $"WindowSetAvailableOrientations END (OK)");
            Assert.Pass("WindowSetAvailableOrientations");
        }
Beispiel #3
0
 /// <summary>
 /// Handle when window is resized
 /// </summary>
 /// <param name="sender">Window instance</param>
 /// <param name="e">Event arguments</param>
 private void OnResized(object sender, Window.ResizedEventArgs e)
 {
     Window.WindowOrientation windowOrientation = Window.Instance.GetCurrentOrientation();
     currentAngle = (int)windowOrientation;
     LoadLayout();
 }
 public void OnOrientationEvent(object sender, Window.WindowOrientation state)
 {
     textClientOrientation.Text = $"Orientation: {qpClient.Orientation}";
 }