当前位置: 首页>>代码示例>>C#>>正文


C# MobileServiceCollection.First方法代码示例

本文整理汇总了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();
            }


        }
开发者ID:carlosmhw,项目名称:Centauro,代码行数:47,代码来源:MainPage.xaml.cs

示例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;

            }
        }
开发者ID:carlosmhw,项目名称:Centauro,代码行数:82,代码来源:HistorialFallas.xaml.cs

示例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;
            }
        }
开发者ID:carlosmhw,项目名称:Centauro,代码行数:39,代码来源:HistorialFallas.xaml.cs

示例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;
        }
开发者ID:djaus2,项目名称:iotAzureSensors,代码行数:33,代码来源:MainPage_AzureMobileService.cs


注:本文中的MobileServiceCollection.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。