本文整理汇总了C#中MobileServiceCollection.First方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceCollection.First方法的具体用法?C# MobileServiceCollection.First怎么用?C# MobileServiceCollection.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MobileServiceCollection
的用法示例。
在下文中一共展示了MobileServiceCollection.First方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button_Click
private async void button_Click(object sender, RoutedEventArgs e)
{
try
{
ProgressBarBefore();
usuarios = await UsuarioTable
.Select(Usuarios => Usuarios)
.Where(Usuarios => Usuarios.id == textBoxUser.Text && Usuarios.contrasena == passwordBox.Password.ToString())
.ToCollectionAsync();
ProgressBarAfter();
if(usuarios.Count >= 1)
{
var rsUsuario = usuarios.First();
if(rsUsuario.Tipo == "Tecnico")
{
Frame.Navigate(typeof(Administrador), "Tecnico");
}
else
{
Frame.Navigate(typeof(Administrador), "Administrador");
}
}
else
{
MessageDialog mensaje = new MessageDialog("Usuario o contraseña incorrectos.", "Credenciales invalidas");
await mensaje.ShowAsync();
}
}
catch (MobileServiceInvalidOperationException ex)
{
exception = ex;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error!").ShowAsync();
}
}
示例2: 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;
}
}
示例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: 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;
}