Exemplo n.º 1
0
 internal GaugeCore GetGaugeObject()
 {
     if (gaugeObject == null)
     {
         gaugeObject = (GaugeCore)serviceContainer.GetService(typeof(GaugeCore));
     }
     return(gaugeObject);
 }
Exemplo n.º 2
0
 public GaugeCore GetGaugeObject()
 {
     if (this.gaugeObject == null)
     {
         this.gaugeObject = (GaugeCore)this.serviceContainer.GetService(typeof(GaugeCore));
     }
     return(this.gaugeObject);
 }
Exemplo n.º 3
0
 public GaugeContainer()
 {
     this.gauge = new GaugeCore(this);
     this.gauge.BeginInit();
     this.BackColor = Color.White;
     this.Width     = 320;
     this.Height    = 240;
     this.BackColor = Color.White;
 }
 public GaugeContainer()
 {
     gauge = new GaugeCore(this);
     gauge.BeginInit();
     BackColor = Color.White;
     Width     = 320;
     Height    = 240;
     BackColor = Color.White;
 }
Exemplo n.º 5
0
        public Image LoadImage(string imageURL, bool saveImage)
        {
            Image image = null;

            if (serviceContainer != null)
            {
                GaugeCore gaugeCore = (GaugeCore)serviceContainer.GetService(typeof(GaugeCore));
                if (gaugeCore != null)
                {
                    foreach (NamedImage namedImage in gaugeCore.NamedImages)
                    {
                        if (namedImage.Name == imageURL)
                        {
                            if (namedImage.Image == null)
                            {
                                throw new ArgumentException(Utils.SRGetStr("ExceptionImageLoaderInvalidUrl", imageURL));
                            }
                            return(namedImage.Image);
                        }
                    }
                }
            }
            if (imageData == null)
            {
                imageData = new Hashtable(new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase);
            }
            if (imageData.Contains(imageURL))
            {
                image = (Image)imageData[imageURL];
            }
            if (image == null)
            {
                Uri uri = null;
                try
                {
                    uri = new Uri(imageURL);
                }
                catch (Exception)
                {
                }
                if (uri == null)
                {
                    GaugeContainer gaugeContainer = (GaugeContainer)serviceContainer.GetService(typeof(GaugeContainer));
                    if (gaugeContainer != null)
                    {
                        if (imageURL.StartsWith("~", StringComparison.Ordinal) && gaugeContainer.applicationDocumentURL.Length > 0)
                        {
                            try
                            {
                                uri = new Uri(gaugeContainer.applicationDocumentURL + imageURL.Substring(1));
                            }
                            catch (Exception)
                            {
                            }
                        }
                        else
                        {
                            string text = gaugeContainer.webFormDocumentURL;
                            int    num  = text.LastIndexOf('/');
                            if (num != -1)
                            {
                                text = text.Substring(0, num + 1);
                            }
                            try
                            {
                                uri = new Uri(new Uri(text), imageURL);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
                if (uri != null)
                {
                    try
                    {
                        image = Image.FromStream(WebRequest.Create(uri).GetResponse().GetResponseStream());
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            if (image == null)
            {
                image = LoadFromFile(imageURL);
            }
            if (image == null)
            {
                throw new ArgumentException(Utils.SRGetStr("ExceptionImageLoaderInvalidUrl", imageURL));
            }
            if (saveImage)
            {
                imageData[imageURL] = image;
            }
            return(image);
        }