private void Activar_Datos_Click(object sender, EventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Cellular; connectionSettingsTask.Show(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); }
/// <summary> /// Handles the network connection. /// </summary> private void HandleNetworkConnection() { NetworkDispatcher.IsConnected(connected => { if (!connected) { Deployment.Current.Dispatcher.BeginInvoke(delegate { var m = MessageBox.Show(AppResources.NetworkRequired, "", MessageBoxButton.OKCancel); switch (m) { case MessageBoxResult.OK: { var cTask = new ConnectionSettingsTask { ConnectionSettingsType = ConnectionSettingsType.WiFi }; cTask.Show(); } break; case MessageBoxResult.Cancel: Application.Current.Terminate(); break; } }); } }); }
private async void btnRefresh_Click(object sender, System.Windows.RoutedEventArgs e) { try { var peers = await PeerFinder.FindAllPeersAsync(); PeerList.ItemsSource = (peers ?? new PeerInformation[] {}).Select(p => new PeerAppInfo(p)); } catch (Exception ex) { if ((uint)ex.HResult == 0x8007048F) { var result = MessageBox.Show(AppResources.Err_BluetoothOff, AppResources.Err_BluetoothOffCaption, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { var connectionSettingsTask = new ConnectionSettingsTask { ConnectionSettingsType = ConnectionSettingsType.Bluetooth }; connectionSettingsTask.Show(); } } else if ((uint)ex.HResult == 0x80070005) { // You should remove this check before releasing. MessageBox.Show(AppResources.Err_MissingCaps); } else if ((uint)ex.HResult == 0x8000000E) { MessageBox.Show(AppResources.Err_NotAdvertising); } else { MessageBox.Show(ex.Message); } } }
private void Activar_Blue_Click(object sender, EventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); }
/*================================Eventos AppBar Button==============================*/ private void Activar_Wifi_Click(object sender, EventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); }
private void Activar_Avion_Click(object sender, EventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.AirplaneMode; connectionSettingsTask.Show(); }
private void wifiSetting_Click(object sender, EventArgs e) { ConnectionSettingsTask task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.WiFi; task.Show(); }
// Constructor //protected override void onnavigateto public MainPage() { InitializeComponent(); // Set the data context of the listbox control to the sample data DataContext = App.ViewModel; if (!NetworkInterface.GetIsNetworkAvailable()) { MessageBoxResult m = MessageBox.Show("You arent connected to the internet to load the techniques. Want to connect now?", "No connection", MessageBoxButton.OKCancel); if (m == MessageBoxResult.OK) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); } if (m == MessageBoxResult.Cancel) { } } for (int i = 0; i < TechnicListBox.Items.Count; i++) { TreeHelper treeHelper = new TreeHelper(); var currentSelectedListBoxItem = this.TechnicListBox.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem; CharacterProgressControl.WP8.CProgressControl cp = treeHelper.FindDescendant <CharacterProgressControl.WP8.CProgressControl>(currentSelectedListBoxItem); cp.Value = 50; } this.Loaded += new RoutedEventHandler(MainPage_Loaded); }
void showBTSettings() { var task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; task.Show(); }
private void ShowBluetoothControlPanel() { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); }
private void ShowConnectionSettingsType(int id) { var task = new ConnectionSettingsTask(); switch (id) { case 0: task.ConnectionSettingsType = ConnectionSettingsType.Cellular; break; case 1: task.ConnectionSettingsType = ConnectionSettingsType.WiFi; break; case 2: task.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; break; case 3: task.ConnectionSettingsType = ConnectionSettingsType.AirplaneMode; break; default: // do nothing break; } task.Show(); }
private void connectionSettings_Click(object sender, EventArgs e) { var task = new ConnectionSettingsTask { ConnectionSettingsType = ConnectionSettingsType.AirplaneMode, }; task.Show(); }
private void NavigateToCommunicationSettings(ConnectionSettingsType type) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); ConnectionSettingsType connectionSettingsType = type; connectionSettingsTask.ConnectionSettingsType = connectionSettingsType; connectionSettingsTask.Show(); }
public void showBluetoothSettings(string args) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); DispatchCommandResult(new PluginResult(PluginResult.Status.OK)); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { //if (NetworkInterface.GetIsNetworkAvailable()) if (true) { await LoadData(); } else { IAsyncResult result = Guide.BeginShowMessageBox( AppResources.SplashScreen_OnNavigatedTo_No_Network, AppResources.SplashScreen_OnNavigatedTo_No_network_details, new string[] { "wifi", "3G/4G-LTE" }, 0, MessageBoxIcon.Error, null, null ); result.AsyncWaitHandle.WaitOne(); int?choice = Guide.EndShowMessageBox(result); if (choice.HasValue) { if (choice.Value == 0) { ConnectionSettingsTask con = new ConnectionSettingsTask(); con.ConnectionSettingsType = ConnectionSettingsType.WiFi; con.Show(); } else { ConnectionSettingsTask con = new ConnectionSettingsTask(); con.ConnectionSettingsType = ConnectionSettingsType.Cellular; con.Show(); } } else { MessageBoxResult res = MessageBox.Show(AppResources.SplashScreen_OnNavigatedTo_OfflineModeQuestion, AppResources.SplashScreen_OnNavigatedTo_Offline_Mode, MessageBoxButton.OKCancel); if (res == MessageBoxResult.Cancel) { StaticMethod.Quit(); } else if (res == MessageBoxResult.OK) { StaticData.isOffline = true; //Navigate to MainPage MessageBox.Show("Voucher World required a working internet connection", "We are sorry", MessageBoxButton.OK); StaticMethod.Quit(); //NavigationService.Navigate(new Uri("/PageGroups/KaraokeGroup/OfflinePage.xaml", UriKind.Relative)); } } } base.OnNavigatedTo(e); }
private void ShowBluetoothSettings() { ConnectionSettingsTask bluetoothSettingsTask = new ConnectionSettingsTask() { ConnectionSettingsType = ConnectionSettingsType.Bluetooth }; bluetoothSettingsTask.Show(); }
private void btnConnect_Click(object sender, RoutedEventArgs e) { ConnectionSettingsTask cst = new ConnectionSettingsTask() { ConnectionSettingsType = ConnectionSettingsType.Bluetooth }; cst.Show(); }
public MainPage() { InitializeComponent(); MyPivot.SelectionChanged += MyPivot_SelectionChanged; abm.SetEvent(IconMenu.About, (sender, e) => { NavigationService.Navigate(new Uri("/Pages/AboutPage.xaml", UriKind.Relative)); }); abm.SetEvent(IconMenu.WiFi, (sender, e) => { var task = new ConnectionSettingsTask { ConnectionSettingsType = ConnectionSettingsType.WiFi }; task.Show(); }); abm.SetEvent(IconMenu.ControlPanel, (sender, e) => { ApplicationBar.IsVisible = false; cpm.Show(); }); }
private void leftButton_Click(object sender, RoutedEventArgs e) { if (wizard.SelectedItem == wizardItemWiFi) { ConnectionSettingsTask task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.WiFi; task.Show(); } else { Hide(); } }
public CountryDescription() { InitializeComponent(); InitializeComponent(); if (!DeviceNetworkInformation.IsNetworkAvailable) { ConnectionSettingsTask cst = new ConnectionSettingsTask(); cst.ConnectionSettingsType = ConnectionSettingsType.WiFi; cst.Show(); } client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(new Uri("http://localhost:23790/WebService/GetCountry?ID=1"), UriKind.Absolute); }
private async void checkBluetooth() { SolidColorBrush statuscolor = new SolidColorBrush(); try { PeerFinder.AlternateIdentities["Bluetooth:Paired"] = ""; var devices = await PeerFinder.FindAllPeersAsync(); bluetoothStatus.Text = "Online"; statuscolor.Color = Colors.Green; bluetoothStatus.Foreground = statuscolor; if (devices.Count == 0) { MessageBox.Show("No paired bluetooth devices have been found, please pair with a bluetooth device!"); await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:")); var task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; task.Show(); } PeerInformation peerInfo = devices.FirstOrDefault(c => c.DisplayName.Contains(DeviceName.Text)); DeviceName.Text = peerInfo.DisplayName; if (peerInfo == null) { MessageBox.Show("No paired device please pair with a device!"); await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:")); } await socket.ConnectAsync(peerInfo.HostName, "1"); DeviceName.Text = peerInfo.ServiceName.ToString(); await socket.ConnectAsync(peerInfo.HostName, peerInfo.ServiceName); } catch (Exception ex) { if ((uint)ex.HResult == 0x8007048F) { bluetoothStatus.Text = "Offline"; statuscolor.Color = Colors.Red; bluetoothStatus.Foreground = statuscolor; } } }
public AttractionsClass() { InitializeComponent(); if (!DeviceNetworkInformation.IsNetworkAvailable) { ConnectionSettingsTask cst = new ConnectionSettingsTask(); cst.ConnectionSettingsType = ConnectionSettingsType.WiFi; cst.Show(); } clientPlaces.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); clientPlaces.OpenReadAsync(new Uri("http://pm.studentlive.pl/WebService/GetCountries?start=0&count=20"), UriKind.Absolute); clientCountires.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); clientCountires.OpenReadAsync(new Uri("http://pm.studentlive.pl/WebService/GetCountries?start=0&count=20"), UriKind.Absolute); }
private void button1_Click(object sender, RoutedEventArgs e) { if (!DeviceNetworkInformation.IsNetworkAvailable) { ConnectionSettingsTask cst = new ConnectionSettingsTask(); cst.ConnectionSettingsType = ConnectionSettingsType.WiFi; cst.Show(); } WebClient webclient = new WebClient(); webclient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webclient_DownloadStringCompleted); webclient.DownloadStringAsync(new Uri("http://www.google.com/ig/api?weather=" + locationTextBox.Text)); // weather location CurrentWeather.Text = locationTextBox.Text + " weather forecast"; }
public AttractionsCities() { InitializeComponent(); if (!DeviceNetworkInformation.IsNetworkAvailable) { ConnectionSettingsTask cst = new ConnectionSettingsTask(); cst.ConnectionSettingsType = ConnectionSettingsType.WiFi; cst.Show(); } String countryName = PhoneApplicationService.Current.State["Country"].ToString(); clientPlaces.OpenReadCompleted += new OpenReadCompletedEventHandler(clientCities_OpenReadCompleted); clientPlaces.OpenReadAsync(new Uri("http://pm.studentlive.pl/WebService/GetPlaces?country=" + countryName + "&start=0&count=20"), UriKind.Absolute); clientCountires.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); clientCountires.OpenReadAsync(new Uri("http://pm.studentlive.pl/WebService/GetCountries?start=0&count=20"), UriKind.Absolute); }
/// <summary> /// Opens Bluetooth settings dialog. /// </summary> private void OpenBluetoothSettings() { try { PhoneApplicationService service = PhoneApplicationService.Current; service.Activated += this.OnResume; ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); this.isBluetoothSettingsOpen = true; } catch (Exception) { this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Unable to open Bluetooth settings")); } }
private void ConnectivityProblem() { _dataContext.Communication.Stop(); _dataContext.Communication.Start(); Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBoxResult r = MessageBox.Show("Would you like to make sure that Bluetooth has been turned on?", "Unable to connect", MessageBoxButton.OKCancel); if (r.HasFlag(MessageBoxResult.OK)) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } }); }
public PanoramicMain() { InitializeComponent(); if (!DeviceNetworkInformation.IsNetworkAvailable) { ConnectionSettingsTask cst = new ConnectionSettingsTask(); cst.ConnectionSettingsType = ConnectionSettingsType.WiFi; cst.Show(); } WebClient client = new WebClient(); if (watcher == null) { //---get the highest accuracy--- watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High) { //---the minimum distance (in meters) to travel before the next // location update--- MovementThreshold = 10 }; //---event to fire when a new position is obtained--- watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs <GeoCoordinate>>(watcher_PositionChanged); //---event to fire when there is a status change in the location // service API--- watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs> (watcher_StatusChanged); watcher.Start(); } map1.Center = new GeoCoordinate(51.10955, 17.037048); map1.ZoomBarVisibility = System.Windows.Visibility.Visible; String lat = map1.Center.Latitude.ToString(); String lon = map1.Center.Longitude.ToString(); lat = lat.Replace(",", "."); lon = lon.Replace(",", "."); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(new Uri("http://pm.studentlive.pl/WebService/GetAttractionsByLatLng?lat=" + lat + "&lng=" + lon), UriKind.Absolute); map1.ZoomLevel = 12; }
public void Show(string which) { var task = new ConnectionSettingsTask(); switch (which) { case KnownSettings.Bluetooth: task.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; break; case KnownSettings.Wifi: task.ConnectionSettingsType = ConnectionSettingsType.WiFi; break; default: throw new NotSupportedException("Not supported " + which); } task.Show(); }
/// <summary> /// Asynchronous call to re-populate the ListBox of paired devices. /// </summary> private async void RefreshPairedDevicesList() { try { // Search for all paired devices PeerFinder.AlternateIdentities["Bluetooth:Paired"] = ""; var peers = await PeerFinder.FindAllPeersAsync(); // By clearing the backing data, we are effectively clearing the ListBox _pairedDevices.Clear(); if (peers.Count == 0) { MessageBox.Show(AppResources.Msg_NoPairedDevices); } else { // Found paired devices. foreach (var peer in peers) { _pairedDevices.Add(new PairedDeviceInfo(peer)); } } } catch (Exception ex) { if ((uint)ex.HResult == 0x8007048F) { var result = MessageBox.Show(AppResources.Msg_BluetoothOff, "Bluetooth Off", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { var connectionSettingsTask = new ConnectionSettingsTask { ConnectionSettingsType = ConnectionSettingsType.Bluetooth }; connectionSettingsTask.Show(); } } else if ((uint)ex.HResult == 0x80070005) { MessageBox.Show(AppResources.Msg_MissingCaps); } else { MessageBox.Show(ex.Message); } } }
private async void Settings_Loaded(object sender, RoutedEventArgs e) { try { PeerFinder.AlternateIdentities["Bluetooth:Paired"] = ""; var peers = await PeerFinder.FindAllPeersAsync(); var displayNames = peers.Where(x => !string.IsNullOrEmpty(x.DisplayName)).Select(x => x.DisplayName).ToList(); devices.ItemsSource = displayNames; // Need to handle the case when the device no longer is paired if (!displayNames.Contains(App.MainViewModel.SettingsViewModel.BluetoothDeviceName)) { App.MainViewModel.SettingsViewModel.BluetoothDeviceName = null; } } catch (Exception ex) { // Unable to connect to bluetooth, so just clear the value. App.MainViewModel.SettingsViewModel.BluetoothDeviceName = null; if ((uint)ex.HResult == ObdErrorCodes.ERR_BLUETOOTH_OFF) { var result = MessageBox.Show("Bluetooth is turned off, would you like to see the current Bluetooth settings?", "Bluetooth Off", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } } else { MessageBox.Show("Unable to query for Bluetooth devices.\n" + ex.Message, "Error", MessageBoxButton.OK); } } finally { if (!App.RunningInEmulator) { this.DataContext = App.MainViewModel; } } }
private void leftButton_Click(object sender, RoutedEventArgs e) { var selectedItem = wizard.SelectedItem; if (selectedItem == wizardItemWiFi) { ConnectionSettingsTask task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.WiFi; task.Show(); } else if (selectedItem == wizardItemHostnamePIN) { ConnectToServer(); } else if (selectedItem == wizardItemConnecting) { // TODO: Cancel connection } }
public override void OnClick() { string internalName = InternalName; if (internalName == "Bluetooth") { var task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; task.Show(); } else if (internalName == "Wifi") { var task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.WiFi; task.Show(); } else if (internalName == "Phone") { //ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA5602/Start"); ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA561C/CallSettings"); } else if (internalName == "Search") { ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA5661/SearchHome?QuerySource=HardwareBtn"); } else if (internalName == "BatterySaving") { ApplicationApi.LaunchSession("app://AFE91DD5-26FB-4ba6-A5A4-4BCEDE8FB3E6/_default"); } else if (internalName == "DataConnection") { ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA561F/_default"); } else if (internalName == "Accelerometer") { ApplicationApi.LaunchSession("app://126b3759-8034-4fff-b987-3c0c6f9136f3/_default"); } else if (internalName == "InternetSharing") { ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA5629/_default"); } }
private void CheckNetwork() { IsSearchButtonEnabled = true; if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) { IsSearchButtonEnabled = false; var result = MessageBox.Show( NetworkInterface.NetworkInterfaceType + AppResources.NetworkBlowUp, AppResources.NoConnection, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { var connectionSettingsTask = new ConnectionSettingsTask { ConnectionSettingsType = ConnectionSettingsType.WiFi }; connectionSettingsTask.Show(); } } }
private void OnOK() { bool bGoBack = true; if (!DeviceNetworkInformation.IsNetworkAvailable) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); return; } if (m_AppInput != null) { string strRes = txSvrIP.Text; //NoEmpty... if (m_AppInput.GetFlag(1).Length > 0) { strRes = strRes.Trim(); if (strRes.Length == 0) { MessageBox.Show("Value must not be empty!"); return; } } /* * //FileName... * if( m_AppInput.GetFlag(1).Length > 0 ) * { * strRes = strRes.Trim(); * * string strChk = "\\/:*?\"<>|"; * foreach( char cChk in strChk ) * { * if( strRes.IndexOf( cChk ) >= 0 ) * { * MessageBox.Show("Value must not contain characters of '" + strChk + "'!"); * return; * } * } * } */ bGoBack = false; if (RscUtils.IsIpAddress(strRes)) { /* * MessageBox.Show("IP Address is not allowed here!"); * return; */ DoOk(); } else { prsBar.Visibility = Rsc.Visible; var endpoint = new DnsEndPoint(strRes, 0); DeviceNetworkInformation.ResolveHostNameAsync(endpoint, OnHostResolved, null); } } if (bGoBack) { this.NavigationService.GoBack(); } }
public async void ConnectKreyosDevice (string p_device) { if (string.IsNullOrWhiteSpace(p_device)) { ObserverInfo info = new ObserverInfo(); info.Command = EBTEvent.BTE_OnDeviceDisconnected; info.Error = "Error! Invalid device name!"; BluetoothObserver.Instance.Trigger(EBTEvent.BTE_OnDeviceDisconnected, info); return; } var succ = await BluetoothAgent.Instance.Start(p_device); if (succ) { BluetoothAgent.Instance.InnerProtocol.OnElementParsed += OnElementParsed; BluetoothAgent.Instance.InnerProtocol.OnFileReceived += OnFileReceived; BluetoothAgent.Instance.InnerProtocol.OnDeviceIDRead += OnDeviceIDRead; BluetoothAgent.Instance.InnerProtocol.OnActivityDataRead += OnActivityDataRead; BluetoothAgent.Instance.InnerProtocol.OnSportsGridRead += OnSportsGridRead; BluetoothAgent.Instance.InnerProtocol.OnActivityDataEnd += OnActivityDataEnd; BluetoothAgent.Instance.InnerProtocol.OnActivityDataPrepared += OnActivityDataPrepared; BluetoothAgent.Instance.InnerProtocol.OnActivityDataSync += OnActivityDataSync; BluetoothAgent.Instance.InnerProtocol.OnFirmwareVersionRequest += OnFirmwareVersionRequest; BluetoothAgent.Instance.InnerProtocol.OnOverallActivitiesReceived += OnOverallActivitiesReceived; BluetoothAgent.Instance.InnerProtocol.OnTodayActivityReceived += OnTodayActivityReceived; BluetoothAgent.Instance.InnerProtocol.OnSportsDataReceived += OnSportsDataReceived; ObserverInfo info = new ObserverInfo(); info.Command = EBTEvent.BTE_OnDeviceConnected; info.Device = p_device; BluetoothObserver.Instance.Trigger(EBTEvent.BTE_OnDeviceConnected, info); return; } else { switch (BluetoothAgent.Instance.ConnectInfo) { case EBTConnect.BluetoothIsOff: { var result = MessageBox.Show("Bluetooth is turned off. To see the current Bluetooth settings tap 'ok'", "Bluetooth Off", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { // TODO: Show the bluetooth control panel here ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } } break; case EBTConnect.CapPermission: { MessageBox.Show("To run this app, you must have ID_CAP_PROXIMITY enabled in WMAppManifest.xaml"); } break; } ObserverInfo info = new ObserverInfo(); info.Command = EBTEvent.BTE_OnDeviceDisconnected; info.Error = BluetoothAgent.Instance.ErrorMessage; BluetoothObserver.Instance.Trigger(EBTEvent.BTE_OnDeviceDisconnected, info); } }
public BingMaps() { InitializeComponent(); if (!InternetIsAvailable()) { //Service1Client objClient = new Service1Client(); //objClient.WiFiCompleted += new EventHandler<WiFiCompletedEventArgs>(WIFiCall); //objClient.WiFiAsync(); ConnectionSettingsTask task = new ConnectionSettingsTask(); task.ConnectionSettingsType = ConnectionSettingsType.WiFi; task.Show(); } if (watcher == null) { //---get the highest accuracy--- watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High) { //---the minimum distance (in meters) to travel before the next // location update--- MovementThreshold = 10 }; //---event to fire when a new position is obtained--- watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs <GeoCoordinate>>(watcher_PositionChanged); //---event to fire when there is a status change in the location // service API--- watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs> (watcher_StatusChanged); watcher.Start(); } map1.Center = new GeoCoordinate(47.676289396624654, -122.12096571922302); map1.ZoomBarVisibility = System.Windows.Visibility.Visible; map1.ZoomLevel = 15; for (int i = 0; i < 10; i++) { //---create a new pushpin--- Pushpin pin = new Pushpin(); //---set the location for the pushpin--- pin.Location = new GeoCoordinate(47.676289396624654+i, -122.12096571922302+i); //---add the pushpin to the map--- pin.Content = new Ellipse() { Fill = image, StrokeThickness = 10, Height = 100, Width = 100 }; pin.MouseLeftButtonUp += new MouseButtonEventHandler(Pushpin_MouseLeftButtonUp); //---add the pushpin to the map--- map1.Children.Add(pin); } }
private void GetObdData() { if (App.RunningInEmulator && this.progressIndicatorVisibility) { return; } Dispatcher.BeginInvoke(() => { this.SetProgressIndicatorVisibility(true); }); ThreadPool.QueueUserWorkItem(async (object state) => { // If user changes the device name, null it out so that future calls will re-create the device. if (this.device != null && this.device.DisplayName != App.MainViewModel.SettingsViewModel.BluetoothDeviceName) { this.device = null; } if (this.device == null) { try { this.device = await this.service.GetObdDevice(App.MainViewModel.SettingsViewModel.BluetoothDeviceName); if (this.device == null && this.RunningInForeground()) { Dispatcher.BeginInvoke(() => { MessageBox.Show("No OBD II devices found of name " + App.MainViewModel.SettingsViewModel.BluetoothDeviceName, "Error", MessageBoxButton.OK); this.SetProgressIndicatorVisibility(false); }); } } catch (Exception ex) { Dispatcher.BeginInvoke(() => { this.SetProgressIndicatorVisibility(false); if (this.RunningInForeground()) { if ((uint)ex.HResult == ObdErrorCodes.ERR_BLUETOOTH_OFF) { var result = MessageBox.Show("Bluetooth is turned off, would you like to see the current Bluetooth settings?", "Bluetooth Off", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } } else { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } } }); } } if (this.device != null) { try { ObdModel data = await this.service.GetObdData(this.device); this.DisplayObdData(data); } catch (Exception ex) { Dispatcher.BeginInvoke(() => { this.SetProgressIndicatorVisibility(false); if (this.RunningInForeground()) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } }); } } }); }
private void WifiButton_OnClick(object sender, RoutedEventArgs e) { var connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); }
private void ToggleWifi_Click(object sender, RoutedEventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); }
private void ShowBluetoothcControlPanel() { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); }
/// <summary> /// Connect to the given host device. /// </summary> /// <param name="deviceHostName">The host device name.</param> public async Task Connect() { try { PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "{00001101-0000-1000-8000-00805f9b34fb}"; var pairedDevices = await PeerFinder.FindAllPeersAsync(); if (pairedDevices.Count == 0) { Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("No paired devices were found."); }); } else { foreach (PeerInformation pairedDevice in pairedDevices) { if (pairedDevice.DisplayName == "HC-05") { if (socket != null) { await socket.ConnectAsync(pairedDevice.HostName, "1", SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication); dataReader = new DataReader(socket.InputStream); dataReadWorker.RunWorkerAsync(); dataWriter = new DataWriter(socket.OutputStream); await SendCommand("SYNC_DATA"); } break; } } } } catch (Exception ex) { if ((uint)ex.HResult == 0x80070490) { Deployment.Current.Dispatcher.BeginInvoke(() => { if (MessageBox.Show("Bluetooth device is not connected. Click OK to open Bluetooth settings.", "Alert!", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } }); } else if ((uint)ex.HResult == 0x80070103) { Deployment.Current.Dispatcher.BeginInvoke(() => { if (MessageBox.Show("Bluetooth device is not available or turned off. Click OK to open Bluetooth settings.", "Alert!", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } }); } else if ((uint)ex.HResult == 0x8007048F) { Deployment.Current.Dispatcher.BeginInvoke(() => { if (MessageBox.Show("Bluetooth is turned off. Click OK to open Bluetooth settings.", "Alert!", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); } }); } } }
private void m_AppFrame_OnNext(object sender, EventArgs e) { if (!DeviceNetworkInformation.IsNetworkAvailable) { if (!DeviceNetworkInformation.IsCellularDataEnabled) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); return; } else { MessageBox.Show("ATT: For security reasons and high amount of possible data FTP connection through the Internet and Public WiFi networks is not recommended!"); } } m_AppFrame.ShowButtonNext(false); parPanel.Visibility = Rsc.Collapsed; if (chbAutoLogOn.IsChecked.Value) { btnLogUsr.Visibility = Rsc.Collapsed; btnLogPw.Visibility = Rsc.Collapsed; } if (chbAutoPasv.IsChecked.Value) { btnPasv.Visibility = Rsc.Collapsed; } //lastFilePanel.Visibility = Rsc.Collapsed; //Rsc.Visible; SetLastFile("", false); pathPanel.Visibility = Rsc.Visible; custCmdPanel.Visibility = Rsc.Visible; logPanel.Visibility = Rsc.Visible; svrAddr.Text = " "; svrTit.Text = " "; svrPanel.Visibility = Rsc.Visible; //WP81 FIX //m_ftpc.SetFastConnection( chbFastConn.IsChecked.Value, chbFastConnEx.IsChecked.Value ); NationalChrsToTestFileNames = ""; if (chbNatFsNames.IsChecked.Value) { NationalChrsToTestFileNames = " (ÁáÉéÍíÓóÖöŐőÚúÜüŰű)"; } sSAVE_Status = ""; scSAVE = StatusColoring.Normal; _Log("21", "Connecting..."); SaveToReg(); //unkLISTresLEN sign reset... m_AppFrame.TRACE = ""; m_ftpc.CloseAllSockets(); m_ftpc.IPAddress = txSvrIP.Text.ToString(); m_ftpc.Port = Int32.Parse(txSvrPort.Text.ToString()); m_ftpc.UserName = txUsr.Text.ToString(); m_ftpc.PassWord = txPwd.Text.ToString(); m_ftpc.AutoLogOn = chbAutoLogOn.IsChecked.Value; m_ftpc.AutoPassiveMode = chbAutoPasv.IsChecked.Value; m_ftpc.Connect(); }
public static void ShowBluetoothControlPanel() { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; connectionSettingsTask.Show(); }
private void Login_Click(object sender, RoutedEventArgs e) { if (!DeviceNetworkInformation.IsWiFiEnabled) { MessageBoxResult result = MessageBox.Show(AppResources.WIFI_OFF_MESSAGE, AppResources.WIFI_OFF, MessageBoxButton.OK); switch (result) { case MessageBoxResult.OK: ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); return; } } else { bool found = false; NetworkInterfaceList netList = new NetworkInterfaceList(); foreach (NetworkInterfaceInfo network in netList) { if (network.InterfaceType == NetworkInterfaceType.Wireless80211 && network.InterfaceState == ConnectState.Connected && network.InterfaceName.StartsWith("Rm3Wi-Fi")) { found = true; break; } } if (!found) { MessageBox.Show(AppResources.WRONG_WIFI_MESSAGE, AppResources.WRONG_WIFI, MessageBoxButton.OK); return; } } LoggedInText.Text = String.Empty; ProgressBar.Visibility = Visibility.Visible; webClient = new WebClient(); webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; var uri = new Uri("https://authentication.uniroma3.it/login.pl", UriKind.Absolute); StringBuilder postData = new StringBuilder(); postData.AppendFormat("{0}={1}", "bs_name", HttpUtility.UrlEncode(Username.Text)); postData.AppendFormat("&{0}={1}", "bs_password", HttpUtility.UrlEncode(Password.Password)); postData.AppendFormat("&{0}={1}", "_FORM_SUBMIT", HttpUtility.UrlEncode("1")); postData.AppendFormat("&{0}={1}", "which_form", HttpUtility.UrlEncode("reg")); //postData.AppendFormat("&{0}={1}", "source", HttpUtility.UrlEncode("10.8.1.199")); //postData.AppendFormat("&{0}={1}", "destination", HttpUtility.UrlEncode("www.uniroma3.it")); webClient.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString(); webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadStringCompleted); try { webClient.UploadStringAsync(uri, "POST", postData.ToString()); } catch (Exception) { webClient.UploadStringCompleted -= webClient_UploadStringCompleted; MessageBox.Show(AppResources.WEB_ERROR_MESSAGE, AppResources.WEB_ERROR, MessageBoxButton.OK); } }
private void btnWiFi_Click(object sender, RoutedEventArgs e) { connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show(); }
private void Toggle3G_Click(object sender, RoutedEventArgs e) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Cellular; connectionSettingsTask.Show(); }
public bool networkCheck() { bool temp=DeviceNetworkInformation.IsNetworkAvailable; if (!temp) { MessageBoxResult r = MessageBox.Show("Internet Connectivity", "Something isn't quite right here. I cant find the interwebs and this feature doesnt work without interwebs. Want me to take you to the WiFi's?", MessageBoxButton.OKCancel); if (r == MessageBoxResult.OK) { ConnectionSettingsTask launchWifi = new ConnectionSettingsTask(); launchWifi.ConnectionSettingsType = ConnectionSettingsType.WiFi; launchWifi.Show(); networkCheck(); temp = true; } else { MessageBox.Show("If You Say So", "Whatever you say but this means the messaging feature will not enable", MessageBoxButton.OK); temp = false; } } return temp; }
private void Button_Click(object sender, RoutedEventArgs e) { ConnectionSettingsTask con = new ConnectionSettingsTask(); con.Show(); }
/// <summary> /// 打开 WiFi / Bluetooth / Cellular / AirplaneMode 设置界面 /// </summary> /// <param name="type">ConnectionSettingsType</param> public void OpenConnectionSetting(ConnectionSettingsType type) { ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = type; connectionSettingsTask.Show(); }