This article is follow of previous article. The article includes steps below.

1.Run Visual Studio as Administrator.

2.Create new blank WPF.

3.Midify App.xaml and App.xaml.cs to execute App_Startup method of App.xaml.cs at first.

figures of Visual Studio Japanese edition.

>>The sample code

・Implement a flow of multiple accounts which for multiple operation scenarios

As scenarios of previous article, create four accounts below.

1.’appUser’ account is used to use some user application.

2.’appOperator’ account is used to manage this user application settings.

3.’maintenanceOperator’ account is used to install this user application, and to set several device settings for this user application.

4.’superUser’ account is top level administrator of the device.

Follow article [Local account creation] explains how to create these four accounts.

And [Logging and save the Log file to Microsoft Azure] explains how to send a log file which is described at next step to Azure Blob Storage.

As next step, check existing of a log file to judge current execution is first time or not. If it is first time, create four accounts and assign their permissions. If it is not first time, check sign in account and navigate correct flow respectively for individual account.

For ‘maintenanceOperator’ account, create maintenance console which leads maintenance operator to maintenance tasks.

For ‘appUser’ account, create an application which runs like the kiosk mode.

For ‘appOperator’ account, the application for ‘appUser’ account modify that the application can execute maintenance mode.

>>The sample code

・Sample code of a flow of multiple operation scenarios

Overall of the flow control is below.

void App_Startup(object sender, StartupEventArgs e)
{
    //1.Check existing of log file.

    //2.if (!logFile.Exists) current execution is first time execution,
    //so create four accounts. And set logon script respectively for individual account,
    //run user application as normal mode for "appOperator", run user application
    //as maintenance mode for "appOperator", "maintenanceOperator" will expire out
    //while 24 hours which means maintenance working time.

    //3.if (logFile.Exists) check current user

    //4.if (UserName == "maintenanceOperator") navigate to MaintenanceWindow

    //5.if (UserName == "appOperator") quiet this app. This account has specific automatic
    //run application when this account sign in.

    //6.if (UserName == "appUser") quiet this app. This account has specific automatic run
    //application when this account sign in.
}

Follow article [Desktop UI control] explains how to check current user, and [Launch app by correct account] explains how to navigate user use logon script of above code.

void App_Startup(object sender, StartupEventArgs e)
{
    //[Logging and save the Log file to Microsoft Azure] explains how to send a log file
    //which is described at next step to Azure Blob Storage.
    //And explains creating model of log information for easy logging
    //LogModel message = new LogModel() { message = "check app files ..." };
    //Check existing of log file.
    //Logging logging = new Logging();
    //if (logging.ReadLogs().Count == 0)
    //{
    //    //[Local account creation] explains how to create these four accounts.
    //    //And how to navigate use logon script
    //    //CoreApplication.Exit();
    //}
    //else //if (logFile.Exists) check current user
    //{
    //    //[Desktop UI control] explains how to check current user
    //    //if (UserName == "maintenanceOperator") navigate to MaintenanceWindow
    //    //if (UserName == "appOperator") quiet this app. This account has specific automatic
    //run application when this account sign in.

    //    //if (UserName == "appUser") quiet this app. This account has specific automatic
    //run application when this account sign in.
    //}
}

Go next step [Logging and save the Log file to Microsoft Azure] >>

or [Local account creation] >>

, [Desktop UI control] >>

, [Launch app by correct account] >>

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *