本文整理汇总了C#中CameraCaptureTask.Show方法的典型用法代码示例。如果您正苦于以下问题:C# CameraCaptureTask.Show方法的具体用法?C# CameraCaptureTask.Show怎么用?C# CameraCaptureTask.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CameraCaptureTask
的用法示例。
在下文中一共展示了CameraCaptureTask.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewImageVM
public NewImageVM(IMessageBus Messenger,
IStoreImages ImageStore) {
Messenger.Listen<IElementVM<MultimediaObject>>(MessageContracts.EDIT)
.Where(vm => vm.Model.MediaType == MediaType.Image && vm.Model.IsNew())
.SelectMany(mmo => {
var capture = new CameraCaptureTask();
var results =
Observable.FromEventPattern<PhotoResult>(h => capture.Completed += h, h => capture.Completed -= h)
.Select(ev => ev.EventArgs)
.Catch(Observable.Empty<PhotoResult>())
.Select(res => new { VM = mmo, Result = res })
.Take(1)
.Replay(1);
results.Connect();
try {
capture.Show();
}
catch (InvalidOperationException) {
}
return results;
})
.Where(tuple => tuple.VM != null
&& tuple.Result != null
&& tuple.Result.TaskResult == TaskResult.OK)
.Do(tuple => {
tuple.VM.Model.Uri = ImageStore.StoreImage(tuple.VM.Model.NewFileName(), tuple.Result);
})
.Select(t => t.VM as IElementVM<MultimediaObject>)
.ToMessage(Messenger, MessageContracts.SAVE);
}
示例2: BtnTakePictureClick
private void BtnTakePictureClick(object sender, RoutedEventArgs e)
{
var captureTask = new CameraCaptureTask();
_geoLocationManager.RetrieveCurrentLocation();
captureTask.Completed += (s, a) =>
{
try
{
if (a.Error == null && a.TaskResult == TaskResult.OK && a.ChosenPhoto != null)
{
var photo = new Photo
{
Latitude = _geoLocationManager.Latitude,
Longitude = _geoLocationManager.Longitude
};
var bytes = new byte[a.ChosenPhoto.Length];
a.ChosenPhoto.Read(bytes, 0, bytes.Length);
a.ChosenPhoto.Close();
photo.ImageBytes = bytes;
_persistenceManager.Add(photo);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
};
captureTask.Show();
}
示例3: StartLoop
public static void StartLoop()
{
CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);
cameraCaptureTask.Show();
}
示例4: captureImage
/// <summary>
/// Launches default camera application to capture image
/// </summary>
/// <param name="options">may contains limit or mode parameters</param>
public void captureImage(string options)
{
try
{
try
{
this.captureImageOptions = String.IsNullOrEmpty(options) ?
CaptureImageOptions.Default : JSON.JsonHelper.Deserialize<CaptureImageOptions>(options);
}
catch (Exception ex)
{
this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
return;
}
cameraTask = new CameraCaptureTask();
cameraTask.Completed += this.cameraTask_Completed;
cameraTask.Show();
}
catch (Exception e)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
}
}
示例5: GetCaptureImageA
private void GetCaptureImageA(object obj)
{
CameraCaptureTask camera = new CameraCaptureTask();
camera.Show();
camera.Completed += new EventHandler<PhotoResult>(camera_a);
}
示例6: CameraButtonClick
private void CameraButtonClick(object sender,
RoutedEventArgs e)
{
CameraCaptureTask camera = new CameraCaptureTask();
camera.Completed += new EventHandler
<PhotoResult>(camera_Result);
camera.Show();
}
示例7: PlayCreate_Click
private void PlayCreate_Click(object sender, RoutedEventArgs e)
{
//Create new instance of CameraCaptureClass
ctask = new CameraCaptureTask();
//Create new event handler for capturing a photo
ctask.Completed += new EventHandler<PhotoResult>(ctask_Completed);
ctask.Show();
}
示例8: btnCapPhoto_Click
private void btnCapPhoto_Click(object sender, EventArgs e)
{
imageFileName = string.Empty;
imageStream = null;
cameraCapture = new CameraCaptureTask();
cameraCapture.Completed += new EventHandler<PhotoResult>(cameracapture_Completed);
cameraCapture.Show();
}
示例9: btnCamera_Click
private void btnCamera_Click(object sender, RoutedEventArgs e)
{
lock (this)
{
CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed -= Task_Completed;
cameraCaptureTask.Completed += Task_Completed;
cameraCaptureTask.Show();
isGaleryCameraOpen = true;
}
}
示例10: TakePictureAsync
public Task<CameraResult> TakePictureAsync()
{
CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += CameraCaptureTaskOnCompleted;
cameraCaptureTask.Show();
tcs = new TaskCompletionSource<CameraResult>();
return tcs.Task;
}
示例11: LaunchCameraCapture
private void LaunchCameraCapture(object sender, RoutedEventArgs e)
{
var cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += CameraCaptureTaskCompleted;
try
{
cameraCaptureTask.Show();
}
catch (System.InvalidOperationException ex)
{
MessageBox.Show("An error occurred.");
}
}
示例12: btnCapturePhoto_Click
private void btnCapturePhoto_Click(object sender, RoutedEventArgs e)
{
CameraCaptureTask cTask = new CameraCaptureTask();
cTask.Completed += (s, evt) =>
{
if (evt.Error == null && evt.TaskResult == TaskResult.OK)
{
//BitmapImage bmpImage = new BitmapImage();
//bmpImage.SetSource(evt.ChosenPhoto);
//image.Source = bmpImage;
}
};
cTask.Show();
}
示例13: GetCaptureImageB
private void GetCaptureImageB(object obj)
{
if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButton.OKCancel) == MessageBoxResult.Yes)
{
// If yes
CameraCaptureTask camera = new CameraCaptureTask();
camera.Show();
camera.Completed += new EventHandler<PhotoResult>(camera_b);
}
else
{
// If no
}
}
示例14: CaptureAsync
public Task<Stream> CaptureAsync()
{
var cameraCompletionTask = new TaskCompletionSource<Stream>();
var cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += (s, e) =>
{
if (e.Error != null)
{
cameraCompletionTask.SetException(e.Error);
}
cameraCompletionTask.SetResult(e.ChosenPhoto);
};
Task.Run(() => cameraCaptureTask.Show());
return cameraCompletionTask.Task;
}
示例15: MainPage
public MainPage ()
{
InitializeComponent ();
SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
global::Xamarin.Forms.Forms.Init ();
LoadApplication(new ContosoMoments.App ());
ContosoMoments.App.Instance.ShouldTakePicture += () => {
CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += CameraCaptureTaskOnCompleted;
cameraCaptureTask.Show();
};
}