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


C# MobileServiceCollection.Count方法代码示例

本文整理汇总了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));
                }
            }
        }
开发者ID:rashoodkhan,项目名称:attendance-student-client,代码行数:27,代码来源:StartPage.xaml.cs

示例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);
        }
开发者ID:nicol3ta,项目名称:alterna,代码行数:83,代码来源:AlternaService.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: 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

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

示例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();
            }

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

示例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;
        }
开发者ID:rashoodkhan,项目名称:attendance-student-client,代码行数:14,代码来源:MainPage.xaml.cs


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