|
Again, why not ask them? They know their demo better than we will ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I already asked them but still no reply,
However what I need is to understand how to populate sql server table to build the dynamic menu no matter to devexpress or even writing the html manually
I hope you got my point
|
|
|
|
|
Your class defines the table structure required (and vice versa) so
ID - IdentityField
ISerial - int - probably defines the sort order within the parents collection
Department - self evident
ParentISerial - I think thes is wrong as it should be the ParentID field
Add the collection of children in the client.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Thanks for your reply
can you please give more clarifications ?
|
|
|
|
|
I have a utility library which mutitarget netcoreapp3.0, net472 and netstandard2.0.
I use netstandard2.0 on the phone application
Internally I have some #if statement to use DynamicMethod (i.e. code generation) on net472 and netcoreapp3.0 and reflection on netstandard2.0
Ultimately though, what I'd like to to is use netstandard2.1 and decide at runtime (as opposed to at compile time) whether to use reflection or emit based on current platform capability.
Which bring me to my question: how to I detect whether DynamicMethod / Emit is being supported by platform?
modified 19-Nov-19 19:31pm.
|
|
|
|
|
I simply added an autodetection method in the static constructor
static EmitHelper()
{
try
{
var dynam = new DynamicMethod(string.Empty, typeof(int), new Type[] { typeof(int) }, Module, true);
ILGenerator il = dynam.GetILGenerator();
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Mul);
il.Emit(OpCodes.Ret);
var sq = (Func<int, int>)dynam.CreateDelegate(typeof(Func<int, int>));
if (sq(2) == 4)
{
SupportsEmit = true;
}
}
catch { }
}
public static bool SupportsEmit { get; private set; }
Will test it tomorrow an Android!
Got my hands full enough tonight with netcoreapp3.0 port!
|
|
|
|
|
A simple, fast, thread safe Object Pool library.
GitHub[^]
|
|
|
|
|
Rather than posting information free messages that just look like spam, why not post this either as a Project: Your GitHub Project on CodeProject[^] - you will need a readme.md file in the GitHub project, and the better that is the better the chnaces of moderators approving it;
or as an Article: Submit a new Article[^] - you will need to explain how it works in order to pass moderation.
Just posting a link here? Unlikely to get you many users!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the suggestion, I with using an article format.
|
|
|
|
|
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
I have the code below for scanning all papers. It works but the problem is when all papers will finish, it shows the error:
Exception User-Unhandeled System.runtime.InterpService.COMEException: Exception From HRESULT:0*80210003
which belongs to this line:
var imgFile = (ImageFile)ScanerItem.Transfer();
Does anyone know how to fix it?
Thanks
How can i fix it? Here is the code:
bool continueScanning2 = true;
try
{
await Task.Run(() =>
{
var deviceManager = new DeviceManager();
DeviceInfo AvailableScanner = null;
while (continueScanning2)
{
for (int i = 1; i <= deviceManager.DeviceInfos.Count; i++)
{
if (deviceManager.DeviceInfos[i].Type != WiaDeviceType.ScannerDeviceType)
{
continue;
}
AvailableScanner = deviceManager.DeviceInfos[i];
break;
}
var device = AvailableScanner.Connect();
var ScanerItem = device.Items[1];
var imgFile = (ImageFile)ScanerItem.Transfer();
var data = (byte[])imgFile.FileData.get_BinaryData();
var bitmap = GetBitmapFromRawData(imgFile.Width, imgFile.Height, data);
string name2 = Guid.NewGuid().ToString().Replace("-", "") + ".jpg";
var Path = @"C:\Users\...\Desktop\test\" + name2;
pictureBox1.ImageLocation = Path;
bitmap.Save(Path, System.Drawing.Imaging.ImageFormat.Jpeg);
}
});
}
catch (COMException ex)
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
|
Thanks for the reply. yes but i don't want to see this error code after the scanning process will be finished.
i want to see this warning whenever i click on the "scan button" and there is no paper in scanner device.
|
|
|
|
|
Then you will have to probe the device first to see if there is paper loaded. The scanner can only report its current status, it is up to you to check the status at the correct time.
|
|
|
|
|
Could you please write this condition that how should i check it?
Thanks
|
|
|
|
|
What do you mean? All you need is a simple if clause.
|
|
|
|
|
i wrote a while loop to check it until the device is loaded by it's not working.
Here are my code:
try
{
object[] items = await Task.Run<object[]>(() =>
{
var deviceManager = new DeviceManager();
List<object> result = new List<object>();
for (int i = 1; i <= deviceManager.DeviceInfos.Count; i++)
{
if (deviceManager.DeviceInfos[i].Type != WiaDeviceType.ScannerDeviceType)
{
continue;
}
result.Add(deviceManager.DeviceInfos[i].Properties["Name"].get_Value());
}
return result.ToArray();
});
foreach (var item in items)
{
lstListOfScanner.Items.Add(item);
}
}
catch (COMException ex)
{
MessageBox.Show(ex.Message);
}
int n = 1;
bool continueRunning2 = true;
try
{
await Task.Run(() =>
{
var deviceManager = new DeviceManager();
DeviceInfo AvailableScanner = null;
for (int i = 1; i <= deviceManager.DeviceInfos.Count; i++)
{
if (deviceManager.DeviceInfos[i].Type != WiaDeviceType.ScannerDeviceType)
{
continue;
}
AvailableScanner = deviceManager.DeviceInfos[i];
break;
}
var device = AvailableScanner.Connect();
while (AvailableScanner != null)
{
var ScanerItem = device.Items[1];
var imgFile = (ImageFile)ScanerItem.Transfer();
var data = (byte[])imgFile.FileData.get_BinaryData();
var bitmap = GetBitmapFromRawData(imgFile.Width, imgFile.Height, data);
var Path = @"C:\Users\...\Desktop\test\" + n + ".jpg";
n++;
bitmap.Save(Path, System.Drawing.Imaging.ImageFormat.Jpeg);
}
});
}
catch (COMException ex)
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
What does "not working" mean?
|
|
|
|
|
It works still like before.
it scanns all pages and when they finished, it shows me the error of loading paper
|
|
|
|
|
Yes, because the scanner is telling you that there is no more paper in the feeder. Why do you think this is an error?
|
|
|
|
|
Becuase i need it to works like it:
1) if there is no paper on the device and i click on "Scan" button, it shows me the warnning that i should load paper
but
2) if the scanner was already loaded, and i click on "Scan" button, it starts to scan all pages and at the end nothing happens! (or i added a meesagebox("Finish") but not this warning)
|
|
|
|
|
When you catch the exception check to see which error code has been returned. If it is "No paper loaded" then post a message and try again.
|
|
|
|
|
if i write the code below, it shows me the message box when ever the device is empty!
catch (COMException ex)
{
uint errorCode = (uint)ex.ErrorCode;
if (errorCode == 0x80210003)
{
MessageBox.Show("Load the scaner device!");
}
else
{
MessageBox.Show(ex.Message);
}
but i do NOT want to see this message when the scan proccess will be finished.
(i want to see nothing when all papers scanned. just see a message if at the beginning i click and the device was empty)
Could you pls correct it?
|
|
|
|
|
How does the application know that all the pages have been scanned?
|
|
|
|