Exemplo n.º 1
0
 public XamlUI Load(string xamlURI, string suffix)
 {
     if (string.IsNullOrEmpty(suffix))
     {
         return(this.Load(xamlURI));
     }
     try
     {
         if (string.IsNullOrEmpty(xamlURI))
         {
             throw new ArgumentNullException("xamlURI");
         }
         string key = xamlURI + string.Format("({0})", suffix);
         if (!this.UIDictionary.ContainsKey(key))
         {
             if (xamlURI.EndsWith(".xaml", true, null))
             {
                 XamlUI lui = XamlHelper.ConvertXamlToUI(xamlURI, suffix);
                 this.UIDictionary.Add(key, lui);
             }
             else if (xamlURI.EndsWith(".dll", true, null))
             {
                 XamlUI lui2 = XamlHelper.ConvertDLLToUI(xamlURI, suffix);
                 this.UIDictionary.Add(key, lui2);
             }
             else
             {
                 XamlUI lui3 = XamlHelper.ConvertXmlToUI(xamlURI, suffix);
                 this.UIDictionary.Add(key, lui3);
             }
         }
         return(this.UIDictionary[key]);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         return(null);
     }
 }
Exemplo n.º 2
0
 public XamlUI Load(string xamlURI)
 {
     try
     {
         if (this.expired)
         {
             throw new Exception("Invalid License Information!");
         }
         if (string.IsNullOrEmpty(xamlURI))
         {
             throw new ArgumentNullException("xamlURI");
         }
         if (!this.UIDictionary.ContainsKey(xamlURI))
         {
             if (xamlURI.EndsWith(".xaml", true, null))
             {
                 XamlUI lui = XamlHelper.ConvertXamlToUI(xamlURI);
                 this.UIDictionary.Add(xamlURI, lui);
             }
             else if (xamlURI.EndsWith(".dll", true, null))
             {
                 XamlUI lui2 = XamlHelper.ConvertDLLToUI(xamlURI);
                 this.UIDictionary.Add(xamlURI, lui2);
             }
             else
             {
                 XamlUI lui3 = XamlHelper.ConvertXmlToUI(xamlURI);
                 this.UIDictionary.Add(xamlURI, lui3);
             }
         }
         return(this.UIDictionary[xamlURI]);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         return(null);
     }
 }
Exemplo n.º 3
0
 public XamlUI Load(byte[] fileBuffer, string name, string suffix)
 {
     if (string.IsNullOrEmpty(suffix))
     {
         return(this.Load(fileBuffer, name));
     }
     try
     {
         if (string.IsNullOrEmpty(name))
         {
             throw new ArgumentNullException("name");
         }
         string key = name + string.Format("({0})", suffix);
         if (!this.UIDictionary.ContainsKey(key))
         {
             if (!name.EndsWith(".xaml", true, CultureInfo.CurrentCulture))
             {
                 if (!name.EndsWith(".xml", true, CultureInfo.CurrentCulture))
                 {
                     throw new Exception("不支持的文件类型!");
                 }
                 XamlUI lui2 = XamlHelper.ConvertXmlToUI(fileBuffer, suffix);
                 this.UIDictionary.Add(key, lui2);
             }
             else
             {
                 XamlUI lui = XamlHelper.ConvertXamlToUI(fileBuffer, suffix);
                 this.UIDictionary.Add(key, lui);
             }
         }
         return(this.UIDictionary[key]);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         return(null);
     }
 }
Exemplo n.º 4
0
 public XamlUI Load(byte[] fileBuffer, string name)
 {
     try
     {
         if (this.expired)
         {
             throw new LicenseException(typeof(UIManager), instance, "Invalid License Information!");
         }
         if (string.IsNullOrEmpty(name))
         {
             throw new ArgumentNullException("name");
         }
         if (!this.UIDictionary.ContainsKey(name))
         {
             if (!name.EndsWith(".xaml", true, CultureInfo.CurrentCulture))
             {
                 if (!name.EndsWith(".xml", true, CultureInfo.CurrentCulture))
                 {
                     throw new Exception("不支持的文件类型!");
                 }
                 XamlUI lui2 = XamlHelper.ConvertXmlToUI(fileBuffer);
                 this.UIDictionary.Add(name, lui2);
             }
             else
             {
                 XamlUI lui = XamlHelper.ConvertXamlToUI(fileBuffer);
                 this.UIDictionary.Add(name, lui);
             }
         }
         return(this.UIDictionary[name]);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         return(null);
     }
 }