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


C# Service1Client.SubmitDataAsync方法代码示例

本文整理汇总了C#中Service1Client.SubmitDataAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Service1Client.SubmitDataAsync方法的具体用法?C# Service1Client.SubmitDataAsync怎么用?C# Service1Client.SubmitDataAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service1Client的用法示例。


在下文中一共展示了Service1Client.SubmitDataAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: uploadButton_Click

        void uploadButton_Click(object sender, RoutedEventArgs e)
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                displayPopup(popupTitle2, popupContent1);
                return;
            }
            var uploadButton = DynamicPanel.Children.OfType<Button>().First() as Button;
            uploadButton.IsEnabled = false;
           
           SubmissionProgressBar.IsIndeterminate = true;
            String filename = App.toBeSubmit[App.currentSubmissionIndex].ImageName + ".jpg";
            WriteableBitmap image = new WriteableBitmap(2560, 1920);
            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("MyScience/Images/" + filename, FileMode.Open, FileAccess.Read))
                {
                    image.SetSource(fileStream);
                }
            }
            MemoryStream ms = new MemoryStream();
            image.SaveJpeg(ms, image.PixelWidth, image.PixelHeight, 0, 100);
            byte[] imageData = ms.ToArray();
            App.toBeSubmit[App.currentSubmissionIndex].ImageData = imageData;

            //Low Res Pic submission 
            MemoryStream lowresms = new MemoryStream();
            image.SaveJpeg(lowresms, 80, 60, 0, 80);
            byte[] lowResImageData = lowresms.ToArray();
            App.toBeSubmit[App.currentSubmissionIndex].LowResImageData = lowResImageData;

            Service1Client client = new Service1Client();
            client.SubmitDataCompleted += new EventHandler<SubmitDataCompletedEventArgs>(client_SubmitDataCompleted);
            client.SubmitDataAsync(App.toBeSubmit[App.currentSubmissionIndex]);
        }
开发者ID:MikeOrtiz,项目名称:dynovader,代码行数:35,代码来源:SubmissionPage.xaml.cs

示例2: newButton_Click

        void newButton_Click(object sender, RoutedEventArgs e)
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                displayPopup(popupTitle2, popupContent1);
                return;
            }
            submissionStatMsg.Text = "Submitting...";
            progressbar.IsIndeterminate = true;
            progressbar.Visibility = System.Windows.Visibility.Visible;

            var takePhotoButton = DynamicPanel.Children.OfType<Button>().First() as Button;
            var choosePhotoButton = DynamicPanel.Children.OfType<Button>().ElementAt(1) as Button;
            var saveButton = DynamicPanel.Children.OfType<Button>().ElementAt(2) as Button;
            var submitButton = DynamicPanel.Children.OfType<Button>().ElementAt(3) as Button;

            takePhotoButton.IsEnabled = false;
            choosePhotoButton.IsEnabled = false;
            saveButton.IsEnabled = false;
            submitButton.IsEnabled = false;
            Submission newsubmission = getSubmission();
            if(newsubmission != null) {
                Image photo = DynamicPanel.Children.OfType<Image>().First() as Image;
                WriteableBitmap image = (WriteableBitmap)photo.Source;
                MemoryStream ms = new MemoryStream();
                image.SaveJpeg(ms, image.PixelWidth, image.PixelHeight, 0, 100);
                byte[] imageData = ms.ToArray();
                newsubmission.ImageData = imageData;

                //Low Res Pic submission   comment for now
                MemoryStream lowresms = new MemoryStream();
                image.SaveJpeg(lowresms, 80, 60, 0, 80);
                byte[] lowResImageData = lowresms.ToArray();
                newsubmission.LowResImageData = lowResImageData;

                Service1Client client = new Service1Client();
                client.SubmitDataCompleted += new EventHandler<SubmitDataCompletedEventArgs>(client_SubmitDataCompleted);
                client.SubmitDataAsync(newsubmission);
            }
            else
            {
                takePhotoButton.IsEnabled = true;
                choosePhotoButton.IsEnabled = true;
                saveButton.IsEnabled = true;
                submitButton.IsEnabled = true;
                TextBlock message = new TextBlock();
                //displayPopup(popupTitle1, popupContent3);
                submissionStatMsg.Text = "Oops, forgot to submit a pic!\n";
                progressbar.IsIndeterminate = false;
                progressbar.Visibility = System.Windows.Visibility.Visible;
            }
        } 
开发者ID:MikeOrtiz,项目名称:dynovader,代码行数:52,代码来源:DetailsPage.xaml.cs


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