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


C# IAdapter类代码示例

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


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

示例1: DeviceListViewModel

        public DeviceListViewModel(IDispatcherHelper dispatcherHelper, 
            INavigationService navigationService,
            IAdapter adapter,
            Func<IDevice, DeviceViewModel> deviceViewModelFactory)
        {
            _dispatcherHelper = dispatcherHelper;
            _navigationService = navigationService;
            _adapter = adapter;
            _deviceViewModelFactory = deviceViewModelFactory;

            _adapter.ScanTimeoutElapsed += (s, e) =>
            {
                StopScan();
            };
            _adapter.DeviceDiscovered += (s, e) =>
            {
                if (_devices.All(d => d.ID != e.Device.ID))
                {
                    _dispatcherHelper.RunOnUIThread(() =>
                        {
                            _devices.Add(e.Device);
                        });
                }
            };
        }
开发者ID:milindur,项目名称:MdkControlApp,代码行数:25,代码来源:DeviceListViewModel.cs

示例2: DockingViewManager

 public DockingViewManager(ITransport transport, IAdapter adapter, IScheduler scheduler, LocalScheduler dispatcher)
 {
     _transport = transport;
     _adapter = adapter;
     _scheduler = scheduler;
     _dispatcher = dispatcher;
 }
开发者ID:jqd072014,项目名称:code.root,代码行数:7,代码来源:DockingViewManager.cs

示例3: DeviceList

		public DeviceList (IAdapter adapter)
		{
			InitializeComponent ();
			this.adapter = adapter;
			this.devices = new ObservableCollection<IDevice> ();
			listView.ItemsSource = devices;

			adapter.DeviceDiscovered += (object sender, DeviceDiscoveredEventArgs e) => {
				Device.BeginInvokeOnMainThread(() => {
					devices.Add (e.Device);
				});
			};

			adapter.ScanTimeoutElapsed += (sender, e) => {
				adapter.StopScanningForDevices(); // not sure why it doesn't stop already, if the timeout elapses... or is this a fake timeout we made?
				Device.BeginInvokeOnMainThread ( () => {
					IsBusy = false;
					DisplayAlert("Timeout", "Bluetooth scan timeout elapsed, no heart rate monitors were found", "OK");
				});
			};

			ScanHrmButton.Activated += (sender, e) => {
				InfoFrame.IsVisible = false;
				// this is the UUID for Heart Rate Monitors
				StartScanning (0x180D.UuidFromPartial());
			};
		}
开发者ID:ZaK14120,项目名称:xamarin-forms-samples,代码行数:27,代码来源:DeviceList.xaml.cs

