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#
Copy
public sealed class Session : object
Inheritance
Session

Fields

View Source

CurrentUID

UID of current system user.

Declaration
C#
Copy
public static readonly int CurrentUID
Field Value
Type Description
Int32
View Source

EmptyUser

Special subsession ID, which is always present and does not represent any user.

Declaration
C#
Copy
public const string EmptyUser = null
Field Value
Type Description
String
View Source

MaxUserLength

Maximum length of any given user ID.

Declaration
C#
Copy
public const int MaxUserLength = null
Field Value
Type Description
Int32

Properties

View Source

SessionUID

Gets session UID of this session object.

Declaration
C#
Copy
public int SessionUID { get; }
Property Value
Type Description
Int32

Methods

View Source

GetCurrentUser()

Gets a currently active subession user ID for this session.

Declaration
C#
Copy
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.

View Source

GetInstance(Int32)

Gets a Session object instance for a given sessionUID.

Declaration
C#
Copy
public 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.

View Source

GetUsers()

Gets a list of all availible subsession user IDs for this session.

Declaration
C#
Copy
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.

View Source

SubsessionAddUserAsync(String)

Request new subsession to be created.

Declaration
C#
Copy
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.

View Source

SubsessionEventMarkAsDone(SubsessionEventArgs)

Mark event as completed.

Declaration
C#
Copy
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.

View Source

SubsessionRemoveUserAsync(String)

Request an existing subsession to be removed.

Declaration
C#
Copy
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.

View Source

SubsessionSwitchUserAsync(String)

Request a subession to become currently active.

Declaration
C#
Copy
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 Source

AddUserWait

Event to be invoked when a new subession user is successfully added to this session.

Declaration
C#
Copy
public event EventHandler<AddUserEventArgs> AddUserWait
Event Type
Type Description
EventHandler<AddUserEventArgs>
View Source

RemoveUserWait

Event to be invoked when a subession user is successfully removed from this session.

Declaration
C#
Copy
public event EventHandler<RemoveUserEventArgs> RemoveUserWait
Event Type
Type Description
EventHandler<RemoveUserEventArgs>
View Source

SwitchUserCompleted

Event to be invoked when an existing subession user is successfully switched to an acvite state.

Declaration
C#
Copy
public event EventHandler<SwitchUserCompletionEventArgs> SwitchUserCompleted
Event Type
Type Description
EventHandler<SwitchUserCompletionEventArgs>
View Source

SwitchUserWait

Event to be invoked when an existing subession user has begun switching to an active state.

Declaration
C#
Copy
public event EventHandler<SwitchUserWaitEventArgs> SwitchUserWait
Event Type
Type Description
EventHandler<SwitchUserWaitEventArgs>

Extension Methods