Class Session
Definition
- Namespace:
- Tizen.System
- Assembly:
- Tizen.System.Session.dll
Provides methods to manage subsession users. Allows to register for events triggered by operations on subsession users.
C#Copypublic sealed class Session : object
- Inheritance
-
Session
Fields
Declaration
C#Copypublic static readonly int CurrentUID
Field Value
Type | Description |
---|---|
Int32 |
EmptyUser
Special subsession ID, which is always present and does not represent any user.
Declaration
C#Copypublic const string EmptyUser = null
Field Value
Type | Description |
---|---|
String |
Declaration
C#Copypublic const int MaxUserLength = null
Field Value
Type | Description |
---|---|
Int32 |
Properties
Declaration
C#Copypublic int SessionUID { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Declaration
C#Copypublic string GetCurrentUser()
Returns
Type | Description |
---|---|
String |
Remarks
When no subsession is enabled, "" (empty string, see EmptyUser field) is returned. This doesn't mean that "" is a subsession ID in the same way as others; it is just a marker meaning that no subsession is enabled.
Declaration
C#Copypublic static Session GetInstance(int sessionUID)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sessionUID | Session UID of a requested Session object instance |
Returns
Type | Description |
---|---|
Session | Returns requested Session object |
Remarks
To ensure thread safety, expilicit creation of Session object is not allowed.
Declaration
C#Copypublic IReadOnlyList<string> GetUsers()
Returns
Type | Description |
---|---|
IReadOnlyList<String> |
Remarks
The list of users depends on whether the session UID for this session object exists or not. If it doesn't, the user list is empty (in particular this is not an error). However if the session UID exists, the user list will contain the subsession IDs (if they exist), but also the default value, which is "" (empty string, see EmptyUser field). This doesn't mean that "" is a subsession ID in the same way as others; it is just a marker meaning that no subsession is enabled.
Declaration
C#Copypublic Task SubsessionAddUserAsync(string userName)
Parameters
Type | Name | Description |
---|---|---|
String | userName | Subesssion user ID to be created |
Returns
Type | Description |
---|---|
Task |
Remarks
Subsession ID must not start with a dot or have slashes.
Declaration
C#Copypublic void SubsessionEventMarkAsDone(SubsessionEventArgs subsessionEventArgs)
Parameters
Type | Name | Description |
---|---|---|
SubsessionEventArgs | subsessionEventArgs | Event argument of the event (obtained from said event) |
Remarks
This method is assumed to be called from an event handler. You can only mark an event as completed if you registered for in in the same process.
Declaration
C#Copypublic Task SubsessionRemoveUserAsync(string userName)
Parameters
Type | Name | Description |
---|---|---|
String | userName | Existing subesssion user ID to be removed |
Returns
Type | Description |
---|---|
Task |
Remarks
Subsession ID must not start with a dot or have slashes. Only inactive session ID can be removed. In order remove currently used session ID first switch to special session ID "" (empty string, see EmptyUser), and only after switch completes, remove previously active session ID.
Declaration
C#Copypublic Task SubsessionSwitchUserAsync(string userName)
Parameters
Type | Name | Description |
---|---|---|
String | userName | Existing subesssion user ID to be set as active |
Returns
Type | Description |
---|---|
Task |
Remarks
Subsession ID must not start with a dot or have slashes. Special subsession ID "" (empty string, see EmptyUser) can be switched to, when it's required to deactivate current subsession (this step is needed when current session is to be removed).
Events
AddUserWait
Event to be invoked when a new subession user is successfully added to this session.
Declaration
C#Copypublic event EventHandler<AddUserEventArgs> AddUserWait
Event Type
Type | Description |
---|---|
EventHandler<AddUserEventArgs> |
RemoveUserWait
Event to be invoked when a subession user is successfully removed from this session.
Declaration
C#Copypublic event EventHandler<RemoveUserEventArgs> RemoveUserWait
Event Type
Type | Description |
---|---|
EventHandler<RemoveUserEventArgs> |
SwitchUserCompleted
Event to be invoked when an existing subession user is successfully switched to an acvite state.
Declaration
C#Copypublic event EventHandler<SwitchUserCompletionEventArgs> SwitchUserCompleted
Event Type
Type | Description |
---|---|
EventHandler<SwitchUserCompletionEventArgs> |
SwitchUserWait
Event to be invoked when an existing subession user has begun switching to an active state.
Declaration
C#Copypublic event EventHandler<SwitchUserWaitEventArgs> SwitchUserWait
Event Type
Type | Description |
---|---|
EventHandler<SwitchUserWaitEventArgs> |