private async void GetData() { username = USERNAME.Text; password = PASSWORD.Password; if(username.Equals("") || password.Equals("")){ MessageBox.Show("Username or Password cannot be empty","Error",MessageBoxButton.OK); } else{ try { credentials = await credentialTable. Where(userCredentials => userCredentials.username == username && userCredentials.password == password). ToCollectionAsync(); } catch(MobileServiceInvalidOperationException e) { MessageBox.Show(e.Message,"Database Error",MessageBoxButton.OK); } int count = credentials.Count(); if (count == 1) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); string title = (string)e.Parameter; MobileServiceInvalidOperationException exception = null; try { CommentsItems = await CommentsTable. Where(Comments => Comments.to == title). ToCollectionAsync(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { int length = CommentsItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(CommentsItems[count].title); } } Ring.IsActive = false; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); // Read data from table MobileServiceInvalidOperationException exception = null; try { SharedAudioItems = await SharedAudioTable.ToCollectionAsync(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { int length = SharedAudioItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(SharedAudioItems[count].fileName); } } }
private async void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //LoadChartContents(); MobileServiceInvalidOperationException exception = null; string idDeshidratadora; object selectedItem = comboBox.SelectedValue.ToString(); idDeshidratadora = selectedItem.ToString(); try { ProgressBarBefore(); DateTime date = DatePickerToChart.Date.DateTime; LoadChartContents(date); IMobileServiceTableQuery <Deshidratadora> query = DeshTable.Where(Desh => Desh.idDeshidratadora == idDeshidratadora); var res = await query.ToListAsync(); falladesh = await FallaTableDesh .Select(Falla => Falla) .Where(Falla => Falla.idDeshidratadora == idDeshidratadora /*&& Falla.Fecha == date.ToString("yyyy-MM-dd") /*&& Falla.Atendido == "0"*/) .ToCollectionAsync(); string cantFallas = falladesh.Count().ToString(); var item = res.First(); string marca = item.Marca; string modelo = item.Modelo; string sn = item.No_Serie; textBlockMarca.Text = marca; textBlockModelo.Text = modelo; textBlockNoSerie.Text = sn; textBlockTotalAlertas.Text = cantFallas; ProgressBarAfter(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error!").ShowAsync(); } }
private async void SendCompletionMessageForLocations() { // First, create the VoiceCommandUserMessage with the strings // that Cortana will show and speak. var userMessage = new VoiceCommandUserMessage(); userMessage.DisplayMessage = "Hier sind ein paar Orte in Deiner Nähe."; userMessage.SpokenMessage = "Orte in Deiner Nähe."; string loadingLocations = "Suche nach Orte"; await ShowProgressScreen(loadingLocations); var locationsContentTiles = new List<VoiceCommandContentTile>(); MobileServiceInvalidOperationException exception = null; try { // This code is querying the address table. items = await addressTable.ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { Debug.WriteLine("Error loading items"); } else { if (items.Count() == 0) { string foundNoTripToDestination = "Keine Orte gefunden"; userMessage.DisplayMessage = foundNoTripToDestination; userMessage.SpokenMessage = foundNoTripToDestination; } else { foreach (var item in items) { int i = 1; var locationTile = new VoiceCommandContentTile(); // To handle UI scaling, Cortana automatically looks up files with FileName.scale-<n>.ext formats based on the requested filename. // See the VoiceCommandService\Images folder for an example. locationTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText; locationTile.Image = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///AlternaVoiceCommandService/Images/GreyTile.png")); locationTile.Title = item.Name; if (item.Street != null) { locationTile.TextLine1 = item.Street.ToString(); } if (item.Number != null) { locationTile.TextLine2 = item.Number.ToString(); } locationsContentTiles.Add(locationTile); i++; } } } // Create the VoiceCommandResponse from the userMessage and list // of content tiles. var response = VoiceCommandResponse.CreateResponse(userMessage, locationsContentTiles); // Ask Cortana to display the user message and content tile and // also speak the user message. await voiceServiceConnection.ReportSuccessAsync(response); }
private async void comboBoxidTecnico_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboBoxidTecnico.SelectedItem != null) { ProgressBarBefore(); try { usuarios = await UsuarioTable .Select(Usuario => Usuario) .Where(Usuario => Usuario.id == comboBoxidTecnico.SelectedValue.ToString()) .ToCollectionAsync(); ProgressBarAfter(); if (usuarios.Count() == 1) { var tecnico = usuarios.First(); textBlockNombre.Text = tecnico.Nombre; textBlock15Apaterno.Text = tecnico.APaterno; textBlock15Amaterno.Text = tecnico.AMaterno; textBlock15Telefono.Text = tecnico.telefono; textBlock15Correo.Text = tecnico.correo; textBlock15Direccion.Text = tecnico.direccion; } } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error!").ShowAsync(); } gridDetallesTecnico.Visibility = Visibility.Visible; } }
private async void checkBox_Checked(object sender, RoutedEventArgs e) { enableChangeStatus(); gridDetallesTecnico.Visibility = Visibility.Visible; //Cargar combobox id tecnico if(comboBoxIdDispositivo.SelectedItem != null) { try { ProgressBarBefore(); usuarios = await UsuarioTable .Select(Usuario => Usuario) .Where(Usuario => Usuario.Tipo == "Tecnico") .ToCollectionAsync(); comboBoxidTecnico.ItemsSource = usuarios; ProgressBarAfter(); comboBoxidTecnico.DisplayMemberPath = "id"; comboBoxidTecnico.SelectedValuePath = "id"; comboBoxidTecnico.SelectedIndex = 0; if(comboBoxEstado.SelectedIndex == 0) { //Selecciono atendido comboBoxCambiarEstado.SelectedIndex = 0; } else { //Selecciono no atendido comboBoxCambiarEstado.SelectedIndex = 1; } } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error al cargar a los Técnicos!").ShowAsync(); } } if(comboBoxidTecnico.SelectedItem != null) { ProgressBarBefore(); try { usuarios = await UsuarioTable .Select(Usuario => Usuario) .Where(Usuario => Usuario.id == comboBoxidTecnico.SelectedValue.ToString()) .ToCollectionAsync(); ProgressBarAfter(); if (usuarios.Count() == 1) { var tecnico = usuarios.First(); textBlockNombre.Text = tecnico.Nombre; textBlock15Apaterno.Text = tecnico.APaterno; textBlock15Amaterno.Text = tecnico.AMaterno; textBlock15Telefono.Text = tecnico.telefono; textBlock15Correo.Text = tecnico.correo; textBlock15Direccion.Text = tecnico.direccion; } }catch(MobileServiceInvalidOperationException ex) { exception = ex; } if(exception != null) { await new MessageDialog(exception.Message, "Error!").ShowAsync(); } gridDetallesTecnico.Visibility = Visibility.Visible; } }
public async Task<double> RefreshTelemetryItemValue(string sensor) { double value = -1; MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the telemetry2 table. telemetryItems = await telemetryTable .Where( (s => (s.Complete == false) && (s.Sensor == sensor)) ) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { //Sort in descending order = Most recent first .. Ww want the latest value of each sensor if (telemetryItems != null) { if (telemetryItems.Count() != 0) value = (double)telemetryItems.First().Value; } } return value; }
private async void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //LoadChartContents(); MobileServiceInvalidOperationException exception = null; string idDeshidratadora; object selectedItem = comboBox.SelectedValue.ToString(); idDeshidratadora = selectedItem.ToString(); try { ProgressBarBefore(); DateTime date = DatePickerToChart.Date.DateTime; LoadChartContents(date); IMobileServiceTableQuery<Deshidratadora> query = DeshTable.Where(Desh => Desh.idDeshidratadora == idDeshidratadora); var res = await query.ToListAsync(); falladesh= await FallaTableDesh .Select(Falla => Falla) .Where(Falla => Falla.idDeshidratadora == idDeshidratadora /*&& Falla.Fecha == date.ToString("yyyy-MM-dd") /*&& Falla.Atendido == "0"*/) .ToCollectionAsync(); string cantFallas = falladesh.Count().ToString(); var item = res.First(); string marca = item.Marca; string modelo = item.Modelo; string sn = item.No_Serie; textBlockMarca.Text = marca; textBlockModelo.Text = modelo; textBlockNoSerie.Text = sn; textBlockTotalAlertas.Text = cantFallas; ProgressBarAfter(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error!").ShowAsync(); } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); string title = (string)e.Parameter; lblTitle.Text = title; //Connect to azure table //Retrieve the storage account from the connection string. // Read data from table MobileServiceInvalidOperationException exception = null; try { if (title == "Textbook") { textbookItems = await textbookTable.ToCollectionAsync(); } else if (title == "Job") { JobItems = await JobTable.ToCollectionAsync(); } else if (title == "Rent Room") { RentRoomItems = await RentRoomTable.ToCollectionAsync(); } else if (title == "Society & Club") { SocietyItems = await SocietyTable.ToCollectionAsync(); } else if (title == "Party") { PartyItems = await PartyTable.ToCollectionAsync(); } else if (title == "Stuff") { StuffItems = await StuffTable.ToCollectionAsync(); } } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { // Add all data in a list if (title == "Textbook") { int length = textbookItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(textbookItems[count].bookName); } } else if (title == "Job") { int length = JobItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(JobItems[count].title); } } else if (title == "Rent Room") { int length = RentRoomItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(RentRoomItems[count].roomTitle); } } else if (title == "Society & Club") { int length = SocietyItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(SocietyItems[count].societyName); } } else if (title == "Party") { int length = PartyItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(PartyItems[count].partyTitle); } } else if (title == "Stuff") { int length = StuffItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(StuffItems[count].name); } } } Ring.IsActive = false; }
private async void SendCompletionMessageForLocations() { // First, create the VoiceCommandUserMessage with the strings // that Cortana will show and speak. var userMessage = new VoiceCommandUserMessage(); userMessage.DisplayMessage = "Hier sind ein paar Orte in Deiner Nähe."; userMessage.SpokenMessage = "Orte in Deiner Nähe."; string loadingLocations = "Suche nach Orte"; await ShowProgressScreen(loadingLocations); var locationsContentTiles = new List <VoiceCommandContentTile>(); MobileServiceInvalidOperationException exception = null; try { // This code is querying the address table. items = await addressTable.ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { Debug.WriteLine("Error loading items"); } else { if (items.Count() == 0) { string foundNoTripToDestination = "Keine Orte gefunden"; userMessage.DisplayMessage = foundNoTripToDestination; userMessage.SpokenMessage = foundNoTripToDestination; } else { foreach (var item in items) { int i = 1; var locationTile = new VoiceCommandContentTile(); // To handle UI scaling, Cortana automatically looks up files with FileName.scale-<n>.ext formats based on the requested filename. // See the VoiceCommandService\Images folder for an example. locationTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText; locationTile.Image = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///AlternaVoiceCommandService/Images/GreyTile.png")); locationTile.Title = item.Name; if (item.Street != null) { locationTile.TextLine1 = item.Street.ToString(); } if (item.Number != null) { locationTile.TextLine2 = item.Number.ToString(); } locationsContentTiles.Add(locationTile); i++; } } } // Create the VoiceCommandResponse from the userMessage and list // of content tiles. var response = VoiceCommandResponse.CreateResponse(userMessage, locationsContentTiles); // Ask Cortana to display the user message and content tile and // also speak the user message. await voiceServiceConnection.ReportSuccessAsync(response); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); MobileServiceInvalidOperationException exception = null; try { TextbookItems = await TextbookTable.Where(Textbook => Textbook.publisher == GlobalVariable.loginUser).ToCollectionAsync(); JobItems = await JobTable.Where(Job => Job.publisher == GlobalVariable.loginUser).ToCollectionAsync(); RentRoomItems = await RentRoomTable.Where(RentRoom => RentRoom.publisher == GlobalVariable.loginUser).ToCollectionAsync(); SocietyItems = await SocietyTable.Where(Society => Society.publisher == GlobalVariable.loginUser).ToCollectionAsync(); PartyItems = await PartyTable.Where(Party => Party.publisher == GlobalVariable.loginUser).ToCollectionAsync(); StuffItems = await StuffTable.Where(Stuff => Stuff.publisher == GlobalVariable.loginUser).ToCollectionAsync(); SharedAudioItems = await SharedAudioTable.Where(SharedAudio => SharedAudio.provider == GlobalVariable.loginUser).ToCollectionAsync(); PostedCommentsItems = await PostedCommentsTable.Where(Comments => Comments.from == GlobalVariable.loginUser).ToCollectionAsync(); ReceivedCommentsItems = await ReceivedCommentsTable.Where(Comments => Comments.to == GlobalVariable.loginUser).ToCollectionAsync(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { int length = TextbookItems.Count(); for (int count = 0; count < length; count++) { ListTextbook.Items.Add(TextbookItems[count].bookName); } length = JobItems.Count(); for (int count = 0; count < length; count++) { ListJobs.Items.Add(JobItems[count].title); } length = RentRoomItems.Count(); for (int count = 0; count < length; count++) { ListRoom.Items.Add(RentRoomItems[count].roomTitle); } length = SocietyItems.Count(); for (int count = 0; count < length; count++) { ListClub.Items.Add(SocietyItems[count].societyName); } length = PartyItems.Count(); for (int count = 0; count < length; count++) { ListParty.Items.Add(PartyItems[count].partyTitle); } length = StuffItems.Count(); for (int count = 0; count < length; count++) { ListStuff.Items.Add(StuffItems[count].name); } length = SharedAudioItems.Count(); for (int count = 0; count < length; count++) { ListSharedRecord.Items.Add(SharedAudioItems[count].fileName); } length = ReceivedCommentsItems.Count(); for (int count = 0; count < length; count++) { ListReceivedReview.Items.Add(ReceivedCommentsItems[count].title); } length = PostedCommentsItems.Count(); for (int count = 0; count < length; count++) { ListPostedReview.Items.Add(PostedCommentsItems[count].title); } } try { // Get file list from blob container String StorageConnectionString = "DefaultEndpointsProtocol=https;AccountName=uonlife;AccountKey=LzU9gRoJgvtKtY7rIPE3w1Z7Toc39AfcBO+Y+Q4ZCYoZmXd2KTgpZ5muya6JkxaZRtNAo3ib3FTpw7gAncpOPA=="; // Retrieve storage account from connection string. CloudStorageAccount storageAccount = CloudStorageAccount.Parse(StorageConnectionString); // Create the blob client. CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); // Retrieve a reference to a container. CloudBlobContainer container = blobClient.GetContainerReference(GlobalVariable.loginUser.ToLower()); // Get file list from blob container BlobContinuationToken continuationToken = null; string prefix = null; bool useFlatBlobListing = true; BlobListingDetails blobListingDetails = BlobListingDetails.All; int maxBlobsPerRequest = 100; List <IListBlobItem> blobs = new List <IListBlobItem>(); do { var listingResult = await container.ListBlobsSegmentedAsync(prefix, useFlatBlobListing, blobListingDetails, maxBlobsPerRequest, continuationToken, null, null); continuationToken = listingResult.ContinuationToken; blobs.AddRange(listingResult.Results); }while (continuationToken != null); // Add file list to list items for (int count = 0; count < blobs.Count; count++) { string name = blobs[count].Uri.ToString().Replace( "https://uonlife.blob.core.windows.net/" + GlobalVariable.loginUser.ToLower() + "/", ""); ListPrivateRecord.Items.Add(name); } } catch (Exception ex) { await new MessageDialog(ex.Message, "Error loading items").ShowAsync(); } Ring.IsActive = false; }
private async void GetDataFromTable() { try{ attendance = await attendanceTable.ToCollectionAsync(); } catch(MobileServiceInvalidOperationException e) { MessageBox.Show(e.Message, "Database Error", MessageBoxButton.OK); } int count = attendance.Count<AttendanceRecord>(); MessageBox.Show("The Count is "+count,"Information", MessageBoxButton.OK); ListItems.ItemsSource = attendance; }