Example #1
0
        private static TVMSettings queryFlowManager(String userToken, String url_to_flowmanager)
        {
            /*
             * // Build url
            String command = "/settings"; //FlowManager takes commands login, logout, save, update and settings requests
            //String command = "%2Fsettings"; //FlowManager takes commands login, logout, save, update and settings requests
            //String device_info = "/%7B%22OS%22:%7B%22id%22:%22" + TVMSettings.GPII_OS_id + "%22%7D,%22solutions%22:%5B%7B%22id%22:%22" + TVMSettings.GPII_solution_id + "%22%7D%5D%7D";
            //String device_info = "/%2F%257B%2522OS%2522%3A%257B%2522id%2522%3A%2522" + TVMSettings.GPII_OS_id + "%2522%257D%2C%2522solutions%2522%3A%255B%257B%2522id%2522%3A%2522" + TVMSettings.GPII_solution_id + "%2522%257D%255D%257D";
            String device_info = "/%7B%22OS%22:%7B%22id%22:%22web%22%7D,%22solutions%22:%5B%7B%22id%22:%22de.fraunhofer.iao.C4A-TVM%22%7D%5D%7D";
            */

            String url_to_query = "";
            String command = "/settings"; //FlowManager takes commands login, logout, save, update and settings requests
            String device_info = "/%7B%22OS%22:%7B%22id%22:%22" + TVMSettings.GPII_OS_id + "%22%7D,%22solutions%22:%5B%7B%22id%22:%22" + TVMSettings.GPII_solution_id + "%22%7D%5D%7D";
            //String device_info = "/%7B%22OS%22:%7B%22id%22:%22linux%22%7D,%22solutions%22:%5B%7B%22id%22:%22org.gnome.desktop.a11y.magnifier%22%7D%5D%7D";
            
            Console.WriteLine("url_to_flowmanager " + url_to_flowmanager);
            Console.WriteLine("userToken " + userToken);
            Console.WriteLine("command " + command);
            Console.WriteLine("device_info " + device_info);
            
            Console.WriteLine("url_to_query " + url_to_query);

            //url_to_query = url_to_flowmanager + userToken + command + device_info;
            url_to_query = url_to_flowmanager + userToken + command + device_info;
            //url_to_query = "http://127.0.0.1:8081/sammy/settings/%7B%22OS%22:%7B%22id%22:%22web%22%7D,%22solutions%22:%5B%7B%22id%22:%22de.fraunhofer.iao.C4A-TVM%22%7D%5D%7D";
            //url_to_query = "http://127.0.0.1:8081/sammy/settings/%7B%22OS%22:%7B%22id%22:%22linux%22%7D,%22solutions%22:[%7B%22id%22:%22org.gnome.desktop.a11y.magnifier%22%7D]%7D";
            Console.WriteLine("url_to_query " + url_to_query);

            String JSONsettings = makeRequest(url_to_query);
            Console.WriteLine("JSONsettings " + JSONsettings);

            TVMSettings tvmSettings = new TVMSettings(TVMSettings.getDefaultPreferences());

            if (JSONsettings == "{}")
            {
                //do nothing = use default settings
            }
            else if (JSONsettings.Contains("Request Failed"))
            {
                //not found,  also do nothing special
                Console.WriteLine("UserToken not found - " + JSONsettings);
            }else{
                try
                {
                    tvmSettings = JsonConvert.DeserializeObject<TVMSettings>(JSONsettings);
                }
                catch (JsonReaderException e)
                {
                    if (e.Source != null)
                        Console.WriteLine("JsonReaderException source: {0}" + e.Source);
                
                }
            }

            
            return tvmSettings;
        }
Example #2
0
        public static TVMSettings getPreferences(String userToken, String url_to_flowmanager)
        {
            TVMSettings tvmSettings = new TVMSettings(TVMSettings.getDefaultPreferences());
            Console.WriteLine("userToken " + userToken);
            
            if (url_to_flowmanager == TVMSettings.url_to_online_FlowManager)
            {
                tvmSettings = queryFlowManager(userToken, TVMSettings.url_to_online_FlowManager);
            }
            else if (url_to_flowmanager == TVMSettings.url_to_local_cloudbased_FlowManager)
            {
                tvmSettings = queryFlowManager(userToken, TVMSettings.url_to_local_cloudbased_FlowManager);
            }
            else
            {
                tvmSettings = emulatePreferencesServer(userToken);
            }

            tvmSettings = print_and_default_TVMSettings(tvmSettings);
            return tvmSettings;
        }
Example #3
0
        protected void invoke_Settings(TVMSettings ts)
        {

            //contrast theme
            if (ts.TVMPreferences.contrastTheme == "yellow-black"){
                Global.current_theme = "contrast";
                ani_normal_to_contrast();
            }
            else
            {
                Global.current_theme = "normal";
                ani_contrast_to_normal();
            }
            //serverside_apply_style(Global.current_theme);

            //font size
            if (ts.TVMPreferences.fontSize == "big" ){
                //
            }else{
                //
            }
            // apply fontsize... ?
            
            //font face
            if (ts.TVMPreferences.fontFace.Contains("omic")){
                Global.current_fontface = "Comic Sans MS";
            }else{
                Global.current_fontface = "Calibri";
            }

            //button siz not in use
            if (ts.TVMPreferences.buttonSize == "big")
            {
                //
            }
            else
            {
                //
            }
            // apply buttonSize... ?
            
            


            //timeout
            if (ts.TVMPreferences.timeOut == "long"){
                Global.timeout = 60000;
            }else{
                Global.timeout = 45000;
            }

            //language
            apply_language(ts.TVMPreferences.language);

            Response.Redirect("Default.aspx");
        }
