|
This may sound silly, but if what you want is just a single image, why write a program to do it? Why not play the video on your PC, count to three, then press the PrintScreen key. After that, use an image processing tool, e.g. MS-Paint, and paste the image in it.
|
|
|
|
|
You go frame-by-frame; using the frame rate to calculate "time in".
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hello ! ^^
I'm desperately trying to recover the image to the third second of a video, in MP4 format as Bitmap.
I need this to analyze the image and get some information from it.
Thank you for the person who will take the time to answer me and guide me.
Code for the moment :
foreach (string file in filePaths)
{
}
|
|
|
|
|
How to connect the device with the C # language
|
|
|
|
|
We can't answer that.
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. So we have no idea what kind of device you are talking about, how it physically connects to the computer, or anything else about it.
That's like asking "how do I get to Mike's house?" without specifying the which country "Mike" lives in, much less what his full name might be!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Ah! So you have the Machine That Goes Ping[^]!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ni!
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
my first thought also.
|
|
|
|
|
Neeeow...wum...ping!
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Impossible to answer. You haven't specified what the "device" is, so it's impossible for ANYONE to tell you how to "connect it with C#". You've left out every possible detail you could to describe the problem.
Asking questions is a skill[^] that you seriously need to work on.
|
|
|
|
|
Member 14901982 wrote: How to connect the device with the C # language As specified in the documentation; if you want to write a device-driver, then the answer is no.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Have you tried switching it off and on again?
|
|
|
|
|
I created a UserControl with 5 buttons: New, Edit, Delete, Save, Cancel. All buttons have functions associated to them, programable by the user. Normally the 3 first buttons are enabled and the 2 other are disabled. When the user clicks on New or Edit, the 3 first buttons become disabled and the 2 others, enabled. When the user clicks on Save, or Cancel, it returns to the original state. It's working fine, but there is an issue.
In an application, when the user clicks on the Save button, the program must first verify if the fields are all filled. If yes, OK. But if not, the function should do nothing. So, what I need is a way of, in the main program, test the fields and pass this information to the control. But I don't know how. I tried to create a funtion in the control type virtual and in the main program I tried to create the same function with override, but it didn't work. Can anyone help me?
Thanks.
Ismael
|
|
|
|
|
Create a public event inside the control that gets raised when the user clicks the Save button. And make the event handler take the fields that must be verified.
Then the event handler inside the main program can return true or false, which will tell the event whether it should proceed with saving the information.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi, Richard.
In my control I have these events:
public event EventHandler ClickNovo;
public event EventHandler ClickEditar;
public event EventHandler ClickApagar;
public event EventHandler ClickSalvar;
public event EventHandler ClickCancelar;
Do you sugest that I create another event? Could you give me an example?
Thanks.
|
|
|
|
|
Some of this depends on your architecture, and whether it's Windows Forms or WPF / UWP; each use different patterns for validation.
If you only check validity on "save", you're doing "record-level" validation (easy) versus field-level validation (harder, due to cross-referencing and handling focus).
The "easy" way is to use a "data object" as the "view model" / transport between the "view" (form / window) and the "model" (data access layer / repository). This data object is used to pass data to the user control (to initialize the view / form / window) and to retrieve the "record" from the UC to be saved (add or update).
You may bind to the view model directly or copy the view data to it when saving. You then validate the data object and display the first error or save. If you have different "validation routines", you can pass a delegate (at initialize / load time) to the user control that accepts the data object and returns a status / error (if it's not feasible to have actually validation code in the user control.)
In the save "click" event, disable save (to avoid re-entrancy), copy the view / UC data to the view model (if not binding directly), validate, then save if OK or return an error. Reset buttons accordingly.
This pattern works for "Add" and "Update".
Deletes usually require some thinking about what to "display" after a delete and any further operations (like "add back in" or revert).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi, Gerry.
My idea was to create a validation function in the main program and when the user clicks on the Save buttons, before anything it calls that validation function. Do you know how to do this?
Thanks.
|
|
|
|
|
"Save" is form-level function; primitive controls and UC's are bit players to the form. In the Save / button event (on the form), retrieve the "data object" (view model) which consolidates all the UI / form's input, validate it, then save the contents or display an error.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
When reading this discussion my actual question is :
why a UserControl ? For me a UC is an object which is used more than one time (in a different context).
Basicly (so my opinion) we have a Data-Input object (Form) - so when I see it in OOP-context the question (for me) must be : which is my main-object and which are the sub-objects with which functionality ?
This is also (or primary) a reply to the OP ...
|
|
|
|
|
Ralf.
I'm developing a system with many forms and many of them use these buttons. And these forms have different fields in different amouunts.
|
|
|
|
|
Without seeing his "form", I can make few assumptions about the merits of his architecture.
I have a "user control" that presents "books", complete with tables of contents, incremental searching, etc. This UC itself contains more UC's: virtual keyboard controls (single and split), content sizing sliders, navigators, etc.
I'm trying to describe, in general terms, my "model" for "model <-> view"; UC's are fat controls.
In "data object" terms, I sometimes put a public interface on the UC, and pass the whole thing around. "Live" if you will. All depends on how you build it ... and I "love" code-behind. My apps are also in production.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
modified 30-Jul-20 13:35pm.
|
|
|
|
|
Adding to what Richard said:
Events - C# Programming Guide | Microsoft Docs
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I suggest you handle field validation inside the UserControl, and only enable the 'Save Button when all fields have appropriate values ... assuming the validation code can be located inside.
There are several strategies you can use including using the built-in validation facilities in WinForms [^], [^]. A valuable discussion here: [^].
A simple strategy is to define Event Handlers for all the input fields for 'Enter and 'Leave, and check for values. Use a boolean flag to keep track of whether all fields are valid.
For an example of a complex full-featured validator see CP article: [^]
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 29-Jul-20 10:31am.
|
|
|
|
|
I would do it like this :
Outside your UserControl you have to check if all fields are filled (and perhaps if all information is valid) - because the Information is outside the UserControl.
Your UserControl gets a Property which give this (boolean) Information to it.
This Check could be done each time one of those fields is changed ... or with an Event which comes from the UserControl. But I prefer the 1st ...
|
|
|
|