本文整理汇总了C#中PhotoChooserTask类的典型用法代码示例。如果您正苦于以下问题:C# PhotoChooserTask类的具体用法?C# PhotoChooserTask怎么用?C# PhotoChooserTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhotoChooserTask类属于命名空间,在下文中一共展示了PhotoChooserTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, RoutedEventArgs e)
{
image1.Source = null;
PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooseCall);
objPhotoChooser.Show();
}
示例2: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (pixelatedImage.Source == null && e.IsNavigationInitiator)
{
var task = new PhotoChooserTask();
task.Completed += OnPhotoChooserTaskCompleted;
task.ShowCamera = true;
task.Show();
}
if (pixelationListBox.Items.Count == 0)
{
pixelationListBox.Items.Add(3);
pixelationListBox.Items.Add(4);
pixelationListBox.Items.Add(5);
pixelationListBox.Items.Add(6);
pixelationListBox.Items.Add(7);
pixelationListBox.Items.Add(8);
pixelationListBox.Items.Add(9);
pixelationListBox.Items.Add(10);
}
var pixelateSize = new PixelationSizeQuery().Get();
pixelationListBox.SelectedItem = pixelateSize; // TODO: don't work
pixelationListBox.SelectionChanged += OnPixelationListBoxSelectionChanged;
_pixelator = new Pixelator(pixelateSize, false);
sliderDebug.ValueChanged += OnSliderDebugValueChanged;
}
示例3: PickPhoto
public Task<byte[]> PickPhoto()
{
var taskCompletionSource = new TaskCompletionSource<byte[]>();
var task = new PhotoChooserTask();
task.ShowCamera = false;
task.PixelWidth = 300;
task.PixelHeight = 300;
task.Completed += (s, e) =>
{
if (e.TaskResult == TaskResult.OK && e.ChosenPhoto != null)
{
using (var ms = new MemoryStream())
{
e.ChosenPhoto.CopyTo(ms);
ms.Position = 0;
taskCompletionSource.TrySetResult(ms.ToArray());
}
}
else
{
taskCompletionSource.TrySetResult(null);
}
};
task.Show();
return taskCompletionSource.Task;
}
示例4: MovieDetailsPage
public MovieDetailsPage()
{
InitializeComponent();
photoTask = new PhotoChooserTask();
photoTask.Completed += new EventHandler<PhotoResult>(photoTask_Completed);
}
示例5: MainPage
// Constructor
public MainPage()
{
InitializeComponent();
library = new MediaLibrary();
photoChooser = new PhotoChooserTask();
photoChooser.Completed += photoChooser_Completed;
}
示例6: OnSendImage
private void OnSendImage(object sender, RoutedEventArgs e)
{
var task = new PhotoChooserTask();
task.ShowCamera = true;
task.Completed += async (s, r) =>
{
if (r.TaskResult == TaskResult.OK)
{
try
{
var request = new HttpPostRequest("http://yourdomain.com/Upload");
request.ContentType = "multipart/form-data";
request.Data.Add("vve", "VvE Naam");
request.Files.Add(new HttpPostFile("image", "image", r.ChosenPhoto));
//// TODO: Add pr
var response = await Http.PostAsync(request);
MessageBox.Show(response.Response);
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
};
task.Show();
}
示例7: Foto
public Foto()
{
InitializeComponent();
photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
}
示例8: btnLibrary_Tapped
private void btnLibrary_Tapped(object sender, System.Windows.Input.GestureEventArgs e)
{
PhotoChooserTask photo = new PhotoChooserTask();
photo.Completed += photo_Completed;
photo.ShowCamera = true;
photo.Show();
}
示例9: photo_Click
private void photo_Click(object sender, RoutedEventArgs e)
{
PhotoChooserTask ptsk = new PhotoChooserTask();
ptsk.ShowCamera = true;
ptsk.Show();
ptsk.Completed += new EventHandler<PhotoResult>(ptsk_Completed);
}
示例10: upload_Click
private void upload_Click(object sender, EventArgs e)
{
PhotoChooserTask pct = new PhotoChooserTask();
pct.ShowCamera = true;
pct.Completed += pct_Completed;
pct.Show();
}
示例11: btn_Camera_ManipulationCompleted
private void btn_Camera_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
PhotoChooserTask pcTask = new PhotoChooserTask();
pcTask.ShowCamera = true;
pcTask.Completed += new EventHandler<PhotoResult>(pcTask_Completed);
pcTask.Show();
}
示例12: GetImageFromGallery
private void GetImageFromGallery(object obj)
{
PhotoChooserTask photoChooserTask = new PhotoChooserTask();
photoChooserTask.Show();
photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
}
示例13: LibraryButtonClick
private void LibraryButtonClick(object sender, EventArgs e)
{
var task = new PhotoChooserTask();
task.Completed += OnPhotoChooserTaskCompleted;
task.ShowCamera = true;
task.Show();
}
示例14: Setting
public Setting()
{
InitializeComponent();
photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += photoChooserTask_Completed;
photoChooserTask.ShowCamera = true;
viewModel = this.DataContext as SettingViewModel;
// Get the full collection of items:
//List<CountdownType> allTypes = TypePicker.ItemsSource as List<CountdownType>;
//int id;
//if (viewModel.SelectedCountdownType.Name == "Countdown")
// id = 0;
//else
// id = 1;
//TypePicker.SelectedItems = new ObservableCollection<object>() {
// allTypes[id]
//};
//unitListPicker.SummaryForSelectedItemsDelegate = ViewModelLocator.SummerizeSelection;
//unitListPicker.SelectionChanged += ViewModelLocator.UnitSelectionFilter;
//TypePicker.SummaryForSelectedItemsDelegate = SummarizeTypes;
}
示例15: MainPage
// Konstruktor
public MainPage()
{
InitializeComponent();
// prepare Photo Chooser Task for the open button
photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += (s, e) => { if (e.TaskResult == TaskResult.OK) ProcessImage(e); };
// prepare the backround worker thread for the image processing
scannerWorker = new BackgroundWorker();
scannerWorker.DoWork += scannerWorker_DoWork;
scannerWorker.RunWorkerCompleted += scannerWorker_RunWorkerCompleted;
foreach (var x in typeof(BarcodeFormat).GetFields())
{
if (x.IsLiteral)
{
BarcodeType.Items.Add(x.GetValue(null));
}
}
// open the default barcode which should be displayed when the app starts
var uri = new Uri("/images/35.png", UriKind.Relative);
var imgSource = new BitmapImage(uri);
BarcodeImage.Source = imgSource;
imgSource.ImageOpened += (s, e) => scannerWorker.RunWorkerAsync(new WriteableBitmap((BitmapImage)s));
}