Its kind of frustrating because I have been sitting here for 3 days (I have a high tolerance of trying different variations before I burn myself out) trying to figure out why it works fine in Timer_Tick but not when Timer) Tick is running the Backgroundworker. My guess is that it is because of the Threads between the both.
I have tried cloning the bitmap inside the background worker
It's probably pretty simple: only code that is running on the main (UI) thread can access any control in any way: since you moved it to a BackgroundWorker it isn't running on that thread any more, so when you try to access the Image or similar it's failing with an exception. Start by adding a try...catch block with Debug.WriteLine statements to check that and consider either Invoking the relevant controls or moving the Control related code back to the UI thread via the Progress reporting mechanism of the BackgroundWorker.
"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 C# solution with multiple projects in it:
- Project 1 = A Windows Service project (with an app.config file containing general settings, to be used by ALL projects; this project will be the "main" startup project of the solution)
- Project 2 = A class library containing classes and functions that will handle execution of business logic (and do some logging in the EventViewer)
Upon startup, the Windows Service should read contents of its app.config [THIS WORKS!!!]
- Project 3 = A WinForm Test application that I temporarily use to test the business logic execution and logging.
Ultimate goal is to "remove" Project 3 and have the Windows service handle the business logic/logging.
In the app.config, I enter the settings that will be used by both project 1 and 2. Is there a simple way to "share" the config settings across all projects in the entire solution (upon startup of the service)?
I can create a GeneralConfig class, and add some properties, but how can I make this object (with the current properties) common to all projects. Is there something like a "single-instance" object.
A very simple way to eliminate Project 3 while debugging is to alter the Main function in the Program.cs file.
An example is:
private static void Main(string args)
ServicesToRun = new ServiceBase
// Establish the foreground run...
MainThread objMainThread = new MainThread(false);
In this case, MainThread is the name of your top level service class that contains your Run function. This is generally called from the ControlLoop.Onstart event...
I have been studying, and experimenting (in WinForms), with the newer structures (.NET 5.0) Vector, Rect, and Point in System.Windows (requires WindowsBase.dll). They offer some useful extended functionality compared to the Point/PointF and Rectangle/RectangleF structures in System.Drawing. They're Double based, so they will play nicely with the result of Math operators like Sin, Cos, Pow.
I intend to rewrite the 2d geometry library I am developing using those structures, and, when ready, publish it here; if you have used these structures, how have you found memory use and performance ?
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
I have a forms application in C# and Visual Studio. Tis app interacts with Excel and is workin fine.
I installed the executable and the configuration file in another computer and whe the app calls excel I received a message stating that a library was not registered. The error message says that it's not possible to convert a COM object type 'System.___ComObjet' into the interface 'Microsoft.Office.Interop.ExcelApplication'.
Does anyone know what to do to correct it? Which DLL should be copied too?to correct it? Which DLL should be copied too?
Perhaps you're suggesting that in order to run your app on a computer that does not have VS installed, copy the C:\Program Files\Microsoft Visual Studio #.0 (your version)\VC\redist content to that computer. Just a thought. If the app runs then ytou can start worrying about whether this is legal or not.
Lookup MSVCR and where to download it from Microsoft. That should do it.
[EDIT POST 16pt hit]
You mention a library ... what library?
You have to have Microsoft Excel, or Office, installed on the machine. Interop doesn't mean you get the functionality without the app. It means it's an "interoperability" interface between your app and the app you're trying to use in it, like Excel.
We just change netcore to framework and it works
We have a WS, if you go to server you can run it and see the 2 methods, you can invoke then and WORK
If you go to Visual Studio 2019 and add a reference to the project using the: http://xxx.xxx.xxx.x/wsxxx/wseps.asmx?wsdl you can see the method and add to the project:
But when we try:
ServiceReference1.WPSSOAPCLIENT oClient= new ServiceReference1.WPSSOAPCLIENT()...
1. The new ServiceReference1.WPSSOAPCLIENT() is marked as an error.: Does not contanins a constructor that take 0 argument