• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LocationInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LocationInfo的典型用法代码示例。如果您正苦于以下问题:C# LocationInfo类的具体用法?C# LocationInfo怎么用?C# LocationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocationInfo类属于命名空间,在下文中一共展示了LocationInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CompileTimeValidate

        public override bool CompileTimeValidate(LocationInfo locationInfo)
        {
            lock (this)
            {
                if (locationInfo.PropertyInfo == null)
                {
                    PostSharpDescription.Add<SomeLocationAspect>(
                        "(SomeLocationAspect) If you 'get' or 'set' me, I'll throw an exception. Good you knew, right? Applied on field: " + locationInfo.FieldInfo.AsSignature(), locationInfo.FieldInfo);
                }
                else
                {
                    MethodInfo getMethod = locationInfo.PropertyInfo.GetGetMethod(true);
                    MethodInfo setMethod = locationInfo.PropertyInfo.GetSetMethod(true);

                    PostSharpDescription.Add<SomeLocationAspect>(
                        "(SomeLocationAspect) If you 'get' or 'set' me, I'll throw an exception. Good you knew, right? Applied on property: " + locationInfo.PropertyInfo.AsSignature(), locationInfo.PropertyInfo);

                    if (getMethod != null)
                    {
                        PostSharpDescription.Add<SomeLocationAspect>(
                            "(SomeLocationAspect) If you 'get' me, I'll throw an exception. Good you knew, right? Applied on method '" + getMethod.Name + "'", locationInfo.PropertyInfo, getMethod);
                    }

                    if (setMethod != null)
                    {
                        PostSharpDescription.Add<SomeLocationAspect>(
                           "(SomeLocationAspect) If you 'set' me, I'll throw an exception. Good you knew, right? Applied on method '" + setMethod.Name + "'", locationInfo.PropertyInfo, setMethod);
                    }
                }
                return base.CompileTimeValidate(locationInfo);
            }
        }
开发者ID:mylemans,项目名称:PostSharpDescriptions,代码行数:32,代码来源:SomeLocationAspect.cs


示例2: SetFilter

        internal void SetFilter(LocationInfo locationInfo, FilterAttribute filter)
        {
            if ( this.frozen )
                throw new InvalidOperationException();

            this.filteredMembers.Add(locationInfo, filter);
        }
开发者ID:postsharp,项目名称:PostSharp.Dnx,代码行数:7,代码来源:FilterTypePropertiesAspect.cs


示例3: CalculateBounds

        /// <summary>
        /// A constructor returning a bounds adjustment object for the given array of locationInfo objects
        /// </summary>
        /// <param name="locationInfoArray"></param>
        /// <param name="DesiredWidth">Desired Width of Bounding rectangle</param>
        /// <param name="DesiredHeight">Desired Height of Bounding rectangle</param>
        /// <returns></returns>
        public static BoundsAdjustment CalculateBounds(LocationInfo[] locationInfoArray, double DesiredMaxWidth, double DesiredMaxHeight)
        {
            double XMax = double.MinValue;
            double YMax = double.MinValue;
            double XMin = double.MaxValue;
            double YMin = double.MaxValue;

            foreach(LocationInfo locInfo in locationInfoArray)
            {
                if(locInfo.X > XMax)
                    XMax = locInfo.X;

                if(locInfo.X < XMin)
                    XMin = locInfo.X;

                if(locInfo.Y > YMax)
                    YMax = locInfo.Y;

                if(locInfo.Y < YMin)
                    YMin = locInfo.Y;
            }

            BoundsAdjustment bounds = new BoundsAdjustment(DesiredMaxWidth, DesiredMaxHeight, XMax,XMin, YMax, YMin);

            return bounds;
        }
开发者ID:abordt,项目名称:Viking,代码行数:33,代码来源:Bounds.cs


