|
That's really really old and quite buggy, better use the Tao Framework[^] these days (though it also seems quite dead now)
|
|
|
|
|
Forget about OpenGL, and use SlimDX.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
is there like file watcher for registry
|
|
|
|
|
Hello,
I'm a little lost as to how to write a class that will take in arguments from the .Add function of a List<>.
With reference to this thread, I have written the following class.
public class SnapShot
{
private DateTime m_SnapShotDateTime;
public DateTime SnapShotDateTime
{
get
{
return m_SnapShotDateTime;
}
set
{
m_SnapShotDateTime = value;
}
}
private long m_BPSAverage;
public long BPSAverage
{
get
{
return m_BPSAverage;
}
set
{
m_BPSAverage = value;
}
}
public SnapShot(DateTime snapshotdatetime, long bpsaverage)
{
m_SnapShotDateTime = snapshotdatetime;
m_BPSAverage = bpsaverage;
}
}
I have created a List and would like to use the .Add function to add "entries" for .SnapShot(DateTime snapshotdatetime, long bpsaverage).
SnapShot LiveSnapshot;
List<SnapShot> LiveSnapshotList = new List<SnapShot>();
How do I properly write the class so that it handles the .Add function of the List? Or should I be calling .Add with some other overload value?
Thanks,
Matt
|
|
|
|
|
Hi,
1.
you don't need to create a special list class, a simple:
List<SnapShot> snapShots=new List<SnapShot>();
SnapShot snap=new SnapShot(...);
snapShots.Add(snap);
...
List<SnapShot> moreSnapShots=new List<SnapShot>();
moreSnapShots.Add(...);
snapShots.Add(moreSnapShots);
would work just fine.
2.
And you could make that slightly more user-friendly with an almost empty class like this:
class SnapShotList : List<SnapShot> {}
SnapShotList snapShots=new SnapShotList();
SnapShot snap=new SnapShot(...);
snapShots.Add(snap);
...
SnapShotList moreSnapShots=new SnapShotList();
moreSnapShots.Add(...);
snapShots.Add(moreSnapShots);
|
|
|
|
|
Thanks very much Luc. I will take a look into this.
As for snap , this is of the type SnapShot as defined via the SnapShot class's SnapShot function?
Thanks,
Matt
|
|
|
|
|
bbranded wrote: as defined via the SnapShot class's SnapShot function?
yes.
however functions are passé, you should call them methods now; unless they are constructors!
|
|
|
|
|
5ed
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Haha! What do you call a Lambda Then Luc?
|
|
|
|
|
I'm afraid I can't answer that on a public forum.
|
|
|
|
|
bbranded wrote: I'm a little lost as to how to write a class that will take in arguments from the .Add function of a List<>.
If you use List, then do not handle .Add, because it is implemented. As your example you incorrectly defined List.
List<SnapShot > LiveSnapshot = new List<SnapShot>();
|
|
|
|
|
public class SnapShotList : List<SnapShot> {}
Then you can do this:
SnapShotList snapshots = new SnapShotList();
As a result, you get all of the benefits of having a list (including all of the methods therein) in a conveniently named object, and you can add specific custom behavior to your class to handle circumstances ragarding the items in the list. I do it all the time.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I am developing a Custom Control and I will ask question from several categories. I appreciate your answers
1st question:
How can I create a class to be used like XmlNode. XmlNode can be XmlElement or other types. I wan't to use similar approach. I need it, because I want draw other type of controls within one control.
Example:
Display a Group box with a picture and a button as an item in TreeView
2nd Question:
My Control is Inherits Control class. How can I hide some properties and/or change its description.
Thank you for your time.
|
|
|
|
|
Saksida Bojan wrote: 1st question:
How can I create a class to be used like XmlNode. XmlNode can be XmlElement or other types. I want to use similar approach. I need it, because I want draw other type of controls within one control.
Okay, well then create a simple interface for your object and have a toString method that can convert it to the correct output. Look at the XML classes and interfaces, they all share a common.
Saksida Bojan wrote: Example:
Display a Group box with a picture and a button as an item in TreeView
This is more complex. You would have to use some kind of logic to display the node as such. HTML/WPF/SilverLight/WinForms all do it differently. Look for some examples on:
Creating User Controls.
Saksida Bojan wrote: 2nd Question:
My Control is Inherits Control class. How can I hide some properties and/or change its description.
In the designer. All properties are visible. You can change them there, there will be somethings you can't hide or change depending on the inheritance of the object/control.
Question: What are you creating the control in? WPF?
|
|
|
|
|
TheArchitectmc∞ wrote: Okay, well then create a simple interface for your object and have a toString method that can convert it to the correct output. Look at the XML classes and interfaces, they all share a common.
Will look at it. If I coudn't use, then I would use Object, but I would rather avoid Object
TheArchitectmc∞ wrote: This is more complex. You would have to use some kind of logic to display the node as such. HTML/WPF/SilverLight/WinForms all do it differently.
I have already thought on how to handle it
TheArchitectmc∞ wrote: Look for some examples on:
Creating User Controls.
I have read a Book about creating Custom control, however i need data layer that behaves like XmlNode. I will look at the interface.
TheArchitectmc∞ wrote: Question: What are you creating the control in? WPF?
I am desinging for windows form
|
|
|
|
|
Saksida Bojan wrote: I am desinging for windows form
Okay if you are designing for windows forms, then this has sort of been done for you in the WPF implementation of Windows Forms.
Create a WPF application, add WinForms to the project, it appears as a button in the widget box.
Saksida Bojan wrote: I have read a Book about creating Custom control, however i need data layer that behaves like XmlNode. I will look at the interface.
There are many way of representing data as an XML node. Many converrters in the .NET runtime. Take a look at LINQ to SQL, LINQ to XML, and LINQ to Objects. There are ways to easily use SQL as XML, Object as XML.
Saksida Bojan wrote: Will look at it. If I coudn't use, then I would use Object, but I would rather avoid Object
Another approach to to directly inherit from XMLNode or what ever works for you. I would make sure that it is a basic enough object which can also be used in other assemblies in the .NET runtime.
|
|
|
|
|
1. You can either use an interface or an abstract class depending on what suits your needs best.
2. This is possible by creating new properties the same as the old and applying certain attributes (overriding instead of new may work - I seem to recall having problems that way). The control will need to be compiled to a separate assembly, if in the same assembly as the project, or in a referenced project then the attributes will have no effect!
public class MyControl : Control
{
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
EditorBrowsable(EditorBrowsableState.Never),
ObsoleteAttribute("This property is not valid for this control")]
public new string Text
{
get { return base.Text; }
set { base.Text = value; }
}
} This isn't foolproof though as the end user can always treat your control as Control and have access to all the stuff that Control has. It's also against OOP priciples to inherit stuff you don't want, but in the case of Control there isn't much option and even MS themselves do it!
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
thanks for info. Gonna need to look into abstract, because i do not know what it is.
|
|
|
|
|
An abstract class is a bottom level class in the class hierarchy which can not be instantiated. So if you are using inheritance you won't be able to use abstract classes.
The attributes solution is a good hack to keep the user from using something you don't want them to use.
|
|
|
|
|
Hi All,
I have a Windows service that suppose to write in a file in a shared network drive.
Bud im getting this error:
System.UnauthorizedAccessException: Access to the path '\\Pc001\test\test.txt' is denied.
How can i fix this ?
Thanks
|
|
|
|
|
You have to give wright permissions to the shared folder.
|
|
|
|
|
Run the service under a user account insterad of Local System. Start -> Run -> services.msc and find your service, double-click it to get properties. On the LogOn tab, specify a user account that has permissions to that network share.
|
|
|
|
|
Hi Dave Kreskowiak,
Thanks for reply, i will try this your suggestions asap.
|
|
|
|
|
|
Noone is going to answer you because of 3 things. First, your subject line demanded an answer. That is very rude.
Second, noone can understand your requirements. I understand English is not your native language, so someone else better at translating would probably be appropriate.
You question seems to be so high-level and undefined and to only elicate more questions from anyone who reads it.
|
|
|
|