本文整理汇总了C#中MobileServiceCollection.Count方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceCollection.Count方法的具体用法?C# MobileServiceCollection.Count怎么用?C# MobileServiceCollection.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MobileServiceCollection
的用法示例。
在下文中一共展示了MobileServiceCollection.Count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetData
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));
}
}
}
示例2: SendCompletionMessageForLocations
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);
}
示例3: comboBoxidTecnico_SelectionChanged
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;
}
}
示例4: checkBox_Checked
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;
}
}
示例5: RefreshTelemetryItemValue
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;
}
示例6: comboBox_SelectionChanged
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();
}
}
示例7: GetDataFromTable
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;
}