示例4: timer_Tick

 // Called when the position timer triggers, and calculates the next position based on current speed and heading,
 // and adds a little randomization to current heading, speed and accuracy.       
 private void timer_Tick(object sender, object e)
 {
     if (oldPosition == null)
     {
         oldPosition = new LocationInfo()
         {
             Location = new MapPoint(StartLongitude, StartLatitude) { SpatialReference = new SpatialReference(4326) },
             Speed = 0,
             Course = 0,
             HorizontalAccuracy = 20,
         };
     }
     var now = DateTime.Now;
     TimeSpan timeParsed = timer.Interval;
     double acceleration = randomizer.NextDouble() * 5 - 2.5;
     double deltaSpeed = acceleration * timeParsed.TotalSeconds;
     double newSpeed = Math.Max(0, deltaSpeed + oldPosition.Speed);
     double deltaCourse = randomizer.NextDouble() * 30 - 15;
     double newCourse = deltaCourse + oldPosition.Course;
     while (newCourse < 0) newCourse += 360;
     while (newCourse >= 360) newCourse -= 360;
     double distanceTravelled = (newSpeed + oldPosition.Speed) * .5 * timeParsed.TotalSeconds;
     double accuracy = Math.Min(500, Math.Max(20, oldPosition.HorizontalAccuracy + (randomizer.NextDouble() * 100 - 50)));
     var pos = GetPointFromHeadingGeodesic(new Point(oldPosition.Location.X, oldPosition.Location.Y), distanceTravelled, newCourse - 180);
     var newPosition = new LocationInfo()
     {
         Location = new MapPoint(pos.X, pos.Y, new SpatialReference(4326)),
         Speed = newSpeed,
         Course = newCourse,
         HorizontalAccuracy = accuracy,
     };
     oldPosition = newPosition;
     if (LocationChanged != null)
         LocationChanged(this, oldPosition);
 }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:37,代码来源:LocationDisplay.xaml.cs


