Пример #1
0
        internal static bool retrieveWindowBounds(string key, out double left, out double top, out double width, out double height)
        {
            bool   ret;
            string regText = readRegistryValue(key, string.Empty), strKey, strValue, tmp;

            string[] parts;
            double   d;
            int      pos;

            left = top = width = height = Double.NaN;
            if (string.IsNullOrEmpty(regText))
            {
                ret = false;
            }
            else
            {
                ret   = true;
                parts = regText.Split(',');
                //return true;
                //Trace.WriteLine("here");
                if (parts != null && parts.Length > 0)
                {
                    foreach (string apart in parts)
                    {
                        if (!string.IsNullOrEmpty(tmp = apart.Trim()))
                        {
                            //Trace.WriteLine("here");
                            if ((pos = tmp.IndexOf("=")) >= 0)
                            {
                                //Trace.WriteLine("here");
                                strKey   = tmp.Substring(0, pos);
                                strValue = tmp.Substring(pos + 1);
                                if (double.TryParse(strValue, out d))
                                {
                                    switch (strKey.ToUpper())
                                    {
                                    case "TOP": top = d; break;

                                    case "LEFT": left = d; break;

                                    case "WIDTH": width = d; break;

                                    case "HEIGHT": height = d; break;

                                    default: logger.log(ColtLogLevel.Warning, MethodBase.GetCurrentMethod(), "unhandled key: '" + strKey + "'!"); break;
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    ret = false;
                }
                //ret=true;
            }
            return(ret);
        }
Пример #2
0
 void logError(MethodBase mb, Exception ex)
 {
     if (_logger1 != null)
     {
         _logger1.log(mb, ex);
     }
     else
     {
         NSIRDriver.Utility.logger.log(mb, ex);
     }
 }