Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AtaChris

@AtaChris
About
Posts
14
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Remembering the state of a property.
    A AtaChris

    Hello, within a plugin dll I instantiate an object as a property. The properties of this object are visible in the UI of the application that uses the plugin dll. I do not have acces to the code of the application. If I use the following code:

    [IsExpanded()]
    [Display(Name = "Direction")]
    public FilterManager Direction { get; set; }

    the properties of object "Direction" are visible in the UI. If I use the following code:

    [Display(Name = "Direction")]
    public FilterManager Direction { get; set; }

    the properties ob object Direction are no visible in the UI and the user has to expand it manually first. Question: Is there a way to save the last state of object "Drection", i.e. "expended by the user" or "not expended by the user", so that next time the user opens the UI he can start to work where he stopped working last time (otherwise the user must click himself trogh many levels) ?

    C# question design

  • How to use functions of a dll in another dll "on the fly"
    A AtaChris

    The "Master" dll (or base dll) is the application in this case. It is a plugin dll for a software where i do not have the source cose and also extends the functionality of that software. So you could consider the base dll as the application.

    C# visual-studio help tutorial

  • How to use functions of a dll in another dll "on the fly"
    A AtaChris

    Hello, I have a VS project to implement a dll. This dll is a kind of "Master" dll and it should be possible to extend its functionality with "Extension" dlls without touching the "Master" dll. The "Master" dll should check everytime when it is loaded, what other dlls are available and thus extend or reduce its functionality by itself. If "Extension" dlls are missing, the "Master" dll should recognize this without any error and function with reduced functionality. Any hints from your side which approach would make sense here.

    C# visual-studio help tutorial

  • Where to hand over the instance of my plugin dll class to another class
    A AtaChris

    MyPluginDllClass
    {
    //Fields

    //Properties

    MyClass _myClass {get; set} = new(this); //this does not work !!!

    //Ctor
    public MyPluginDllClass
    {
    //do sth
    }

    //Member Functions
    public void Test1()
    {
    //do sth
    }

    }

    public MyClass
    {

    MyPluginDllClass \_instanceMyPluginDllClass;
    
    public MyClass(MyPluginDllClass param)
    {
    
    	\_instanceMyPluginDllClass = param;
    
    }
    
    
    //Member Functions
    public void Test2()
    {
        \_instanceMyPluginDllClass.Test1();
    }
    

    }

    Hello, for being able to see all properties in the UI of MyPluginDllClass I would have to instantiate MyClass as shown above in the properties area of MyPluginDllClass as follows:

    MyClass _myClass {get; set} = new(this);

    But this does not work, "this" seems to be unknown at this moment in time. The goal is to use all member functions and properties of MyPluginDllClass within MyClass and to make all properties of MyClass visible in the property grid of the UI of the main application. Any Ideas, hints what I am doing wrong or why this is the case. I do not have access to the code of the main application. MyPluginDllClass ist the interface to the main application.

    C# css design

  • How to "link" a referenced dll to a third party dll I develop.
    A AtaChris

    Hello & thank you for your reply. Is there a reason why in C#/.Net we do not have statically linkable libraries (.lib-Files) like in C/C++ ?

    C# question visual-studio sales json tutorial

  • How to "link" a referenced dll to a third party dll I develop.
    A AtaChris

    Hello, I divided my solution for a third party dll in VS 2022 into a) 1st.dll in project 1 b) 2nd.dll in project 2 Project 1 references project 2 and creates instances of objects based on classes in project 2. Both dlls are copied to the same folder but only 1st.dll is loaed by an Application to which I have no access except vie an API used by my 1st.dll. My understanding was, that 2nd.dll is kind of linked to 1st.dll, so that it is no necessary in the same folder. I also only want to ONLY ship 1st.dll. But when I delete 2nd.dll from the path my approach does not work. Question: What do I have to to, so that it is sufficient to only have 1st.dll at the customer side available ?

    C# question visual-studio sales json tutorial

  • Self referencing loop detected for property with type ...
    A AtaChris

    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'.

    C# help question json

  • Self referencing loop detected for property with type ...
    A AtaChris

    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.

    C# help question json

  • How to print the property values of an object to a file/console ?
    A AtaChris

    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.

    C# tutorial question

  • Self referencing loop detected for property with type ...
    A AtaChris

    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 ?

    C# help question json

  • How to print the property values of an object to a file/console ?
    A AtaChris

    public class Student
    {
    int id = 1234;
    String name = "gustav";
    bool state = true;
    }

    It should print: Student: 1234 gustav true

    C# tutorial question

  • How to send property values via eventhandler ?
    A AtaChris

    Yea, the following code was one of the examples I tried:

    if (e.KeyCode == Keys.F1 && (e.Alt || e.Control || e.Shift))
    {
    //do sth
    }

    It is from the source you mentioned, but i does not work. Compiler says that

    KeyEventArgs

    does not contain a definition for Alt etc. Also there is no suggestion of how to fix it. These are my usings: using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Reflection; using System.Windows.Forms;

    C# question tutorial

  • How to identify Key Combinations ?
    A AtaChris

    Hello, I was able to identify a key press with a single key by the following code:

    public override bool ProcessKeyDown(KeyEventArgs e)
    {
    if (e.IsRepeat) return false;
    if (e.Key == Key.Escape)
    {
    //do sth
    }
    }

    But I was not able to find a solution that also identifies key combinations like: CTRL + arrowup etc. I also did not find anything that wokred with:

    KeyEventArgs e

    Any hints from your side ?

    C# tutorial question

  • How to send property values via eventhandler ?
    A AtaChris

    public class Person : INotifyPropertyChanged
    {
    private string name;

    public event PropertyChangedEventHandler PropertyChanged;
    
    public string Name
    {
        get { return name; }
        set
        {
            object before = Name;
            name = value;
            OnPropertyChanged("Name", before, Name);
        }
    }
    
    void OnPropertyChanged(PropertyChangedEventArgs e, object? argvaluebefore = null, object? argnewvalue = null, \[CallerMemberName\] string argcallername = "", \[CallerLineNumber\] int argcallerline = 0)
    {
        //How can I inject argvaluebefore and argvalue here ?
    	
    	PropertyChanged?.Invoke(this, e);
    }
    

    }

    public class Master
    {

    Person \_person = new();
    
    
    public Master()
    {
    
    	\_person.PropertyChanged += MyHandler;
    
    
    }
    
    
    private void MyHandler(object? sender, PropertyChangedEventArgs e)
    {
    
    	//How do I retrieve the curent values of property Name here plus the value before ?
    
    }
    

    }

    Hello, I need to retrieve the propery values of class Person in MyHandler of Class Master. Any ideas what I should do ? Regards, Chris

    C# question tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups