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
S

sjembek

@sjembek
About
Posts
31
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Cross-instance method invoking
    S sjembek

    Hi, I'm using the code from this article to detect if another instance of my program is running and raise the other instance if it is, closing down the seccond instance of my program. However, I would like to parse the command line parameters given to the seccond instance towards the first instance of my program, prefferably by invoking some kind of method on it. Is there any way of doing this?

    C# csharp com question

  • Microsecond timers/delays
    S sjembek

    A bit late, but just wanna thank you for the tip, this works excellent!

    C# help csharp c++ sysadmin hardware

  • Microsecond timers/delays
    S sjembek

    Hi, I'm testing a piece of hardware that receives network traffic and want to see exactly at what frequency it gets overburdened by the load of traffic. To do this I wrote a simple program that sends packets at a set interval. My problem is the following: The hardware doesn't break up at intervals of 1 millisecconds, so I need higher resolution delays or timers in my program (somewhere in the order of 50 microsecconds or so) than the timers I've been using (Threading.Timer or Forms.Timer). I found an article on the net saying this is possible with C++, but I can't find any info on the subject in c#. Can anyone help? Thanks in advance for any help I might get...

    C# help csharp c++ sysadmin hardware

  • Catching minimize event
    S sjembek

    I mean having it stick to a specific side of its parent, just like controls can. Actually, this is easier than I though. Just set an mdi parent and set the dock property for you form to try it out.

    C#

  • Catching minimize event
    S sjembek

    Ah ok, thanks. That worked. Now we're at it, would anyone happen to know how to make my mdi client window dock to its parent? Thanks again, cheers.

    C#

  • Catching minimize event
    S sjembek

    Hi, What event should I catch if I want to replace the minimize button code. I've tried catching the "Sizechanged" event but this fires every time a window is opened or resized, I only want to catch the event caused by the minimize button. I want to use this to create an application specific "taskbar" for all of my MDI client windows. Thanks in advance for any suggestions made!

    C#

  • Problem with timer event fireing
    S sjembek

    If you're stopping another timer, why not just change its interval to the interval you had in mind for the third timer and hook up the right event listener to it?

    C# help com question

  • Ports.SerialPort freezes
    S sjembek

    Ok, I already found the problem, for some strange reason the port needs to be reconstructed:

    port = new SerialPort(port.PortName, port.Baudrate);

    Weird...

    C# csharp question

  • Problem with timer event fireing
    S sjembek

    Are you using the System.Windows.Forms.Timer or the System.Threading.Timer? If you're using the tick event it looks like you're using the windows forms timer. If so, make sure you're using it in a class that inherits from Form, otherwise it won't work. The Threading.Timer is a better option in that case, you can set the interval and a callback function in its constructor.

    C# help com question

  • Ports.SerialPort freezes
    S sjembek

    Hi I'm using the SerialPort class (.net 2.0) for rs232 communications. Unfortunately, an it freezes up my program when I try to set a parameter for it after it's been opened. First I initialize the port:

    SerialPort port = new SerialPort(comname, 19200);
    port.Open();
    port.ReceivedBytesThreshold = 63;
    port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);

    Then I do some communications stuff. So far so good. The freeze occurs when I try to use the port for some other process.

    if (port.IsOpen)
    {
    port.DiscardInBuffer(); // will freeze here
    port.DiscardOutBuffer(); // here
    port.Close(); // here
    }

    port.ReceivedBytesThreshold = 1; // or here
    port.Open();

    Any of the commented line freeze up my program as if in a blocking state, and the code doesn't throw an exception of any kind, it just freezes each and any thread currently running. Does anyone have any clues what's happening here?

    C# csharp question

  • Unsubscribing all event listeners
    S sjembek

    Hi, Thanks for the suggestion, someone has offered me the memento pattern before, and next time I'm implementing a feature like this I'll be sure to use it. Unfortunately I found out a bit late about this in order to use it for the current project: Should I want to convert my project to use this pattern would mean I'd have to change about 1500 base datatypes to start using it, I'm afraid I don't have the time or spirit to do so. For now I found an ugly hack around the problem: I serialize the class and store it to a memorystream, then inmedialtely deserialize it and add it to my Collection of "undo" objects. Since the event is marked as non-serializable it gets initialized to null as soon as I deserialize it. It's a bit ugly and I still don't see why I can't just set event myEvent = null . But this performs quite well actually. Cheers and thanks for the help! -- modified at 10:10 Friday 25th August, 2006

    C# help question

  • Unsubscribing all event listeners
    S sjembek

    Thx for the answer, wasn't expecting anyone to reply anymore. I've thought about that solution too, but I think there should be a more elegant way to fix the issue. The reason I want to do this: the class concerned here contains some data that's shown and can be modified in dozens of places in my application. I've created a sort of "undo" function that saves a copy of the object to memory so that the user can "rollback" on his actions. These copies should contain only data, and shoudn't even try to fire any events. While debugging I found out that some references were left to my cloned objects, meaning the data in these clones is getting modified just as my "foreground" data. What's more, the number of cloned objects in memory could eventually be many thousands, so the performance hit for even for simply checking a flag each time isn't something I want. Since manually disconnecting my eventlisteners is so sensitive to my own errors (code intensive) I'd like to be sure all eventlisteners get disconnected from the event. I'd expect the event itself to contain a list of references to all listeners. As I said before: How else could you check an event for null. Suggestions are still welcome of course :)

    C# help question

  • Unsubscribing all event listeners
    S sjembek

    Is there any way to unsubscribe all event listeners for a certain event?

    public delegate void myHandler(object Sender);
    public event myHandler somethingChanged;

    private void onSomethingChanged()
    {
    if(somethingChanged != null) somethingChanged(this);
    }

    What I would like to do is something like somethingChanged = null. Why isn't this allowed if I can actually check somethingChanged for null? somethingChanged -= someFunction is not an option, what I want is somethingChanged -= allListeners. Can anyone help me out here?

    C# help question

  • Copy an instance
    S sjembek

    Works perfectly... Thank you.

    C# question

  • Copy an instance
    S sjembek

    This works, thx :)

    C# question

  • Copy an instance
    S sjembek

    Looks interesting, I'll try this out...

    C# question

  • Copy an instance
    S sjembek

    Actually it is Serializable since it can be stored to disk too. I just had a go with this but I haven't serialized to memory before and for some reason I'm getting a System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed. The code looks like this.

    Collection myOutputCollection = new Collection();

    BinaryFormatter bFormatter = new BinaryFormatter();

    MemoryStream mStream = new MemoryStream();
    OutputData myOutput;

    bFormatter.Serialize(mStream, myOutput);

    deserializedOutput = (OutputData)bFormatter.Deserialize(mStream);

    myOutputCollection.add(deserializedOutput);

    mStream.Close();

    I'm serializing and deserializing the object, then adding it to a collection, since I'm still using it from the collection once it's added (it's not like I don't need it anymore).

    C# question

  • Copy an instance
    S sjembek

    I see the use of the pattern, but it seems this will only work for a single member that defines the state, while I meant the state of the object itself and all of its members... I'm afraid this won't work, but thanks for the info.

    C# question

  • Copy an instance
    S sjembek

    Is it possible to make an exact copy of an instance of an object (not its reference)? This is what I'd like to achieve: 1 make a copy of an instance at a certain moment to save the state it's in 2 modify the original for a bit 3 replace the original object with the saved one later on This way I'd like to be able to "recall" the state my object was in at the moment I made a copy. Is this possible without manually constructing a new object of this type and copying all of it's members?

    C# question

  • UnauthorizedAccessException
    S sjembek

    Nope.

    C# help question csharp security debugging
  • Login

  • Don't have an account? Register

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