|
You could encrypt it yourself if you don't trust the framework.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I don't have any trouble trusting the framework to encrypt things.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I'm trying to be kind here, aight?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Yeah ... some of my data classes I binary serialize, then encrypt, then compress, then embed as resources. Make them work a little.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Smart, no-one would expect you to encrypt before compressing.
|
|
|
|
|
Hey there,
Hope everyone is well.
I have a method in my Form1()
public void checkCommand(string command)
{
this.label1.Text = command;
}
I've written an external .dll class library with other methods, which I'm also using inside my main Form1(). But I do need to call a method/methods that are in my Form1() from this external .dll class library. However, I can't access it.
public class Commands
{
private string myCommand;
public void readCommand()
{
checkCommand(myCommand);
}
private void
}
Please note, I'll be using this external class library in multiple applications. So assigning Form1 inside my external dll is out of question, unfortunatelly.
Does anyone know the best solution to this, please?
I'll be very grateful for all your ideas. Thank you!
modified 29-Dec-22 17:20pm.
|
|
|
|
|
Question is not very clear.
C# has classes and methods (static or not.) You cannot access a method without the class.
Beyond that the class must also have a namespace.
So you must resolve the namespace. You must have a instance. You must call the method with that instance. Examples of all of that.
using SomeNamespace:
...
YourClass c = new YourClass();
c.checkCommand(myCommand);
To get to that class (as defined by the namespace) you must have the dll referenced in the binary build. Even to compile it it will need to be available. And of course delivered into an appropriate space (same file system directory) as the primary executable.
|
|
|
|
|
Thank you jschell. I appreciate your involvement.
Apologies, if perhaps I haven't made myself clear.
As per my post above, I've mentioned that I am using external dll. Therefore, I use namespace to it, exactly as per your suggestion. So in my Form1 I can access all methods from my external class library.
To be clear, this is an external dll class for my sockets client.
OnReceive(IAsyncResult ar) I need to display value on label.text in my Form1, or other forms where I will be using my external sockets class dll assembly.
Another method within that class need to call method from Form1 checkCommand(string command). Hope this will help explaining it better
Thank you again
|
|
|
|
|
There's a bunch of different ways of doing this, but NONE of them involve your class library calling a method in the form class.
Looking at your example code, I wouldn't even consider putting that code in the Form class, but instead in it's own class where you create an instead of it and pass that instance to your class library. Of course, that class will have to implement an interface your class library exposes and expects by an implementer.
|
|
|
|
|
You need to add an "interface" (e.g. IFormCommand) to your external dll that your form can implement; then you call into the dll with the interface ("sender" as IFormCommand); the dll can then use to interface to call the form's method(s); as defined in the interface.
You're basically trying to avoid a circular "using" reference (from dll to form) by using an interface (class).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Impossible: for a dll in some unknown app to invoke a method in a WinForm app ... the dll must get passed a valid reference to the Form instance in the WinForm App.
You need to describe in detail what you are trying to achieve.
Theoretically, it is possible to use reflection to enumerate all running processes and locate the WinForm app process of interest ... believe me, you don't want to go there [^]
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Turn the problem on it's head, and ask yourself "does it happen in other code?"
And the answer is "yes": it happens all the time. When something happens in a class, it wants to tell the outside world about it.
When the user clicks a button, when data arrives at a serial port, when a timer expires - they all need to tell your code that it happened. They do this by means of Events which your code subscribes to and processes via a handler method.
The user clicks a button? The Button raises the Click event, your code handles it and checks the data he entered.
Data arrives? The SerialPort class raises the DataRecieved event, your code handles it and processes the characters.
The timer interval expires? The Timer class raises the Tick event, your code handles it and updates the on screen clock.
So why not use the same mechanism in your code? Your external class creates an Event, your form adds a Handler; your external class wants your form to do something, it raises the event, the handler method does the work.
Have a look here: Transferring information between two forms, Part 2: Child to Parent[^] - it's form / control based, but it's exactly the same process for "normal" classes.
"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!
|
|
|
|
|
I have a good prototype to draw some fancy mathematical models in Windows Form application.
now I want to wrap this drawing logic into a chart control.
how difficult is it for this conversion?
try to get some ideas from you gurus here. plan to do this conversion in this year end break.
diligent hands rule....
|
|
|
|
|
Not too difficult: create a UserControl and start adding your logic code to that. If you code already draws on a form, it should work pretty much unchanged on a UC (remember that a Form is derived from Control and so shares a lot of properties and methods).
"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!
|
|
|
|
|
thanks for your confirmation! I will convert it by myself.
diligent hands rule....
|
|
|
|
|
You're welcome!
"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!
|
|
|
|
|
I had this code working in VB.net, and I tried switching it to C# as follows. did anyone ever do this before?
(how do I "type" objMyform? What would be the equivalent of "dim")
objMyForm = Server.CreateObject("CutePDF.Document"); 'Create form object
int nReturn;
objMyForm.initialize("FS21-001-39268470-03111634") ; 'Initialize object by serial number of the license
int familyID = session("FamilyID");
FM Family = new Family();
FM.GetByID(familyID);
Camper CP = new Camper();
int CamperID;
GetCamper(CamperID );
'Open an encrypted PDF form file from an URL with password 'cutepdf'
if objMyForm.openFile("/../Forms/Parentalconsent.pdf") == false then
errorMessage = objMyForm.GetLastError();
end if
'Set some value into fields
nReturn = objMyForm.setField("chkAgudah", CP.att_camp ==1? "on":"off");
nReturn = objMyForm.setField("chkBnos", CP.att_camp ==2? "on":"off");
nReturn = objMyForm.setField("chkCCM", CP.att_camp =31? "on":"off");
nReturn = objMyForm.setField("chknu", CP.att_camp ==4? "on:"off");
|
|
|
|
|
Quote: (how do I "type" objMyform? What would be the equivalent of "dim")
objMyForm = Server.CreateObject("CutePDF.Document"); 'Create form object
int nReturn;
The Dim statement in VB is simple:
Dim variableName As variableType = ... In C#, it's even simpler:
variableType variableName = ...
If you don't know both languages, then use an online converter: Code Converter C# to VB and VB to C# – Telerik[^] is the one I use.
"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!
|
|
|
|
|
Cute PDF SDJ support request: [^].
The form indicates questions re evaluation version may be accepted.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Hello everyone
i am using Thread and inside it there is for loop
it starts fast for first 30 times then it becomes slow and after 500 times it become much slower any idea why this happen?
modified 26-Dec-22 6:17am.
|
|
|
|
|
Without your code (and probably your data)?
We have no idea why this happens - there are just too many different things you could be doing! There is nowhere near enough information here for us to begin to help you - we have no idea what you are trying to do, or where you are starting from.
Start here: Asking questions is a skill[^] and think about what you need to know, and what you need to tell us in order to get help.
"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!
|
|
|
|
|
you are right sorry for that
and i finally got what was the problem i am using inside loop linq and when i use function inside where it took too much time
|
|
|
|
|
It's OK, at least you tried to ask a "proper question" - it's not the worst question we've ever had, just look two threads down ...
"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!
|
|
|
|
|
of course, we have no idea how you are using Linq, but:
"inside loop linq:" keep possibility of multiple enumerations in mind: [^]
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Probably creating a memory leak.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|