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