Class Session
Definition
- Assembly:
- Tizen.System.Session.dll
Provides methods to manage subsession users. Allows to register for events triggered by operations on subsession users.
public sealed class Session
- Inheritance
-
objectSession
Fields
View SourceCurrentUID
UID of current system user.
Declaration
public static readonly int CurrentUID
Field Value
Type | Description |
---|---|
int |
EmptyUser
Special subsession ID, which is always present and does not represent any user.
Declaration
public const string EmptyUser
Field Value
Type | Description |
---|---|
string |
MaxUserLength
Maximum length of any given user ID.
Declaration
public const int MaxUserLength
Field Value
Type | Description |
---|---|
int |
Properties
View SourceSessionUID
Gets session UID of this session object.
Declaration
public int SessionUID { get; }
Property Value
Type | Description |
---|---|
int |
Methods
View SourceGetCurrentUser()
Gets a currently active subession user ID for this session.
Declaration
public 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.
GetInstance(int)
Gets a Session object instance for a given sessionUID.
Declaration
public static Session GetInstance(int sessionUID)
Parameters
Type | Name | Description |
---|---|---|
int | 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.
GetUsers()
Gets a list of all availible subsession user IDs for this session.
Declaration
public 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.
SubsessionAddUserAsync(string)
Request new subsession to be created.
Declaration
public 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.
SubsessionEventMarkAsDone(SubsessionEventArgs)
Mark event as completed.
Declaration
public 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.
SubsessionRemoveUserAsync(string)
Request an existing subsession to be removed.
Declaration
public 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.
SubsessionSwitchUserAsync(string)
Request a subession to become currently active.
Declaration
public 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
View SourceAddUserWait
Event to be invoked when a new subession user is successfully added to this session.
Declaration
public 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
public 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
public 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
public event EventHandler<SwitchUserWaitEventArgs> SwitchUserWait
Event Type
Type | Description |
---|---|
EventHandler<><SwitchUserWaitEventArgs> |