示例5: OnLogin

        public static void OnLogin(LoginEventArgs e)
        {
            Mobile from = e.Mobile;

            if (from == null || from.IsPlayer())
                return;

            if (HasDisconnected(from))
            {
                if (!m_MoveHistory.ContainsKey(from))
                    m_MoveHistory[from] = new LocationInfo(from.Location, from.Map);

                LocationInfo dest = GetRandomDestination();

                from.Location = dest.Location;
                from.Map = dest.Map;
            }
            else if (m_MoveHistory.ContainsKey(from))
            {
                LocationInfo orig = m_MoveHistory[from];
                from.SendMessage("Your character was moved from {0} ({1}) due to a detected client crash.", orig.Location, orig.Map);

                m_MoveHistory.Remove(from);
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:25,代码来源:PreventInaccess.cs


示例6: GetHandlerFirstTime

        private Func<object, PropertyChangedEventHandler> GetHandlerFirstTime(LocationInfo locationInfo)
        {
            Type fieldType = typeof(PropertyChangedEventHandler);

            var fields = from f in locationInfo.DeclaringType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                         where f.FieldType == fieldType
                         select f;

            FieldInfo propertyChangedField = null;
            try
            {
                propertyChangedField = fields.Single();
            }
            catch (InvalidOperationException)
            {
                throw new Exception(string.Format("The {0} aspect is only compatible with the simple scenario of a single {1} field.", GetType().Name, fieldType.Name));
            }

            // (object x) => (([Type])x).[Field]
            ParameterExpression obj = Expression.Parameter(typeof(object));
            UnaryExpression convertObj = Expression.Convert(obj, locationInfo.DeclaringType);
            MemberExpression getField = Expression.PropertyOrField(convertObj, propertyChangedField.Name);

            Expression<Func<object, PropertyChangedEventHandler>> expression = Expression.Lambda<Func<object, PropertyChangedEventHandler>>(getField, obj);

            return expression.Compile();
        }
开发者ID:nixkuroi,项目名称:PhilosopherDeveloper,代码行数:27,代码来源:NotifyPropertyChangedAttribute.cs


示例7: GetName

        public static string GetName(SessionPolicy policy, LocationInfo locationInfo, string customName)
        {
            switch (policy)
            {
                case SessionPolicy.Custom:
                    if (customName != null)
                    {
                        return customName;
                    }
                    else
                    {
                        return SiAuto.Main.Name;
                    }

                case SessionPolicy.TypeName:
                    return locationInfo.DeclaringType.Name;

                case SessionPolicy.FullyQualifiedTypeName:
                    return locationInfo.DeclaringType.Namespace + "." + locationInfo.DeclaringType.Name;

                case SessionPolicy.Namespace:
                    return locationInfo.DeclaringType.Namespace;
                case SessionPolicy.MemberName:
                    return locationInfo.Name;
            }

            return SiAuto.Main.Name;
        }
开发者ID:etulo,项目名称:smartinspect-postsharp,代码行数:28,代码来源:SessionHelper.cs


示例8: getLocation

    IEnumerator getLocation()
    {
        // Wait until service initializes
        int maxWait = 20;
        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return new WaitForSeconds(1);
            maxWait--;
        }

        // Service didn't initialize in 20 seconds
        if (maxWait < 1)
        {
            Debug.Log("Timed out");
            yield break;
        }

        // Connection has failed
        if (Input.location.status == LocationServiceStatus.Failed)
        {
            print("Unable to determine device location");
            yield break;
        }
        else
        {
            locFound = true;
            // Access granted and location value could be retrieved
            Debug.Log("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
        }
        gpsPos = new LocationInfo();
        // Stop service if there is no need to query location updates continuously
        //Input.location.Stop();
    }
开发者ID:yuzin81,项目名称:hotcity,代码行数:33,代码来源:LocationService.cs


示例9: GetLocationInfo

    public static LocationInfo GetLocationInfo(string ipParam)
    {
        LocationInfo result = null;
        IPAddress i = Dns.GetHostEntry(ipParam).AddressList[0];
        string ip = i.ToString();

        if (!cachedIps.ContainsKey(ip))
        {
            string r;
            using (WebClient webClient = new WebClient())
            {
                r = webClient.DownloadString(
                    String.Format("http://api.hostip.info/?ip={0}&position=true", ip));
            }

            XDocument xmlResponse = XDocument.Parse(r);

            try
            {
                foreach (XElement element in xmlResponse.Root.Nodes())
                {
                    if (element.Name.LocalName == "featureMember")
                    {
                        //element Hostip is the first element in featureMember
                        XElement hostIpNode = (XElement)element.Nodes().First();

                        result = new LocationInfo();

                        //loop thru the elements in Hostip
                        foreach (XElement node in hostIpNode.Elements())
                        {
                            if (node.Name.LocalName == "name")
                                result.Name = node.Value;

                            if (node.Name.LocalName == "countryName")
                                result.CountryName = node.Value;

                            if (node.Name.LocalName == "countryAbbrev")
                                result.CountryCode = node.Value;
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                //Looks like we didn't get what we expected.
            }

            if (result != null)
            {
                cachedIps.Add(ip, result);
            }
        }
        else
        {
            result = cachedIps[ip];
        }
        return result;
    }
开发者ID:Desertive,项目名称:800craft,代码行数:59,代码来源:GeoIP.cs


示例10: CompileTimeValidate

 public override bool CompileTimeValidate(LocationInfo locationInfo)
 {
     if (locationInfo.Name != "Horse")
     {
         Message.Write(locationInfo, SeverityType.Error, "MYERRORCODE01", "Location name must be 'horse'");
         return false;
     }
     return true;
 }
开发者ID:hurricanepkt,项目名称:AOPinNET,代码行数:9,代码来源:Program.cs


示例11: GoogleDirectionsForm

        public GoogleDirectionsForm(Utils.BasePlugin.Plugin plugin, Framework.Interfaces.ICore core)
            : this()
        {
            _core = core;
            _plugin = plugin;

            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_START);
            this.label3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_END);
            this.label2.Text = string.Format(Utils.LanguageSupport.Instance.GetTranslation(STR_STOPS), 8);
            this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AUTOMATICROUTING);
            this.label4.Text = string.Format(Utils.LanguageSupport.Instance.GetTranslation(STR_AVWAYPOINTS), 200);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDTOSTOPS);
            this.button5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDWAYPOINT);
            this.button6.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CREATEROUTE);
            this.button7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PRINT);

            Assembly assembly = Assembly.GetExecutingAssembly();
            using (StreamReader textStreamReader = new StreamReader(assembly.GetManifestResourceStream("GlobalcachingApplication.Plugins.GDirections.content.html")))
            {
                string doc = textStreamReader.ReadToEnd();
                doc = doc.Replace("//defaultCenter", string.Format("var startCenter = new google.maps.LatLng({0});",_core.CenterLocation.SLatLon));
                doc = doc.Replace("Total Distance", Utils.LanguageSupport.Instance.GetTranslation(STR_TOTALDISTANCE));
                webBrowser1.Navigate("about:blank");
                if (webBrowser1.Document != null)
                {
                    webBrowser1.Document.Write(string.Empty);
                }
                webBrowser1.DocumentText = doc;
            }

            LocationInfo li = new LocationInfo();
            li.Location = new Framework.Data.Location(_core.HomeLocation.Lat, _core.HomeLocation.Lon);
            li.Name = string.Format("{0}", Utils.LanguageSupport.Instance.GetTranslation(STR_HOME));
            listBox2.Items.Add(li);
            comboBox1.Items.Add(li);
            comboBox2.Items.Add(li);

            li = new LocationInfo();
            li.Location = new Framework.Data.Location(_core.CenterLocation.Lat, _core.CenterLocation.Lon);
            li.Name = string.Format("{0}", Utils.LanguageSupport.Instance.GetTranslation(STR_CENTER));
            listBox2.Items.Add(li);
            comboBox1.Items.Add(li);
            comboBox2.Items.Add(li);

            var geocaches = Utils.DataAccess.GetSelectedGeocaches(_core.Geocaches).Take(200);
            foreach (Framework.Data.Geocache gc in geocaches)
            {
                li = new LocationInfo();
                li.Location = new Framework.Data.Location(gc.Lat, gc.Lon);
                li.Name = gc.Name ?? "";

                listBox2.Items.Add(li);
                comboBox1.Items.Add(li);
                comboBox2.Items.Add(li);
            }
        }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:57,代码来源:GoogleDirectionsForm.cs