Example #4
0
        public static TVMSettings print_and_default_TVMSettings(TVMSettings t)
        
        {
            if (t != null)
            {
                if (t.TVMPreferences != null)
                {
                    if (t.TVMPreferences.contrastTheme != null)
                    {
                        Console.WriteLine("contrastTheme " + t.TVMPreferences.contrastTheme);
                    }
                    else
                    {
                        t.TVMPreferences.contrastTheme = "default";
                    }

                    if (t.TVMPreferences.fontSize != null)
                    {
                        Console.WriteLine("fontSize " + t.TVMPreferences.fontSize);
                    }
                    else
                    {
                        t.TVMPreferences.fontSize = "default";
                    }

                    if (t.TVMPreferences.fontFace != null)
                    {
                        Console.WriteLine("fontFace " + t.TVMPreferences.fontFace);
                    }
                    else
                    {
                        t.TVMPreferences.fontFace = "default";
                    }

                    if (t.TVMPreferences.buttonSize != null)
                    {
                        Console.WriteLine("buttonSize " + t.TVMPreferences.buttonSize);
                    }
                    else
                    {
                        t.TVMPreferences.buttonSize = "default";
                    }

                    if (t.TVMPreferences.timeOut != null)
                    {
                        Console.WriteLine("timeOut " + t.TVMPreferences.timeOut);
                    }
                    else
                    {
                        t.TVMPreferences.timeOut = "default";
                    }

                    if (t.TVMPreferences.language != null)
                    {
                        Console.WriteLine("language " + t.TVMPreferences.language);
                    }
                    else
                    {
                        t.TVMPreferences.language = "default";
                    }
                }
                else
                {
                    t = new TVMSettings(TVMSettings.getDefaultPreferences());
                }
                
            }
            return t;
        }
Example #5
0
        private static TVMSettings emulatePreferencesServer(String userToken)
        {

            TVMPreferences tvmPreferences = new TVMPreferences();
            

            if (userToken == "logout")
            {
                tvmPreferences = TVMSettings.getDefaultPreferences();
              
            }

            
            if (userToken == "sammy")
            {
                tvmPreferences = new TVMPreferences
                {
                    contrastTheme = "yellow-black",
                    fontSize = "big",
                    fontFace = "Comic Sans",
                    buttonSize = "big",
                    timeOut = "long",
                    language = "de"
                };
            }
            
            if (userToken == "lara")
            {
                tvmPreferences = new TVMPreferences
                {
                    contrastTheme = "default",
                    fontSize = "default",
                    fontFace = "default",
                    buttonSize = "default",
                    timeOut = "long",
                    language = "he"
                };
            }
            
            if (userToken == "jasmin")
            {
                tvmPreferences = new TVMPreferences
                {
                    contrastTheme = "default",
                    fontSize = "default",
                    fontFace = "default",
                    buttonSize = "big",
                    timeOut = "default",
                    language = "fr"
                };
            }
            
            if (userToken == "vladimir")
            {
                tvmPreferences = new TVMPreferences
                {
                    contrastTheme = "yellow-black",
                    fontSize = "big",
                    fontFace = "Comic Sans",
                    buttonSize = "big",
                    timeOut = "default",
                    language = "de"
                };
            }
            TVMSettings tvmSettings = new TVMSettings(tvmPreferences);
            return tvmSettings;
        }
Example #6
0
        private static TVMSettings emulatePreferencesServer(String userToken)
        {

            TVMPreferences tvmPreferences = new TVMPreferences();


            if (userToken.Contains("sammy"))
            {
                tvmPreferences = new TVMPreferences
                {
                    //user token added for debuggin 
                    userToken = "sammy",

                    contrastTheme = "yellow-black",
                    fontSize = "big",
                    fontFace = "Comic Sans",
                    buttonSize = "big",
                    timeOut = "long",
                    language = "de"
                };
            } 
            else if (userToken.Contains("lara"))
            {
                tvmPreferences = new TVMPreferences
                {
                    //user token added for debuggin 
                    userToken = "lara",

                    contrastTheme = "default",
                    fontSize = "default",
                    fontFace = "default",
                    buttonSize = "default",
                    timeOut = "long",
                    language = "el"
                };
            }
            else if (userToken.Contains("jasmin"))
            {
                tvmPreferences = new TVMPreferences
                {
                    //user token added for debuggin 
                    userToken = "jasmin",

                    contrastTheme = "default",
                    fontSize = "default",
                    fontFace = "default",
                    buttonSize = "big",
                    timeOut = "default",
                    language = "fr"
                };
            }
            else if (userToken.Contains("vladimir"))
            {
                tvmPreferences = new TVMPreferences
                {
                    //user token added for debuggin 
                    userToken = "vladimir",

                    contrastTheme = "yellow-black",
                    fontSize = "big",
                    fontFace = "Comic Sans",
                    buttonSize = "big",
                    timeOut = "default",
                    language = "de"
                };
            } 
            else
            {
                tvmPreferences = TVMSettings.getDefaultPreferences();

            }

            TVMSettings tvmSettings = new TVMSettings(tvmPreferences);
            return tvmSettings;
        }
Example #7
0
        protected void invoke_Settings(TVMSettings ts)
        {

            if (ts.TVMPreferences.contrastTheme == "yellow-black"){
                Global.current_theme = "contrast";
            }
            else
            {
                Global.current_theme = "normal";
            }
            serverside_apply_style(Global.current_theme);
        
            
            applyFontFace_clientside(Global.current_fontface);
            applyFontFace(Global.current_fontface);

            apply_language(ts.TVMPreferences.language);
            
        }