﻿
SLx.ControlFactory = function () {} 

SLx.ControlFactory.Button = function () 
{ 
    var template = SLx.Application.Current.get_resources().findName ( SLx.Constants.Button  ); 
    if ( template  != "" ) 
    {          
        var button = new SLx.Button ( null , template , SLx.Button.DefaultTemplate );                  
        return button ; 
        
    } 
    Sys.Debug.assert( false , "this should not fail");     
    return null ; 
} 

SLx.ControlFactory.ToggleMenuButton = function () 
{ 
    var template = SLx.Application.Current.get_resources().findName ( "ToggleMenuButton"  ); 
    if ( template  != "" ) 
    {          
        var button = new SLx.Button ( null , template , SLx.Button.DefaultTemplate );                  
        return button ;         
    } 
    Sys.Debug.assert( false , "this should not fail");     
    return null ; 
} 


SLx.ControlFactory.DarkButton = function () 
{ 
    var template = SLx.Application.Current.get_resources().findName ( "DarkButton"  ); 
    if ( template  != "" ) 
    {          
        var button = new SLx.Button ( null , template , SLx.Button.DefaultTemplate );                  
        return button ; 
        
    } 
    Sys.Debug.assert( false , "this should not fail");     
    return null ; 
} 

SLx.ControlFactory.CheckBox = function () 
{ 
    var template = SLx.Application.Current.get_resources().findName ( SLx.Constants.CheckBox  ); 
    if ( template  != "" ) 
    { 
         
        var CheckBox = new SLx.CheckBox ( null, template , SLx.CheckBox.DefaultTemplate );          
        return CheckBox ; 
        
    }     
  
    
    Sys.Debug.assert( false , "this should not fail");     
    return null ; 
} 

SLx.ControlFactory.Radio = function () 
{ 
    var template = SLx.Application.Current.get_resources().findName ( SLx.Constants.Radio  ); 
    if ( template  != "" ) 
    {          
        var radio = new SLx.CheckBox ( null, template , 
            [{name : "Radio" , ref : "_visualElement", type : "element" },
            {name : "PART_Content"   , ref : "_content", type : "ContentPresenter" }
            ]
         );          
        return radio ; 
        
    }       
    Sys.Debug.assert( false , "this should not fail");     
    return null ; 
} 