I am trying to show a content dialog while PrintManager is being shown. I tried the following code, but the window is shown behind PrintManager and is only accessible after PrintManager is closed.
Here is the Code:
Await printDocument.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, Async Sub()
If dlgPrint Is Nothing Then dlgPrint = New dlgPrint
dlgPrint.value = sender.Options("CustomSize").Value
dlgPrint.pictures = NumberOfPhotos
Dim a As IAsyncOperation(Of ContentDialogResult) = dlgPrint.ShowAsync
dlgPrint.Focus(FocusState.Programmatic)
Dim res As ContentDialogResult = Await (a)
If res = ContentDialogResult.Secondary Then
sender.Options("CustomSize").TrySetValue(dlgPrint.value)
End If
End Sub)
Related
I have an Angular application that downloads a file to open in a new tab. It works perfectly on any plateform except on IOS where nothing happens. I make the call in the subscribe because during the download I display a spinner before opening the document on a new tab
this.myservice.dowloadFile(id).subscribe((res) =>
{
let blob = new Blob([file], {type: "application/pdf"});
const url = window.URL.createObjectURL(blob);
let anchor = document.createElement("a");
anchor.href = url;
anchor.target = '_blank';
anchor.click();
this.loadData = false;
});
}
I don't understand the problem.
I'm trying to add barcode scanner feature to my xamarin.ios app. I'm developing from visual studio and I've added the Zxing.Net.Mobile component from xamarin components store.
I've implemented it as shown in the samples:
ScanButton.TouchUpInside += async (sender, e) => {
//var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
//options.AutoRotate = false;
//options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
// ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13
//};
var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);
//scanner.TopText = "Hold camera up to barcode to scan";
//scanner.BottomText = "Barcode will automatically scan";
//scanner.UseCustomOverlay = false;
scanner.FlashButtonText = "Flash";
scanner.CancelButtonText = "Cancel";
scanner.Torch(true);
scanner.AutoFocus();
var result = await scanner.Scan(true);
HandleScanResult(result);
};
void HandleScanResult(ZXing.Result result)
{
if (result != null && !string.IsNullOrEmpty(result.Text))
TextField.Text = result.Text;
}
The problem is that when I tap the scan button, the capture view is shown correctly but if I try to capture a barcode nothing happens and it seems the scanner doesn't recognize any barcode.
Someone has experienced this issue? How can I made it work?
Thanks in advance for your help!
I answered a similar question here. I couldn't get barcodes to scan because the default camera resolution was set too low. The specific implementation for this case would be:
ScanButton.TouchUpInside += async (sender, e) => {
var options = new ZXing.Mobile.MobileBarcodeScanningOptions {
CameraResolutionSelector = HandleCameraResolutionSelectorDelegate
};
var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);
.
.
.
scanner.AutoFocus();
//call scan with options created above
var result = await scanner.Scan(options, true);
HandleScanResult(result);
};
And then the definition for HandleCameraResolutionSelectorDelegate:
CameraResolution HandleCameraResolutionSelectorDelegate(List<CameraResolution> availableResolutions)
{
//Don't know if this will ever be null or empty
if (availableResolutions == null || availableResolutions.Count < 1)
return new CameraResolution () { Width = 800, Height = 600 };
//Debugging revealed that the last element in the list
//expresses the highest resolution. This could probably be more thorough.
return availableResolutions [availableResolutions.Count - 1];
}
How we can show "No Data Available" message in RDLC Reports via Resources files if no data is found. Currently we are reflecting message from NoRowsMessage property for a table, matrix, or list
(https://technet.microsoft.com/en-us/library/cc645968.aspx).
But we want to show it via Resource files and C# code rather then setting it from Properties of Table. Can anyone please assist. The code (Page_Load) of our control page (.ascx)is mentioned below:
private void Page_Load(object sender, EventArgs e)
{
var presenter = (ReportPresenter)Model;
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.Visible = true;
var rdlcPath = "~/ReportsRDLC/EmployeeData.rdlc";
if(presenter.ReportFilter.GroupOption == Resources.Date)
{
rdlcPath = "~/ReportsRDLC/EmployeeDatebyDate.rdlc";
}
groupOption.SelectedValue = presenter.ReportFilter.GroupOption;
const string DataSetName = "EmployeeDataSet";
reportViewer.LocalReport.ReportPath = HttpContext.Current.Server.MapPath(rdlcPath);
var dataSource = new ReportDataSource(DataSetName, presenter.EmployeeDetails);
reportViewer.AsyncRendering = false;
reportViewer.SizeToReportContent = true;
reportViewer.ShowPrintButton = false;
reportViewer.ShowRefreshButton = false;
reportViewer.ShowToolBar = true;
reportViewer.Height = 600;
reportViewer.Width = 400;
reportViewer.ShowPageNavigationControls = false;
reportViewer.ShowFindControls = false;
reportViewer.ShowZoomControl = false;
reportViewer.LocalReport.DataSources.Add(dataSource);
}
Perhaps you could send the message as a parameter.
You can tell if the report will be empty depending if presenter.EmployeeDetails is empty.
ReportParameter[] myParameters = new ReportParameter[1];
myParameters[0] = new ReportParameter("pEmptyMessage", presenter.EmployeeDetails.Any() ? "No Data Available" : string.Empty);
reportViewer.LocalReport.SetParameters(myParameters);
On your report you can then display this message as you please, using the parameter. You can even place it in a textbox and decide whether to display it based on the value.
I hope this is of use to you.
Edit: I forgot to mention that you should add the report parameter with the correct name to your reporter:
In the reporter you can then use the parameter as followed : [#pEmptyMessage]
=Parameters!pEmptyMessage.Value
I am using the following code to post data to my api controller
var form = document.createElement('form');
form.action = '/api/reportsapi/exportToCsv';
form.method = 'POST';
form.style.display = 'none';
for (i in data) {
if (data[i] != "") {
var inputElement = document.createElement('textarea');
inputElement.name = i;
inputElement.value = data[i];
form.appendChild(inputElement);
}
}
document.body.appendChild(form);
form.submit();
and my api controller returns a HttpResponseMessage
var csvValidRequestResult = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(csvReport.Data) };
csvValidRequestResult.Content.Headers.ContentType = new MediaTypeHeaderValue("text/comma-separated-values");
csvValidRequestResult.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = csvReport.FileName };
return csvValidRequestResult;
all this works fine. A file with data is downloaded when the above scripts hits the controller.
But the problem arises if there is any server side exception, in that case the page gets redirected to the the form's api url.
Is there something I can do to get to know of the error and act accordingly on the client side ?
Hi ive created a actionresult procedure for a create event for the kendo scheduler, everything works find in c# but having a problem when i convert it to VB. here is my code
Public Function Tasks_Create(<DataSourceRequest> request As DataSourceRequest, task As TaskViewModel) As ActionResult
If ModelState.IsValid Then
Using sampleDB = New MerchantEntities()
'Create a new Task entity and set its properties from the posted TaskViewModel
Dim MyEntity = New Task() With { _
.TaskID = task.TaskID, _
.Start = task.Start, _
.End = task.End, _
.Title = task.Title, _
.Description = task.Description, _
.OwnerID = task.OwnerID, _
.IsAllDay = task.IsAllDay, _
.RecurrenceID = task.RecurrenceID, _
.RecurrenceException = task.RecurrenceException, _
.StartTimeZone = task.StartTimezone, _
.EndTimeZone = task.EndTimezone _
}
sampleDB.Tasks.Add(MyEntity)
sampleDB.SaveChanges()
task.TaskID = MyEntity.TaskID
End Using
End If
Return Json(New () {task}.ToDataSourceResult(request, ModelState))
End Function
My problem lies in the return. im not sure what to return back. the error is at the "New ()" of the return which VS keeps telling me "Type Expected" i've tried many things but can't seem to get it right. Can anyone see what im doing wrong?? Thank you
the only thing that needs to be done is to remove the new () in the return and everything works fine.