[DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_default_application")]
internal static extern ErrorCode ForeachDefaultApplication(DefaultApplicationCallback callback, IntPtr userData);
+ [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_window_position")]
+ internal static extern ErrorCode SetWindowPosition(SafeAppControlHandle handle, int x, int y, int w, int h);
+
+ [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_window_position")]
+ internal static extern ErrorCode GetWindowPosition(SafeAppControlHandle handle, out int x, out int y, out int w, out int h);
}
}
}
/// <summary>
+ /// Sets the window position.
+ /// </summary>
+ /// <param name="windowPosition">The window position object.</param>
+ /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
+ /// <exception cref="ArgumentException">Thrown when the argument is invalid.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the invalid operation error occurs.</exception>
+ /// <since_tizen> 11 </since_tizen>
+ public void SetWindowPosition(WindowPosition windowPosition)
+ {
+ if (windowPosition == null)
+ {
+ throw new ArgumentNullException(nameof(windowPosition));
+ }
+
+ Interop.AppControl.ErrorCode err = Interop.AppControl.SetWindowPosition(this.SafeAppControlHandle, windowPosition.PositionX, windowPosition.PositionY, windowPosition.Width, windowPosition.Height);
+ if (err != Interop.AppControl.ErrorCode.None)
+ {
+ if (err == Interop.AppControl.ErrorCode.InvalidParameter)
+ {
+ throw new ArgumentException("Invalid arguments");
+ }
+ else
+ {
+ throw new InvalidOperationException("err = " + err);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the window position.
+ /// </summary>
+ /// <returns>The window position.</returns>
+ /// <exception cref="InvalidOperationException">Thrown when the invalid operation error occurs.</exception>
+ /// <since_tizen> 11 </since_tizen>
+ public WindowPosition GetWindowPosition()
+ {
+ Interop.AppControl.ErrorCode err = Interop.AppControl.GetWindowPosition(this.SafeAppControlHandle, out int x, out int y, out int w, out int h);
+ if (err != Interop.AppControl.ErrorCode.None)
+ {
+ throw new InvalidOperationException("err = " + err);
+ }
+
+ return new WindowPosition(x, y, w, h);
+ }
+
+ /// <summary>
/// Class for extra data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
--- /dev/null
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.ComponentModel;
+
+namespace Tizen.Applications
+{
+ /// <summary>
+ /// Represents the window position of the application.
+ /// </summary>
+ /// <since_tizen> 11 </since_tizen>
+ public class WindowPosition
+ {
+ /// <summary>
+ /// Initializes the instance of the WindowPosition class.
+ /// </summary>
+ /// <param name="x">The X position.</param>
+ /// <param name="y">The Y position.</param>
+ /// <param name="w">The width.</param>
+ /// <param name="h">The height.</param>
+ /// <since_tizen> 11 </since_tizen>
+ public WindowPosition(int x, int y, int w, int h)
+ {
+ PositionX = x;
+ PositionY = y;
+ Width = w;
+ Height = h;
+ }
+
+ /// <summary>
+ /// The X position.
+ /// </summary>
+ /// <since_tizen> 11 </since_tizen>
+ public int PositionX
+ {
+ set;
+ get;
+ }
+
+ /// <summary>
+ /// The Y position.
+ /// </summary>
+ /// <since_tizen> 11 </since_tizen>
+ public int PositionY
+ {
+ set;
+ get;
+ }
+
+ /// <summary>
+ /// The width.
+ /// </summary>
+ /// <since_tizen> 11 </since_tizen>
+ public int Width
+ {
+ set;
+ get;
+ }
+
+ /// <summary>
+ /// The height.
+ /// </summary>
+ /// <since_tizen> 11 </since_tizen>
+ public int Height
+ {
+ set;
+ get;
+ }
+ }
+}