当前位置: 首页>>代码示例>>C#>>正文


C# Pin类代码示例

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


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


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