示例4: DeviceList

		public DeviceList (IAdapter adapter)
		{
			InitializeComponent ();
			this.adapter = adapter;
			this.devices = new ObservableCollection<IDevice> ();
			listView.ItemsSource = devices;

			adapter.DeviceDiscovered += (object sender, DeviceDiscoveredEventArgs e) => {
				Device.BeginInvokeOnMainThread(() => {
					devices.Add (e.Device);
				});
			};

			adapter.ScanTimeoutElapsed += (sender, e) => {
				IsBusy = false;
				Debug.WriteLine ("Scan timeout");
				if (autoScan) {
					StartScanning ();
				}
			};

			Appearing += (sender, e) => {
				StartScanning();
			};
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:25,代码来源:DeviceList.xaml.cs

示例5: DurationTraderViewModelController

 public DurationTraderViewModelController(ITransport transport, IAdapter adapter, IScheduler scheduler, LocalScheduler dispatcher)
 {
     transport.GetTradingObservables()
         .SubscribeOn(scheduler)
         .ObserveOn(dispatcher)
         .Subscribe(fSet => adapter.updater(fSet, ViewModel));
 }
开发者ID:jqd072014,项目名称:code.root,代码行数:7,代码来源:DurationTraderViewModelController.cs

示例6: ServiceList

		public ServiceList (IAdapter adapter, IDevice device)
		{
			InitializeComponent ();
			this.adapter = adapter;
			this.device = device;
			this.services = new ObservableCollection<IService> ();
			listView.ItemsSource = services;

			// when device is connected
			adapter.DeviceConnected += (s, e) => {
				device = e.Device; // do we need to overwrite this?

				// when services are discovered
				device.ServicesDiscovered += (object se, EventArgs ea) => {
					Debug.WriteLine("device.ServicesDiscovered");
					//services = (List<IService>)device.Services;
					if (services.Count == 0)
						Device.BeginInvokeOnMainThread(() => {
							foreach (var service in device.Services) {
								services.Add(service);
							}
						});
				};
				// start looking for services
				device.DiscoverServices ();

			};
			// TODO: add to IAdapter first
			//adapter.DeviceFailedToConnect += (sender, else) => {};

			DisconnectButton.Activated += (sender, e) => {
				adapter.DisconnectDevice (device);
				Navigation.PopToRootAsync(); // disconnect means start over
			};
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:35,代码来源:ServiceList.xaml.cs

示例7: SetAdapter

 public void SetAdapter(IAdapter adapter)
 {
     if (this.adapter == adapter) return;
     this.adapter = adapter;
     if (adapter != null) adapter.RegisterDataSetObserver(richDataSetObsever);
     ReloadChildViews();
 }
开发者ID:ramanan-java,项目名称:AXSample,代码行数:7,代码来源:RichLinearLayout.cs

示例8: TestPage

		public TestPage (IAdapter adapter)
		{
			InitializeComponent ();
			this.adapter = adapter;
			this.devices = new ObservableCollection<IDevice> ();
			this.services = new ObservableCollection<IService> ();
			this.characteristics = new ObservableCollection<ICharacteristic> ();

			adapter.BluetoothStateUpdated += Adapter_BluetoothStateUpdated;
			adapter.ScanCompleted += Adapter_ScanCompleted;
			adapter.DeviceDiscovered += Adapter_DeviceDiscovered;
			adapter.DeviceConnected += Adapter_DeviceConnected;
			adapter.DeviceDisconnected += Adapter_DeviceDisconnected;
			adapter.DeviceFailedToConnect += Adapter_DeviceFailedToConnect;
			adapter.CommandResponse += Adapter_CommandResponse;
		
			btnValidate.Clicked += OnStartClicked;
			btnGenerateCode.Clicked += OnGenerateCodeClicked;
			btnDisconnect.Clicked += OnDisconnectDevice;

			btnGenSerial.Clicked += OnGenSerialClicked;
			btnValidateUser.Clicked += BtnValidateUser_Clicked;
			btnChangeUser.Clicked += BtnChangeUser_Clicked;

			//file.CreateFileAsync ("testFile.txt");
		}
开发者ID:yelkrebb,项目名称:XamTest,代码行数:26,代码来源:TestPage.xaml.cs

示例9: CharacteristicDetail_TISensor

		public CharacteristicDetail_TISensor (IAdapter adapter, IDevice device, IService service, ICharacteristic characteristic)
		{
			InitializeComponent ();
			this.characteristic = characteristic;

			Title = characteristic.Name;
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:7,代码来源:CharacteristicDetail_TISensor.xaml.cs

示例10: SetAdapter

    public void SetAdapter(IAdapter adapter)
    {
        mIAdapter = adapter;

        mIDevice.OnConnect(mIAdapter.controller);

    }
开发者ID:seenen,项目名称:HerosTechBak_Seenen,代码行数:7,代码来源:JoystickController.cs

示例11: Process

 public bool Process(Data data, IAdapter adapter)
 {
     if (data.Device == device && (data.Service & service) > 0)
     {
         double value = Util.DataAdapter.GetGraphableValue(data);
         if (comparison == "<")
         {
             if (value < threshold) Email(value, adapter);
         }
         else if (comparison == "<=")
         {
             if (value <= threshold) Email(value, adapter);
         }
         else if (comparison == "==")
         {
             if (value == threshold) Email(value, adapter);
         }
         else if (comparison == ">=")
         {
             if (value >= threshold) Email(value, adapter);
         }
         else if (comparison == ">")
         {
             if (value > threshold) Email(value, adapter);
         }
     }
     return true;
 }
开发者ID:ziyan,项目名称:reactivity,代码行数:28,代码来源:ThresholdEmailWarning.cs

示例12: DeviceList

		public DeviceList (IAdapter adapter)
		{
			InitializeComponent ();
			this.adapter = adapter;
			this.devices = new ObservableCollection<IDevice> ();
			listView.ItemsSource = devices;

			adapter.DeviceDiscovered += (object sender, DeviceDiscoveredEventArgs e) => {
				Device.BeginInvokeOnMainThread(() => {
					//TODO: uncomment this if there are a lot of Bluetooth devices around cluttering your list (and remove the line below)
//					if (e.Device.Name != null) {
//            			if (e.Device.Name.ToLower().Contains("biscuit")) {
//                			devices.Add(e.Device);
//            			}
//            		}
					devices.Add (e.Device);
				});
			};

			adapter.ScanTimeoutElapsed += (sender, e) => {
				IsBusy = false;
				Debug.WriteLine ("Scan timeout");
				if (autoScan) {
					StartScanning ();
				}
			};

			Appearing += (sender, e) => {
				StartScanning();
			};
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:31,代码来源:DeviceList.xaml.cs

示例13: ConnectAsync

		Task<ControlClient> ConnectAsync (IAdapter adapter)
		{
			var tcs = new TaskCompletionSource<ControlClient> ();

			adapter.DeviceDiscovered += (object sender, DeviceDiscoveredEventArgs e) => {
				Device.BeginInvokeOnMainThread(async () => {

					// Look for a specific device
					if (e.Device.ID.ToString ().StartsWith ("af18", StringComparison.OrdinalIgnoreCase)) {

						// Connect to the device
						await adapter.ConnectAsync (e.Device);

						// Establish the control client
						using (var stream = new LEStream (e.Device)) {
							var client = new ControlClient (stream);
							client.RunAsync (CancellationToken.None); // Don't await to run in background
							tcs.SetResult (client);
						}

						// Update the UI
						connectLabel.Text = "Yay " + e.Device + "!";
					}
				});
			};

			adapter.StartScanningForDevices();

			return tcs.Task;
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:30,代码来源:MainPage.xaml.cs

示例14: PrintUserInfo

 public static void PrintUserInfo(IAdapter adapter)
 {
     Console.WriteLine("Имя:\t\t\t {0}", adapter.Name);
     Console.WriteLine("Возраст:\t\t {0}", adapter.Age);
     Console.WriteLine("Количество друзей:\t {0}", adapter.NumberOfFriends);
     Console.WriteLine("------- -------- ------- -------");
 }
开发者ID:PavelStryhelski,项目名称:PatternsAndTest,代码行数:7,代码来源:PrintData.cs

示例15: RequestResourceContext

 public RequestResourceContext(IAdapter adapter, IAdaptee adaptee,
     RequestType resource)
 {
     Adaptee = adaptee;
     Adapter = adapter;
     ReqType = resource;
 }
开发者ID:shasso,项目名称:cdp,代码行数:7,代码来源:ResortSystemCaseStudy.cs


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