|
Are you still getting the same error message?
What does the code look like?
---
single minded; short sighted; long gone;
|
|
|
|
|
I run my application two times. The first time, WMP can't play the file, the message is the file is used by another application. But the second time, WMP can play it. I think may be the process of writing new file is not complete in the first time.
|
|
|
|
|
this may be bcz. u r not calling the close method of the streamreader class object (or whatever class u r using).
when u r finish with the file u must have to call the close method so that the file u r accessing is released
|
|
|
|
|
I have already closed Filestream.
|
|
|
|
|
You should paste the particular code so that we can be of better assistance.
I am fighting against the Universe...
Reference-Rick Cook
|
|
|
|
|
I'm sorry, I open and close file during my application, and i'm a newbie in C#, so my code is not clear.
|
|
|
|
|
Hi all. I've been Googling for a sample of using the Curve class in the XNA framework without much success. I'm looking to use curves for certain 2D sprite animation paths. Does anyone have a simple example of establishing a curve for use on an XNA 2D surface?
|
|
|
|
|
Have you seen MSDN's article[^] on how to make a camera follow a curve path?
|
|
|
|
|
Hi Judah. Thanks for that reply. Yes, I had read through that example a number of times before posting my question. It's really the only example of the Curve class I can find, but I struggled to understand it and how to apply the class in a 2D game. If you know of any other examples, I'd be much obliged.
|
|
|
|
|
I'm afraid I don't know of any others off-hand. I find a lot of the XNA questions in this forum go unanswered - have you tried asking this question in an XNA-specific forum, something on GameDev.net perhaps?
|
|
|
|
|
Judah Himango wrote: have you tried asking this question in an XNA-specific forum, something on GameDev.net perhaps
Thanks again, Judah. I'm new enough to XNA that I'm still trying to find good resources. I'll give GameDev.net a try.
|
|
|
|
|
Ditto, I'm a newb when it comes to XNA, but somewhat experienced in general game dev.
I was involved a bit in Managed DirectX before they deprecated all of it: there were some good MDX sites like mdxinfo.com and thezbuffer.com. I think those sites have adapted to XNA now, they might be useful. For general game development, gameDev.net and gamasutra.com are the two mainstream ones.
|
|
|
|
|
|
I asked this question last week, but with the high wheat/chaff ratio it probably got missed...
I've run into an FxCop warning that I'm having a difficult time understanding how to get around it (other than simply supressing the message).
I have a class that implements multiple interfaces. These interfaces are:
public interface IHistoryService
{
bool Supported { get; }
Document Document { get; }
}
public interface IValidationService
{
bool Supported { get; }
ReadOnlyCollection ValidationErrors { get; }
} Since the interfaces both define bool Supported { get; } , I need to implement them explicitly. It is possible that, given different internal states, the IHistoryService functionality might be supported while the IValidationService functionality isn't (or vice versa).
For the sake of simplicity, here is a much slimmed down version of my implemenation class:
public class DocumentViewer : Form, IHistoryService, IValidationService
{
bool IHistoryService.Supported
{
get { return true; }
}
bool IValidationService.Supported
{
get { return true; }
}
} When I run FxCop against this assembly, I get the following warning:CA1033 : Microsoft.Design : Make 'DocumentViewer' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'IDocumentInformationService.get_DocumentTemplateFullName():String' and is visible to derived classes. From the description on MSDN, it tells me:Consider a base type that explicitly implements a public interface method. A type that derives from the base type can only access the inherited interface method through a reference to the current instance (this in C#) that is cast to the interface. If the derived type re-implements (explicitly) the inherited interface method, the base implementation is no longer accessible. The call through the current instance reference will invoke the derived implementation; this results in recursion and an eventual stack overflow. So...I know I could implement
public bool Supported
{
get { return true; }
} which would satisfy the warning. The problem here is that this property doesn't make sense on the DocumentViewer, so it would be completely useless (other than to satisfy the warning).
How would I implement this so it satisfies the warning, or is this really even something to worry about?
|
|
|
|
|
I'm sure this won't help, but I'll put it out there. What if you just didn't have the Supported property?
If something doesn't support that interface, then just don't implement it on the object? Then, when you cast it to the interface, it just won't cast, thereby telling you that its not supported.
Granted, this assumes you do not have run time reasons for this property, but just wanted to throw that out there as a possibility.
As an aside, if FoxCop isn't telling you something you care to listen to, then..don't
|
|
|
|
|
Andrew Rissing wrote: What if you just didn't have the Supported property?
While this would work, it doesn't actually solve my problem. I need the interface implemented because the object in question always has the ability to provide those services but, because of internal state, might not support it at that moment in time.
Andrew Rissing wrote: As an aside, if FoxCop isn't telling you something you care to listen to, then..don't
I completely agree with you on this one and am actually ignoring the warning, but I still want to understand what it is really telling me and see if there is a "right" way to implement this.
|
|
|
|
|
Scott Dorman wrote: When I run FxCop against this assembly, I get the following warning:
CA1033 : Microsoft.Design : Make 'DocumentViewer' sealed
Can't you do that?
---
single minded; short sighted; long gone;
|
|
|
|
|
Yes, I can seal the class but I was trying to avoid doing that. I don't like sealing classes for what can only be termed an arbitrary reason.
|
|
|
|
|
I've had this one before, and frankly, I don't think it really is a problem. It seems to be a problem only if
1) you've got a class derived from DocumentViewer
and
2) that class needs to implement IDocumentInformationService outside of DocumentViewer's implementation.
I think that's a rare case to say the least. (I could be misunderstanding FxCop's warning, but that's my take on it.)
Perhaps one way to fix this is to create a protected method that exposes the functionality of DocumentTemplateFullName. Then this warning can essentially go away: either FxCop will be smart enough to recognize this, or you'd just throw a SurpressMessageAttribute on the DocumentViewer class.
|
|
|
|
|
I think you're right in that it will probably be a rare case where something does need to derive from DocumentViewer and needs to implement IDocumentInformationService itself. I may just go ahead and seal the class (as Guffa suggested) or add some SupressMessage attributes.
|
|
|
|
|
Hey,
I currently have a datagrid that is displaying items in an inventory. The user is able to modify inventory contents, and then there is a button to save the changes back to the SQL database.
What I would like to implement is something that will change the color of each row that the user has updated.
How do i do that? Need help ASAP.....
Im using C# with visual studio 2005
|
|
|
|
|
i think u cant get the changed rows from the datagrid.
u have to work with dataset
anyway may be the following link help u out
http://www.gridviewguy.com/ArticleDetails.aspx?articleID=92
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/thc1eetk(VS.80).aspx
|
|
|
|
|
Hello!
I have an interesting idea, I would like to read through a 24 bit JPEG image and determine the amount of a color is in the image. In this case I would like to analyze just how much red is in an image based on how many of the pixels are mostly red and return a value based on how many pixels are mostly red.
I need it to be fairly quick (~ 1 second) so I know that locking the bitmap and using unsafe code is the way to go. The problem is that I am having a hard time figuring out how to get the pixel data I want to get using the unsafe code method. I know that with the GetPixel method, it would be something like:
for (int h = 0; h < bmp.Height; h++)
{
for (int w = 0; w < bmp.Width; w++)
{
Color pixelColor = bmp.GetPixel(w, h);
int red = pixelColor.R;
int green = pixelColor.G;
int blue = pixelColor.B;
sumred += red;
How do I do this same procedure using the unsafe/locked bitmap method? Also, how do I do the logic/math to determine from this the amount of red data in the image?
Thank you in advance!!
Mike
|
|
|
|
|
Read my image processing articles. Basically, the bytes are laid out BGR, and there's a padding at the end of each scanline that you have to skip, which makes it WORD aligned.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|