private static async Task BasicDataOperationsAsync(CloudTable table, List <DataSourceColumnList> dataSourceColumnList)
        {
            // Create an instance of a customer entity. See the Model\CustomerEntity.cs for a description of the entity.
            DataSourceColumnList customer;
            string partitionKey = (dataSourceColumnList[0].FileName == null ? dataSourceColumnList[0].TableName : dataSourceColumnList[0].FileName) + "_" + (dataSourceColumnList[1].FileName == null ? dataSourceColumnList[1].TableName : dataSourceColumnList[1].FileName);

            foreach (var item in dataSourceColumnList)
            {
                item.PartitionKey = partitionKey;
                item.RowKey       = item.Source;
                // Demonstrate how to insert the entity
                Console.WriteLine("Insert an Entity.");
                await SamplesUtils.InsertOrMergeEntityAsync(table, item);
            }

            // Demonstrate how to Update the entity by changing the phone number
            Console.WriteLine("Update an existing Entity using the InsertOrMerge Upsert Operation.");

            //await SamplesUtils.InsertOrMergeEntityAsync(table, customer);
            Console.WriteLine();

            // Demonstrate how to Read the updated entity using a point query
            Console.WriteLine("Reading the updated Entity.");
            customer = await SamplesUtils.RetrieveEntityUsingPointQueryAsync(table, partitionKey, "DataSource1");

            Console.WriteLine();

            // Demonstrate how to Delete an entity
            //Console.WriteLine("Delete the entity. ");
            //await SamplesUtils.DeleteEntityAsync(table, customer);
            //Console.WriteLine();
        }
示例#2
0
        private void SetTranscodeParameters()
        {
            IVideoFormat videoFormat = Preview.VideoFormat;
            IAudioFormat audioFormat = Preview.AudioFormat;

            mediaComposer.addSourceFile(new File(Preview.File));

            ComboBoxItem framerateItem = (ComboBoxItem)FramerateSelect.SelectedItem;
            String       videoProfile  = ((ComboBoxItem)ProfileSelect.SelectedItem).Content.ToString();

            var match = Regex.Match(videoProfile, @"\(([0-9]+)x([0-9]+)\)");

            uint width     = uint.Parse(match.Groups[1].Value);
            uint height    = uint.Parse(match.Groups[2].Value);
            uint framerate = uint.Parse(framerateItem.Content.ToString());
            uint bitrate   = (uint)(BitrateSelect.Value * 1000);

            if (videoFormat != null)
            {
                var vFormat = new WinRtVideoFormat(videoMimeType, width, height)
                {
                    bitrate = bitrate
                };

                vFormat.frameRate.Numerator   = framerate;
                vFormat.frameRate.Denominator = 1;

                mediaComposer.setTargetVideoFormat(vFormat);
            }

            if (audioFormat != null)
            {
                var aFormat = new WinRtAudioFormat(audioMimeType)
                {
                    bitrate       = audioFormat.bitrate,
                    bitsPerSample = audioFormat.bitsPerSample,
                    channelCount  = audioFormat.channelCount,
                    sampleRate    = audioFormat.sampleRate
                };

                mediaComposer.setTargetAudioFormat(aFormat);
            }

            for (int i = 0; i < EffectsMenu.Items.Count; ++i)
            {
                ToggleMenuFlyoutItem item = (ToggleMenuFlyoutItem)EffectsMenu.Items[i];

                if (item.IsChecked)
                {
                    mediaComposer.addVideoEffect(SamplesUtils.GetVideoEffectByName(item.Text));
                }
            }
        }
        private async void OnEffectClicked(object sender, RoutedEventArgs e)
        {
            ToggleMenuFlyoutItem checkedItem = (ToggleMenuFlyoutItem)sender;

            for (int i = 0; i < EffectsMenu.Items.Count; ++i)
            {
                ToggleMenuFlyoutItem item = (ToggleMenuFlyoutItem)EffectsMenu.Items[i];

                if (checkedItem != item)
                {
                    item.IsChecked = false;
                }
            }

            if (checkedItem.IsChecked)
            {
                await preview.setActiveEffect(SamplesUtils.GetVideoEffectByName(checkedItem.Text));
            }
            else
            {
                await preview.setActiveEffect(null);
            }
        }