|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid..
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
This message has been flagged as potential spam and is awaiting moderation
|
|
|
|
|
In VS 2022 I can not find any templates for WinUI. I installed Windows SDK and WinUI controls but I can not find any templates. Any idea why ?
Thanks
|
|
|
|
|
|
|
Did you install the correct workloads by following the link in point 1?
|
|
|
|
|
|
|
|
This message has been flagged as potential spam and is awaiting moderation
|
|
|
|
|
This message has been flagged as potential spam and is awaiting moderation
|
|
|
|
|
Hello friend! I am developing a Windows application (WinForms) to manage universities with c#, it is an application that is very complex because it is a Multi-user application, I want that for this application I can use a single database centralized by all users of this application, which will be managed by myself and my development team. Is this possible? What would be the best and least expensive solution, taking into account my capacity? Also in terms of cost, between a SQL SERVER EXPRESS database and a MySQL database, which one might be better for me? And which one is well suited to C#, using Crystal Report and Visual Studio as well? Your answers will help me a lot to make a decision and also develop an efficient solution.
I'm thinking about whether it's possible to host only my SQL SERVER EXPRESS, or MySQL database to which my Windows software or application designed in C# can connect remotely so that the various users of my device can access the remote database
Thank you for your help
modified 8hrs 10mins ago.
|
|
|
|
|
theo tuombe wrote: taking into account my capacity?
You didn't specify anything about capacity.
theo tuombe wrote: to manage universities with c#,
Manage what? Class schedules? Budgets? Lawn care?
theo tuombe wrote: What would be the best and least expensive solution
No idea. Even if you had all of the missing detail anyone that claimed that they could decide both of those would be, let us say, less well informed about the subject than one might hope.
theo tuombe wrote: And which one is well suited to C#
This is one of those factors where "best" has many meanings. If you plan on being a windows shop then staying with windows which means SQL Server is probably going to be the least amount of trouble.
Now if you or others that work on this have experience both in C# and other data persistence stores then there are other options. But then I suspect you would have already been able to evaluate that without asking here.
If you are VERY careful with how you write your code and your design then it is possible that you can switch databases relatively easily if you find you want a different solution. But unfortunately that again is probably dependent on experience.
|
|
|
|
|
The message above comes from the following code:
public abstract class Indicator : ExtendedIndicator
{
[global::Newtonsoft.Json.JsonIgnoreAttribute]
protected ITradingManager? TradingManager { get; }
}
class MyTradingManager
{
public ITradingManager _tradeManager;
public MyTradeManager(ITradingManager argTradingManager)
{
_tradeManager = argTradingManager;
}
}
internal class SampleIndicator : Indicator
{
MyTradeManager _tradingManager;
public SampleIndicator ()
{
_tradingManager = new(TradingManager ); <- Here the problem occurs !!!
}
}
Any Ideas why I get the error message in the title of this question ?
|
|
|
|
|
You didn't post the whole error message, did you? Please post the entire thing.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello, please see below for the whole message:
Time Source Message
23.04.2024 09:18:14 ChartData Self referencing loop detected with type 'SampleIndi.SampleIndicator'. Path 'MyTradeManager._tradeManager.TradingVolumeInfo.Drawer.Data.Panels[0].Indicators.$values'.
|
|
|
|
|
Why do you even have that line in the constructor? It doesn't even make sense.
The "SampleIndicator()" constructor doesn't take any arguments, so are you trying to create a new instance of TradingManager for it to hold onto?
The code, as it is now, doesn't make sense at all.
|
|
|
|
|
With the following code:
public SampleIndicator ()
{
_tradeManager = new(TradingManager ); <- Here the problem occurs !!!
}
I want to "inject" TradingManager into my own object _tradeManager which already works as expectet.
The problem is the errors message I get from the logging window of the app that uses my plugin dll.
Unfortunaltely I do not have access to the source code of that app, only to my dll.
|
|
|
|
|
That's not how you do dependency injection.
Your Indicator class is useless as it has no way of setting its TradingManager property. Also, the JsonIgnoreAttribute is only useful if you're serializing the Indicator class to a file. I'm leaving the Indicator out of your code.
class MyTradingManager : ITradingManager
{
... Code to implement the ITradingManager interface ...
}
internal class SampleIndicator : ExtendedIndicator
{
private ITradingManager _tradingManager;
public SampleIndicator(ITradingManager tradingManager)
{
_tradingManager = tradingManager;
}
... Code that uses the ITradingManager implementation ...
}
Note, for this to work, you cannot make SampleIndicator dependent on MyTradingManager. It should take an instance of some implementation of ITradingManager instead. MyTradingManager is that implementation. Whatever code is creating instances of this stuff has to create an instance of MyTradingManager and pass that to the constructor of SampleIndicator:
{
...
ITradingManager manager = new MyTradingManager();
SampleIndicator indicator = new SampleIndicator(manager);
...
}
|
|
|
|
|
public class Student
{
int id = 1234;
String name = "gustav";
bool state = true;
}
It should print:
Student:
1234
gustav
true
|
|
|
|
|
The Student class should NOT CARE AT ALL about outputting anything to the console or other output. It should be just limited to managing the data for a single Student.
One problem I see if your Student class should expose its data in public properties, not fields.
Having said that, whatever UI code is using this class in some way would be responsible for the presentation. To get the properties in the format you specified in your question, the easiest way to return the string would be to override the Student class ToString method and build the formatted string to return to the caller:
public class Student
{
public int ID { get; set; } = 1234;
public string Name { get; set; } = "gustav";
public bool State { get; set; } = true;
.
.
.
public override string ToString()
{
string result = $"{ID}\r\n{Name}\r\n{State}";
return result;
}
}
|
|
|
|
|
Hello,
thank you for the reply.
The underlying problem ist the following.
I want to save the property values of the objects I use in a file and I also want to be able to read it back from that file so that I have a kind of settings file for my app. For logging purposes I also want to be able to print the values to console or file. My understanding was that with serialization this could work.
|
|
|
|
|
Convert the private fields into public properties and you should be able to serialize these values as you see fit.
|
|
|
|
|
This should have been in your original question. What you're looking for is called "serialization". This is the process by which an object is written to a form that can transmitted and read by a matched deserializer and can be accomplished using JSON, XML, and Binary serializers.
My previous answer still stands for most serialization operations, you still need the public properties, but you do not need to override the ToString method.
You can read up on it at Serialization - .NET | Microsoft Learn[^]
|
|
|
|