public DevicePickerDialog(DevicePicker owner) { _owner = owner; Background = new SolidColorBrush(_owner.Appearance.BackgroundColor); Foreground = new SolidColorBrush(_owner.Appearance.ForegroundColor); Resources.Add("AccentBrush", new SolidColorBrush(_owner.Appearance.AccentColor)); Resources.Add("ForegroundBrush", new SolidColorBrush(_owner.Appearance.ForegroundColor)); Resources.Add("SelectedAccentBrush", new SolidColorBrush(_owner.Appearance.SelectedAccentColor)); Resources.Add("SelectedBackgroundBrush", new SolidColorBrush(_owner.Appearance.SelectedBackgroundColor)); Resources.Add("SelectedForegroundBrush", new SolidColorBrush(_owner.Appearance.SelectedForegroundColor)); InitializeComponent(); Loaded += DevicePickerDialog_Loaded; Closed += DevicePickerDialog_Closed; }
public DevicePickerDialog(DevicePicker owner) { _owner = owner; this.Background = new SolidColorBrush(this._owner.Appearance.BackgroundColor); this.Foreground = new SolidColorBrush(this._owner.Appearance.ForegroundColor); this.Resources.Add("AccentBrush", new SolidColorBrush(this._owner.Appearance.AccentColor)); this.Resources.Add("ForegroundBrush", new SolidColorBrush(this._owner.Appearance.ForegroundColor)); this.Resources.Add("SelectedAccentBrush", new SolidColorBrush(this._owner.Appearance.SelectedAccentColor)); this.Resources.Add("SelectedBackgroundBrush", new SolidColorBrush(this._owner.Appearance.SelectedBackgroundColor)); this.Resources.Add("SelectedForegroundBrush", new SolidColorBrush(this._owner.Appearance.SelectedForegroundColor)); this.InitializeComponent(); this.Loaded += DevicePickerDialog_Loaded; this.Closed += DevicePickerDialog_Closed; }
internal DevicePickerControl(DevicePicker picker, Popup popup) { _owner = picker; _popup = popup; _popup.Closed += _popup_Closed; _handle = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.AutoReset); this.Resources.Add("AccentBrush", new SolidColorBrush(this._owner.Appearance.AccentColor)); this.Resources.Add("ForegroundBrush", new SolidColorBrush(this._owner.Appearance.ForegroundColor)); this.Resources.Add("SelectedAccentBrush", new SolidColorBrush(this._owner.Appearance.SelectedAccentColor)); this.Resources.Add("SelectedBackgroundBrush", new SolidColorBrush(this._owner.Appearance.SelectedBackgroundColor)); this.Resources.Add("SelectedForegroundBrush", new SolidColorBrush(this._owner.Appearance.SelectedForegroundColor)); this.InitializeComponent(); RootVisual.Background = new SolidColorBrush(this._owner.Appearance.BackgroundColor); this.Foreground = new SolidColorBrush(this._owner.Appearance.ForegroundColor); this.Loaded += DevicePickerControl_Loaded; }
private Task <DeviceInformation> DoPickSingleDeviceAsync(Rect selection, Placement placement) { s_current = this; Intent i = new Intent(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity, typeof(DevicePickerActivity)); Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity.StartActivity(i); return(Task.Run <DeviceInformation>(() => { s_handle.WaitOne(); if (_device != null) { return Task.FromResult <DeviceInformation>(_device); } else { return Task.FromResult <DeviceInformation>(null); } })); }
private Task <DeviceInformation> DoPickSingleDeviceAsync() { s_current = this; // TODO: register EAAccessoryManager notifications so handle can be triggered when device picked EAAccessoryManager.SharedAccessoryManager.RegisterForLocalNotifications(); EAAccessoryManager.SharedAccessoryManager.AddObserver(EAAccessoryManager.DidConnectNotification, global::Foundation.NSKeyValueObservingOptions.New, (c) => { global::System.Diagnostics.Debug.WriteLine(c.NewValue.ToString()); }); EAAccessoryManager.SharedAccessoryManager.ShowBluetoothAccessoryPicker(null, (e) => { if (e != null) { global::System.Diagnostics.Debug.WriteLine(e.Code); } }); return(Task.Run <DeviceInformation>(() => { s_handle.WaitOne(); return Task.FromResult <DeviceInformation>(null); })); }