|
Something like that, yes. Think of it like a cartoon: draw 1 frame on one piece of paper, drawn the next frame on another piece of paper, etc.
The drawing should be done in the OnPaint override of your window/control. When you want to draw a new frame, call this.Invalidate() in your window/control code.
|
|
|
|
|
I keep hearing Invalidate(). What's that mean??? I get most else.
|
|
|
|
|
The Invalidate method is used to tell a control that it needs to redraw itself.
It will create a windows message that is put in the message queue. When the message is processed, it will raise the Paint event for the control that is used to redraw the control.
---
single minded; short sighted; long gone;
|
|
|
|
|
MasterSharp wrote: to make it move, you'd have to (for animating), draw the graphic, then dispose, draw, dispose...?
Disposing anything that you used to draw graphics doesn't remove what you have drawn. You can't remove anything that you have drawn, you have to draw something else to replace it.
If you have for example drawn an image on the screen, you would have to remove it by drawing with the background color, the draw the image at the new location.
---
single minded; short sighted; long gone;
|
|
|
|
|
Could I please have some example code? How would you DO what you're saying. (Dummies book doesn't have graphics, so I'm sorry I'm questioning...)
|
|
|
|
|
Why don't you check out this link. It has references to several games written in C#. Games typically animate things on the screen. I used the links there to create a game I plan to publish later this year...
Hogan.
|
|
|
|
|
Cool. Can I see some source?
|
|
|
|
|
Sorry it took me so long, but I published the article last night. Your post inspired me to finish this madness (even though it took a long time).
http://www.codeproject.com/useritems/Henry_s_Game.asp
I hope you have made progress on your work in the mean time.
Hogan
|
|
|
|
|
Draw to a bitmap and then place it as the background of a lightweight control and then you can do the translation. The best method, however, is to actually do the translation in the draw routines.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I have a WebService that has an class, lets call it BaseObjectClass. There are other classes that implement the BaseOjbectClass. I want to find all the classes that implement this BaseObjectClass, thru code or thru IDE but pref by IDE.
This assembly has thousands of classes and its difficult for me to search through all these objects.
Thanks in advance.
|
|
|
|
|
Your code obviously is well documented, so extract an XML file with the documentation and
search it for whatever it is you want to find...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
|
Exactly as the documentation on C# and Visual Studio tell you ("Documentation Tags"):
1. use /// to indicate structured comments; you do this for all protected and public
members (data members, properties, methods, ...)
2. check the checkbox "XML Documentation File" in project properties, Build
and specify a file name.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Do the following if baseType is a class...
private List<Type> GetDerivedTypes(List<Type> allPossible, Type baseType) {
if (baseType == typeof(object))
return allPossible;
List<Type> rval = new List<Type>();
foreach (Type t in allPossible) {
Type baseT = t;
while (baseT != typeof(object)) {
if (baseT == baseType) {
rval.Add(t);
break;
}
baseT = baseT.BaseType;
}
}
return rval;
}
Do the following if baseType is an interface...
// Same intro as before
foreach (Type t in allPossible) {
foreach (Type iface in t.GetInterfaces()) {
if (iface == baseInterface) {
rval.Add(t);
break;
}
}
}
return rval;
}
Hope this helps.
Jeff
|
|
|
|
|
how do i get the list of types from the webservice?
|
|
|
|
|
If you have visual studio use the Object Browser
|
|
|
|
|
I looked in the object browswer but it shows me all the classes and i have to go thru every class and check the derived class to see if it implements that class... too time consuming.. has to be a beter way.. unless there is another way to do it using objct browser
|
|
|
|
|
Are you looking to find this out at runtime, or at design time? If it is at design time and you are using VS, just right click on the base class and do a "Find All References", then look for "xxx : BaseClass" results
Jeff
|
|
|
|
|
Over looked the simples thing... your suggestion did work.. Thanks. ANy luck with the form dialog?
|
|
|
|
|
Hola-
---===The Background===---
So here's the problem I'm running into. I'm throwing out a UDP packet from my machine to a subnet broadcast address. Once the packet is broadcast over the subnet, a series of cool little devices we used in our hardware called DigiConnect MEs (ethernet to serial converters - www.digi.com) read the packet, realize that it's a device discovery request, and then proceed to each send a packet back to my machine detailing their firmware version, IP, etc.
The first part is fine. I'm sending out over UDP, and when I use SharpPCap to get raw access and just sniff out any UDP packets, I find that, yes, the devices on the network are responding and sending packets back to me.
However, I'm trying to transition anyway from SharpPcap on the recieve end to allow for abstraction. Plus, SharpPcap doesn't support the network card in my laptop, which is annoying the heck out of me. =D
---===The Problem===---
The devices on the network respond to the same port on my machine that sent the packet to the broadcast address. I'm not sure if I have this reconfigured correctly to recieve it.
UdpClient u = new UdpClient("224.0.5.128", 2362);
byte[] packet3 = new byte[] {68, 73, 71, 73, 0, 1, 0, 6, 255, 255, 255, 255, 255, 255 };
int port = ((IPEndPoint)u.Client.LocalEndPoint).Port;
IPEndPoint recvpt = new IPEndPoint(System.Net.IPAddress.Any, 0);
u.Send(packet3, packet3.Length);
byte[] data = u.Receive(ref recvpt);
u.Close();
Thanks in advance for any help.
|
|
|
|
|
Heres an interesing (I hope) question
The short version of the question:
Is it possible to cast an instance of a WebService reference to an custom interface (the webservice contains the methods as defined in the interface)
The long version:
I have an application framework that consists of the following key components:
(A) Client API
(B) Server WebService
(C) Server Remoting Listener / Application
In runtime, the Client API pushes requests onto the Server WebService, which inturn pushes them onto the Server Remoting Listener / Application.
So as an example the Client API exposes a DoSomething method which calls the DoSomething web service method, which calls the DoSomething Server Remoting Listener / Application method, the return value of which is returned back up the tree.
In order to maintain a degree of control (and for remoting) all of these components use a common interface, i.e.
public interface IFrameworkMethods
{
int DoSomething();
}
The reason for all these degrees of seperation is that typically all three components are on different devices to split the load across the enterprise. For reasons of policy connectivity from client to server farm must be across HTTP however within the farm I can use remoting. All decisions that cannot be changed.
Now heres the question:
Under some configurations the Client API and Server Remoting Listener / Application are on the same device. As such it seems sensible to not take the performance hit of performing a HTTP post to localhost, and to push the requests directly onto the local listener.
In the first run of the code, I simply did something like this:
public int DoSomething()
{
int resultCode = 0;
if (directRemotingAvailable)
{
resultCode = remotingObject.DoSomething();
}
else
{
resultCode = webServiceObject.DoSomething();
}
return resultCode;
}
This obviously works, but this API exposes alot of methods so it is alot of if/else and bloat. Which got me thinking, I am using the interface for remoting, so why not use the interface defintion for the webservice as well.
So my Client API method now looks something like this:
public int DoSomething()
{
IFrameworkMethods obj = GetInterface();
int resultCode = obj.DoSomething();
}
private IFrameworkMethods GetInterface()
{
IFrameworkMethods obj = null;
if (configIsRemoting)
{
}
else
{
FrameworkMethodsWebService ws = new FrameworkMethodsWebService()
}
}
As you may have seen the problem I have surrounds the fact that I cannot cast/convert an instance of the FrameworkMethodsWebService to an interface of IFrameworkMethods . Which is fair enough, at the end of the day, they are entirely different objects.
So the question is based on this architecture can this be done somehow? and if so please prod me in the right direction.
-- modified at 11:54 Friday 12th October, 2007
|
|
|
|
|
MrEyes wrote: Is it possible to cast an instance of a WebService reference to an custom interface (the webservice contains the methods as defined in the interface)
What methods it exposes has nothing to do with what "type" it is. You can only cast an object to a type that it is or implements in the case of interfaces, period.
I strongly urge you to study software development material until you gain a more comprehensive understanding of fundamental concepts like this one before you develop production software.
|
|
|
|
|
led mike wrote: I strongly urge you to study software development material until you gain a more comprehensive understanding of fundamental concepts like this one before you develop production software.
Great piece of advice, however serves absolutely no purpose beyond hobbiests, classrooms and virgin standalone projects. When working in the real world of a preexisting production application framework that is currently deployed to around a 15 thousand servers, over a 200 thousand clients and has prooved to be extremely reliable and profitable, I find that rewriting and redeploying is, shall we say, a tad stupid.
There are many ways to meet a development challenge, unforutunalty many professional developers loose sight of the fact that they exist to serve end users not their own foibles and technical curiosity. As long as the result meets requirements and specifications and is supportable, usable, maintainable and scalable; I absolutley don't care if its architecture doesnt meet the current flavour of the day.
Bottom line, rant over, I have found a solution, it works.
Of to read some books, maybe, hmmm, The very Hungry Caterpillar
P.S. For anybody who is interested the solution is to create a wrapper around the webservice object that also uses the interface. When the WS interface is needed the main worker class creates/reuses an instance of the WS wrapper/proxy that can now be cast to the interface type and called using the same code that calls the remoting interface. Logic must exist within the wrapper/proxy to set initial params (i.e. url, timeout etc)
|
|
|
|
|
MrEyes wrote: P.S. For anybody who is interested the solution is
So the solution wasn't casting the WebService object to the interface because of what I stated, right?
MrEyes wrote: Bottom line, rant over
MrEyes wrote: I absolutley don't care if its architecture doesnt meet the current flavour of the day.
What did my post have to do with architecture?
|
|
|
|
|
I just installed VS 2005 on my Vista Machine and when the project runs it doesn't allow me to break point. Inside visual studios it is sitting ready to be run again. Does anyone know how I can get get the debugger to work. Thanks a million.
|
|
|
|
|