示例12: GetDisplayName

 private static string GetDisplayName(LocationInfo location)
 {
     var displayAttribute = location.PropertyInfo.GetCustomAttributes(typeof(DisplayNameAttribute), false).FirstOrDefault();
     if (displayAttribute != null)
     {
         return ((DisplayNameAttribute)displayAttribute).DisplayName;
     }
     return location.Name;
 }
开发者ID:fpommerening,项目名称:PostSharpSamples,代码行数:9,代码来源:ErrorHandlerAspect.cs


示例13: CompileTimeInitialize

 public override void CompileTimeInitialize(LocationInfo locationInfo, AspectInfo aspectInfo)
 {
     RaisePropertyChanged = locationInfo.DeclaringType.GetMethod(
         "RaisePropertyChanged",
         BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
         null,
         new[] { typeof(string) },
         null);
 }
开发者ID:thlorenz,项目名称:NotifyPropertyChanged,代码行数:9,代码来源:NotifyPropertyChangedAttribute.cs


示例14: AstPythonType

        public AstPythonType(PythonAst ast, IPythonModule declModule, ClassDefinition def, string doc, LocationInfo loc) {
            _members = new Dictionary<string, IMember>();

            Name = def.Name;
            Documentation = doc;
            DeclaringModule = declModule;
            Mro = new IPythonType[0];
            Locations = new[] { loc };
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:9,代码来源:AstPythonType.cs


示例15: GetLocationInfo

 /// <summary>
 /// Gets the location information such as:
 /// Yükseklik:  28 m. Boylam:  29° 9' D Enlem:  40° 54' K Gün Batımı:  17:10 Gün Doğumu:  07:21
 /// </summary>
 /// <param name="locationInfoNodes">The html location information nodes.</param>
 private static LocationInfo GetLocationInfo(HtmlNodeCollection locationInfoNodes)
 {
     LocationInfo locationInfo = new LocationInfo();
     locationInfo.Altitude = locationInfoNodes[0].LastChild.InnerText.RemoveNbsp();
     locationInfo.Longitude = locationInfoNodes[1].LastChild.InnerText.RemoveNbsp().ReplaceQuoteAndDegree();
     locationInfo.Latitude = locationInfoNodes[2].LastChild.InnerText.RemoveNbsp().ReplaceQuoteAndDegree();
     locationInfo.Sunset = locationInfoNodes[3].LastChild.InnerText.RemoveNbsp();
     locationInfo.Sunrise = locationInfoNodes[4].LastChild.InnerText.RemoveNbsp();
     return locationInfo;
 }
开发者ID:ozcanzaferayan,项目名称:MGM-Weather-Forecast,代码行数:15,代码来源:WeatherParser.cs


示例16: CompileTimeValidate

 public override bool CompileTimeValidate(LocationInfo locationInfo)
 {
     if (!typeof (INotifyPropertyChanged).IsAssignableFrom(locationInfo.DeclaringType))
     {
         Message.Write(locationInfo, SeverityType.Error, "Error1",
                       "The type '{0}' must implement INotifyPropertyChanged in order to decorate property '{1}' with NotifyPropertyChangedAspect.",
                       locationInfo.DeclaringType, locationInfo.PropertyInfo);
         return false;
     }
     return base.CompileTimeValidate(locationInfo);
 }
开发者ID:GregRos,项目名称:FieldEditor,代码行数:11,代码来源:NotifyPropertyChangedAspect.cs


示例17: Start

    // Use this for initialization
    void Start()
    {
        myLocation = new LocationInfo();
        lat = myLocation.latitude;
        lon = myLocation.longitude;

        url = "http://maps.google.com/maps/api/staticmap?center=" + lat + "," + lon + "&zoom=14&size=800x600&maptype=hybrid&sensor=true";

        StartCoroutine(Myyield(url));
        Debug.Log("lat : " + lat + " lon : " + lon);
    }
开发者ID:YoonDaewon,项目名称:cash-walk,代码行数:12,代码来源:Maptest.cs


示例18: LocationFinderItem

		public LocationFinderItem (CustomerProfile person, LocationInfo address)
		{
			this.Type = LocationFinderItemType.Contact;
			this.DataItem = address;

			//this.Text = string.Format ("{0} {1}", person.FirstName, person.LastName);
			this.Detail = address.StreetAddress;			

			this.FormattedAddress = address.FormattedAddress;
			this.Lat = address.Lat;
			this.Lng = address.Lng;
		}
开发者ID:avantidesai,项目名称:EmpireCLS,代码行数:12,代码来源:LocationFinder.cs


示例19: CompileTimeValidate

        public override bool CompileTimeValidate(LocationInfo locationInfo)
        {
            Type requiredType = typeof(INotifyPropertyChanged);

            PropertyInfo property = locationInfo.PropertyInfo;
            if (property == null || !requiredType.IsAssignableFrom(property.DeclaringType))
            {
                throw new Exception(string.Format("The {0} aspect can only be applied to properties of types implementing {1}.", GetType().Name, requiredType.Name));
            }

            return base.CompileTimeValidate(locationInfo);
        }
开发者ID:nixkuroi,项目名称:PhilosopherDeveloper,代码行数:12,代码来源:NotifyPropertyChangedAttribute.cs


示例20: CompileTimeValidate

        public override bool CompileTimeValidate(LocationInfo locationInfo)
        {
            if (!typeof (FrameworkElement).IsAssignableFrom(locationInfo.DeclaringType))
            {
                Message.Write(locationInfo, SeverityType.Error, "Error2",
                              @"The type {0} must derive from FrameworkElement in order to decorate property '{1}' with ResourceBoundPropertyAspect.",
                              locationInfo.DeclaringType, locationInfo.PropertyInfo);

                return false;
            }
            return base.CompileTimeValidate(locationInfo);
        }
开发者ID:GregRos,项目名称:FieldEditor,代码行数:12,代码来源:ResourceBoundPropertyAspect.cs



注:本文中的LocationInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LocationType类代码示例发布时间:2022-05-24
下一篇:
C# LocationCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap