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

C# Pin类代码示例

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

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



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

示例1: UpdatePosition

        private void UpdatePosition()
        {
            if (_previousPin != null)
            {
                _map.Pins.Remove(_previousPin);
            }
            else
            {
                _previousPin = new Pin();
            }

            _map.Pins.Clear();

            var zoomLat = _map.VisibleRegion == null ? 6.0 : _map.VisibleRegion.LatitudeDegrees;
            var zoomLon = _map.VisibleRegion == null ? 6.0 : _map.VisibleRegion.LongitudeDegrees;
            var zoomRad = _map.VisibleRegion == null ? 6.0 : _map.VisibleRegion.Radius.Miles;
            
            _map.MoveToRegion(new MapSpan(_mapViewModel.UserPosition, zoomLat, zoomLon ));

            // _map.MoveToRegion(MapSpan.FromCenterAndRadius(_mapViewModel.UserPosition, Distance.FromMiles(zoomRad)));
            MapSpan temp = _map.VisibleRegion;

            GetWeb();

            //Add the pin.
            Position pinPos = new Position(_mapViewModel.UserPosition.Latitude, _mapViewModel.UserPosition.Longitude);
            _previousPin.Position = pinPos;
            _previousPin.Label = "My Location";
            _previousPin.Type = PinType.Generic;
            _map.Pins.Add(_previousPin);

            UpdateServerUser();
        }
开发者ID:TinusGreen,项目名称:GendacProjects,代码行数:33,代码来源:MapView.xaml.cs


示例2: MapPage

		public MapPage ()
		{
			NavigationPage.SetHasNavigationBar (this, true);

			Title = "Austin, Texas";

			/* DON'T FORGET
			 * Xamarin.QuickUIMaps.Init (); 
			 */
			var map = new Map(new MapSpan(new Position(30.26535, -97.738613), 0.05, 0.05))
			{
				MapType = MapType.Street,
				HeightRequest = 508
			};
			map.BackgroundColor = Color.White;

			Pin pin;
			map.Pins.Add(pin = new Pin()
				{
					Label = "Evolve 2013", 
					Position = new Position(30.26535, -97.738613),
					Type = PinType.Place
				});

			Content = new StackLayout {
				VerticalOptions = LayoutOptions.StartAndExpand,
				Children = {
					map

				}
			};
		}
开发者ID:ZaK14120,项目名称:xamarin-forms-samples,代码行数:32,代码来源:MapPage.cs


示例3: TristatePort

 /// <summary>
 ///  Construct a new TristatePort object
 /// </summary>
 /// <param name="pin">
 ///   A <see cref="Pin"/> type representing a pin
 /// </param>
 /// <exception cref="ActivatePinException"></exception>
 public TristatePort(Pin pin)
 {
     this._p = pin;
     bool export = this._Export(_p);
     if(!export)
         throw new ActivatePinException("Pin is working, stop first!");
 }
开发者ID:GerardSoleCa,项目名称:BachelorThesisMisc,代码行数:14,代码来源:TristatePort.cs


示例4: GetGeoXaml

        public GetGeoXaml()
        {
            InitializeComponent();

            map.MoveToRegion(MapSpan.FromCenterAndRadius(centerPosition, Distance.FromKilometers(4d)));

            button.Clicked += async (sender, e) =>
            {
                var locator = CrossGeolocator.Current;
                locator.DesiredAccuracy = 50;

                var location = await locator.GetPositionAsync(10000);

                LatLabel.Text = "Lat: " + location.Latitude.ToString("N6");
                LonLabel.Text = "Lon: " + location.Longitude.ToString("N6");

                var addr = await getAddress.GetJsonAsync(location.Latitude, location.Longitude) ?? "取得できませんでした";

                AddrLabel.Text = "Address: " + addr;

                // Map を移動させてピン打ち
                map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(location.Latitude, location.Longitude), Distance.FromKilometers(4d)));
                if (map.Pins.Count() > 0)
                    map.Pins.Clear();
                pin = new Pin
                {
                    Position = new Position(location.Latitude, location.Longitude),
                    Label = addr,
                };
                map.Pins.Add(pin);
            };
        }
开发者ID:zcccust,项目名称:Study,代码行数:32,代码来源:GetGeoXaml.xaml.cs


示例5: MapController

        public MapController(Entity entity)
        {
            try {
                Entity = entity;

                Title = Entity.EntityTypeName;

                _map = new MKMapView ();

                _pin = new Pin(Entity);

                _map.Frame = View.Bounds;
                _map.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

                _map.AddAnnotation(_pin);

                _map.Region = new MKCoordinateRegion (_pin.Coordinate, new MKCoordinateSpan (0.01, 0.01));

                View.AddSubview (_map);

                _map.SelectAnnotation(_pin, true);

            } catch (Exception error) {
                Log.Error (error);
            }
        }
开发者ID:jorik041,项目名称:odata,代码行数:26,代码来源:MapController.cs


示例6: SevenSegSpi

        public SevenSegSpi(Spi SPIModule, Pin csPin, int numDevices = 1)
        {
            this.SPIModule = SPIModule;
            SPIModule.Start(SPIMode.Mode00, 1);
            this.csPin = csPin;

            if(numDevices<=0 || numDevices>8 )
                throw new Exception("This library supports 1 to 8 displays.");

            this.numDevices = numDevices;

            this.csPin.DigitalValue = true;

             spiData = new byte[numDevices*2];

            for(int i=0; i<numDevices; i++)
            {
                spiTransfer(OP_DISPLAYTEST, 0, i);
                //scanlimit is set to max on startup
                setScanLimit(7, i);
                //decode is done in source
                spiTransfer(OP_DECODEMODE, 0, i);
                clearDisplay(i);
                //we go into shutdown-mode on startup
                shutdown(false, i);
                setIntensity(10, i);
            }
        }
开发者ID:angamaiton,项目名称:treehopper-sdk,代码行数:28,代码来源:SevenSegSpi.cs


示例7: DHTTemperatureAndHumiditySensor

 internal DHTTemperatureAndHumiditySensor(GrovePi device, Pin pin, DHTModel model)
 {
     if (device == null) throw new ArgumentNullException(nameof(device));
     _device = device;
     _pin = pin;
     _model = model;
 }
开发者ID:CleoQc,项目名称:GrovePi,代码行数:7,代码来源:DHTTemperatureAndHumiditySensor+.cs


示例8: AnalogFeedbackServo

        /// <summary>
        /// Construct a new analog feedback servo from an analog pin and a speed controller
        /// </summary>
        /// <param name="analogIn">The analog in pin to use for position feedback</param>
        /// <param name="Controller">The speed controller to use to control the motor</param>
        public AnalogFeedbackServo(Pin analogIn, MotorSpeedController Controller) 
        {
            this.analogIn = analogIn;
            this.controller = Controller;
            analogIn.Mode = PinMode.AnalogInput;
            isRunning = true;
            controlLoopTask = new Task(async() =>
            {
                while (isRunning)
                {
                    var oldPosition = ActualPosition;
                    var newPosition = analogIn.AnalogValue;
                    ActualPosition = newPosition;

                    var error = GoalPosition - ActualPosition;

                    if (Math.Abs(error) > ErrorThreshold)
                        controller.Speed = Utilities.Constrain(K * error, -1.0, 1.0);
                    else
                    {
                        controller.Speed = 0;
                        //Debug.WriteLine("goal achieved");
                    }
                    await Task.Delay(10);
                }
            });
            controlLoopTask.Start();
        }
开发者ID:treehopper-electronics,项目名称:treehopper-sdk,代码行数:33,代码来源:AnalogFeedbackServo.cs


示例9: GetMax7219GraphicLedDisplay

        public static LedGraphicDisplay GetMax7219GraphicLedDisplay(Spi port, Pin latch, int numDevices)
        {
            IEnumerable<Led> finalList = new List<Led>();
            for (int i = 0; i < numDevices; i++)
            {
                Max7219 driver;

                driver = new Max7219(port, latch, i);

                var tempList = new List<Led>();

                // We have to re-order the LEDs from the Max7219
                {
                    for (int k = 62; k >= 56; k--)
                    {
                        for (int m = k; m >= 0; m -= 8)
                        {
                            tempList.Add(driver.Leds[m]);
                        }
                    }

                    for (int k = 63; k >= 0; k -= 8)
                    {
                        tempList.Add(driver.Leds[k]);
                    }
                }

                finalList = finalList.Concat(tempList);
            }

            var display = new LedGraphicDisplay(finalList.ToList(), 8 * numDevices, 8);

            return display;
        }
开发者ID:treehopper-electronics,项目名称:treehopper-sdk,代码行数:34,代码来源:HobbyDisplayFactories.cs


示例10: TemperatureSensor

 internal TemperatureSensor(IGrovePi device, Pin pin, TemperatureSensorModel model)
 {
     if (device == null) throw new ArgumentNullException(nameof(device));
     _device = device;
     _pin = pin;
     _model = model;
 }
开发者ID:benoitjadinon,项目名称:GrovePi-1,代码行数:7,代码来源:TemperatureSensor.cs


示例11: FetchData

		private async Task FetchData() {
			var apiService = new FatSubsService ();
			var apiResult = await apiService.GetDetailsAsync ();
			if (apiResult != null) {
				Model = apiResult;
				var coder = new Geocoder ();
				var portlandPositions = await coder.GetPositionsForAddressAsync ("Portland, Oregon");
				if (portlandPositions.Any()) {
					Portland = portlandPositions.ElementAt (0);
				}

				var positions = await coder.GetPositionsForAddressAsync (Model.Location.Address);
				foreach (var pos in positions) {
					var location = new Pin () {
						Position = pos,
						Address = Model.Location.Address,
						Type = PinType.Place,
						Label = Model.Location.Name
					};

					if (UpdateMapCommand != null) {
						UpdateMapCommand.Execute (location);
					}
				}
			}

		}
开发者ID:tvand7093,项目名称:FatSubs.Mobile,代码行数:27,代码来源:AllDetailsViewModel.cs


示例12: Locate

        private void Locate()
        {
            if (vm != null)
            {
                var position = new XLabs.Platform.Services.Geolocation.Position();
                //default position
                position.Longitude = vm.Longitude;
                position.Latitude = vm.Latitude;

                var pin = new Pin
                {
                    Type = PinType.Place,
                    Position = new Position(vm.Latitude, vm.Longitude),
                    Label = "Accident Location",
                    Address = ""
                };

                map.Circle = new CustomCircle
                {
                    Position = position,
                    Radius = 800
                };

                map.Pins.Add(pin);

                map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(vm.Latitude, vm.Longitude
                    ), Distance.FromMiles(0.9)));
            }
           
        }
开发者ID:Railgun-it,项目名称:autoresolve-app,代码行数:30,代码来源:WhatHappenedMapPage.xaml.cs


示例13: TeamMembers

        public TeamMembers()
        {
            InitializeComponent();

            this.Title = PageResources.DefaultPageTitle;

            // CJP TODO, need to move team member service to ioc container
            TeamMemberService service = new TeamMemberService();
            var teamMemberList = service.GetTestData();

            MyMap.MoveToRegion(MapSpan.FromCenterAndRadius(
                new Position(32.8946723, -96.9774144), Distance.FromMiles(1)));

            foreach (var teamMember in teamMemberList)
            {
                var position = new Position(teamMember.UserLocation.Latitude, teamMember.UserLocation.Longitude); // Latitude, Longitude
                var pin = new Pin
                {
                    Type = PinType.SearchResult,
                    Position = position,
                    Label = teamMember.User.Name,
                    Address = teamMember.UserLocation.AddressName
                };

                MyMap.Pins.Add(pin);

                // CJP TODO, need add MediaPlayer for pop sound playback foreach teamMember
            }

        }
开发者ID:rhubley,项目名称:Xamarin_AgileDefender,代码行数:30,代码来源:TeamMembers.xaml.cs


示例14: Wire

        public Wire(Pin pin)
        {
            if (pin == null)
                throw new ArgumentNullException("pin");

            Input = pin;
        }
开发者ID:vinmenn,项目名称:HBus.DotNet,代码行数:7,代码来源:Wire.cs


示例15: NodeDoubleClick

 public void NodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     try
     {
         string MName = e.Node.Name + "_NodeDoubleClick";
         MethodInfo methodInfo = this.GetType().GetMethods().Where(n => n.Name.Equals(MName)).FirstOrDefault();
         if (methodInfo != null)
         {
             SENDER = sender;
             TNMCEA = e;
             TREENODE = e.Node;
             if (e.Node.Tag is Pin)
             {
                 PIN = e.Node.Tag as Pin;
                 NdataBaseHelper.DBFullName = PIN.DataBasePath;
             }
             methodInfo.Invoke(this, new object[] { });//调用MName名字的函数
             DoubleClick_OK = true;
         }
         else
         {
             DoubleClick_OK = false;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
开发者ID:haoxinqing,项目名称:DataVerification,代码行数:29,代码来源:EventClass.cs


示例16: LoadPin

        public async Task<Pin> LoadPin()
        {
            Position p = _GeoCodingService.NullPosition;
            var address = Lead.AddressString;

            //Lookup Lat/Long all the time.
            //TODO: Only look up if no value, or if address properties have changed.
            //if (Contact.Latitude == 0)
            if (true)
            {
                p = await _GeoCodingService.GeoCodeAddress(address);
                //p = p == null ? Utils.NullPosition : p;

                Lead.Latitude = p.Latitude;
                Lead.Longitude = p.Longitude;
            }

            var pin = new Pin
            {
                Type = PinType.Place,
                Position = p,
                Label = Lead.DisplayName,
                Address = address
            };

            return pin;
        }
开发者ID:Arksutw,项目名称:app-crm,代码行数:27,代码来源:LeadDetailViewModel.cs


示例17: MapPageCS

		public MapPageCS ()
		{
			var customMap = new CustomMap {
				MapType = MapType.Street,
				WidthRequest = App.ScreenWidth,
				HeightRequest = App.ScreenHeight
			};

			var pin = new Pin {
				Type = PinType.Place,
				Position = new Position (37.79752, -122.40183),
				Label = "Xamarin San Francisco Office",
				Address = "394 Pacific Ave, San Francisco CA"
			};

			var position = new Position (37.79752, -122.40183);
			customMap.Circle = new CustomCircle {
				Position = position,
				Radius = 1000
			};

			customMap.Pins.Add (pin);
			customMap.MoveToRegion (MapSpan.FromCenterAndRadius (position, Distance.FromMiles (1.0)));

			Content = customMap;
		}
开发者ID:eduardoguilarducci,项目名称:recipes,代码行数:26,代码来源:MapPageCS.cs


示例18: StoreMapPage

        public StoreMapPage()
        {
            var map = new Map (
                         MapSpan.FromCenterAndRadius (
                             new Position (30.0219504, -89.8830829), Distance.FromMiles (0.3))) {
                IsShowingUser = true,
                HeightRequest = 100,
                WidthRequest = 960,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            // pin first address
            var positionA = new Position (30.517174,-90.463322);

            var pinA = new Pin {
                Type = PinType.Place,
                Position = positionA,
                Label = "Store A (HQ)",
                Address = "100 Janes Lane, \n Hammond, LA, \n 70401"
            };
            map.Pins.Add (pinA);

            // pin second address
            var positionB = new Position (37.42565,-122.13535);

            var pinB = new Pin {
                Type = PinType.Place,
                Position = positionB,
                Label = "Store B",
                Address = "Silicon Valley, Palo Alto, CA, \n 94025"
            };
            map.Pins.Add (pinB);

            // pin third address
            var positionC = new Position (42.360091,-71.09416);

            var pinC = new Pin {
                Type = PinType.Place,
                Position = positionC,
                Label = "Store C",
                Address = "Boston, MA, \n 02481"
            };
            map.Pins.Add (pinC);

            // add the slider
            var slider = new Slider (1, 18, 1);
            slider.ValueChanged += (sender, e) => {
                var zoomLevel = e.NewValue; // between 1 and 18
                var latlongdegrees = 360 / (Math.Pow (2, zoomLevel));
                //Debug.WriteLine(zoomLevel + " -> " + latlongdegrees);
                if (map.VisibleRegion != null)
                    map.MoveToRegion (new MapSpan (map.VisibleRegion.Center, latlongdegrees, latlongdegrees));
            };

            var stackLayout = new StackLayout { Spacing = 0 };
            stackLayout.Children.Add (map);
            stackLayout.Children.Add (slider);

            Content = stackLayout;
        }
开发者ID:camotts,项目名称:383-Admin-Portal-Mobile-App,代码行数:60,代码来源:StoreMapPage.cs


示例19: MainPage

        public MainPage()
        {
            InitializeComponent();

            Set.Clicked += async (sender, e) =>
            {
                double latitude = MyMap.VisibleRegion.Center.Latitude;
                double longitude = MyMap.VisibleRegion.Center.Longitude;

                var weather = await weatherService.GetCurrentWeather(latitude, longitude);
                var position = new Xamarin.Forms.Maps.Position(latitude, longitude);
                var pin = new Pin
                {
                    Type = PinType.Generic,
                    Position = position,
                    Label = $"{weather.main.temp}°C",
                    Address = $"{weather.description}",
                };
                MyMap.Pins.Add(pin);
            };

            Cancel.Clicked += (sender, e) =>
            {
                if (MyMap.Pins.Count > 0)
                {
                    MyMap.Pins.Remove(MyMap.Pins.Last());
                }
            };
        }
开发者ID:AlinaBlahun,项目名称:WeatherMap,代码行数:29,代码来源:MainPage.xaml.cs


示例20: RotaryAngleSensor

 internal RotaryAngleSensor(GrovePi device, Pin pin)
 {
     if (device == null) throw new ArgumentNullException(nameof(device));
     device.PinMode(_pin, PinMode.Input);
     _device = device;
     _pin = pin;
 }
开发者ID:CleoQc,项目名称:GrovePi,代码行数:7,代码来源:RotaryAngleSensor.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# PinState类代码示例发布时间:2022-05-24
下一篇:
C# PieceType类代码示例发布时间: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