[DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_device_orientation")]
internal static extern ErrorCode AppEventGetDeviceOrientation(IntPtr handle, out DeviceOrientation orientation);
+
+ [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_suspended_state")]
+ internal static extern ErrorCode AppEventGetSuspendedState(IntPtr handle, out SuspendedState state);
}
}
}
/// <summary>
- /// Default implementation for the suspended state changed event.
+ /// Default implementation for the device orientation changed event.
/// </summary>
/// <param name="infoHandle"></param>
/// <param name="data"></param>
handler?.Invoke(new DeviceOrientationEventArgs(orientation));
}
}
+
+ /// <summary>
+ /// Default implementation for the device orientation changed event.
+ /// </summary>
+ /// <param name="infoHandle"></param>
+ /// <param name="data"></param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnSuspendedStateChangedNative(IntPtr infoHandle, IntPtr data)
+ {
+ SuspendedState state;
+ ErrorCode err = Interop.AppCommon.AppEventGetSuspendedState(infoHandle, out state);
+ if (err != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Failed to get deivce orientation. Err = " + err);
+ }
+ if (Handlers.ContainsKey(EventType.SuspendedStateChanged))
+ {
+ var handler = Handlers[EventType.SuspendedStateChanged] as Action<SuspendedStateEventArgs>;
+ handler?.Invoke(new SuspendedStateEventArgs(state));
+ }
+ }
}
}
/// <since_tizen> 3 </since_tizen>
public static readonly EventType DeviceOrientationChanged = "DeviceOrientationChanged";
+ /// <summary>
+ /// Pre-defined event type "SuspendedStateChanged".
+ /// The SuspendedStateEventArgs class is an event argument class for this EventType.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static readonly EventType SuspendedStateChanged = "SuspendedStateChanged";
+
private string _typeName;
/// <summary>
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ */
+
+namespace Tizen.Applications
+{
+ /// <summary>
+ /// Enumeration for suspended state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public enum SuspendedState
+ {
+ /// <summary>
+ /// Application will enter the suspended state
+ /// </summary>
+ WillEnter = 0,
+
+ /// <summary>
+ /// Application did exit from the suspended state
+ /// </summary>
+ DidExit = 1
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 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;
+
+namespace Tizen.Applications
+{
+ /// <summary>
+ /// The class for the argument of the SuspendedState EventHandler
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class SuspendedStateEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes SuspendedStateEventArgs class
+ /// </summary>
+ /// <param name="state">The information of the SuspendedState</param>
+ /// <since_tizen> 6 </since_tizen>
+ public SuspendedStateEventArgs(SuspendedState state)
+ {
+ SuspendedState = state;
+ }
+
+ /// <summary>
+ /// The property to get the information of the SuspendedState
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public SuspendedState SuspendedState { get; private set; }
+ }
+}