|
ReSharper is an add-in for Microsoft Visual Studio .NET 2003™ that brings intelligent C# coding assistance, real-time error highlighting and quick fixing, and advanced refactoring features to this popular development platform.
ReSharper provides C# developers with many of the same powerful productivity-boosting capabilities that thousands of Java™ developers worldwide have come to rely on every day with IntelliJ IDEA.
To learn more check out: http://www.jetbrains.com/resharper
|
|
|
|
|
before you try that tool , please see
http://www.codeproject.com/lounge.asp?msg=889398#xx889398xx[^]
(for your own sake)
some other small notes about the addin
it increases loading time for your projects with , well lets say 5000% or so
and the template system is nothing compared to the "quickcode" addin (the only addin i personally use nowdays)
//Roger
|
|
|
|
|
Hi people,
Intro:
The modem on the server is init'ed to pickup the line after first RING (ATS0=1). Another modem calls, performs some actions, informs the server that it is going to disconnect, and disconnects.
After the server has received the info msg about disconnect, it sends "+++ATH" to the modem and waits for "NO CARRIER". After that it re-opens the connection with the COM port, re-init'ing the modem.
No TAPI here, just plain AT commands.
The problem:
The disconnection scenario works for some modems, and doesn't for others. The server application hangs up while waiting for "NO CARRER", i.e it never receives this message. Incoming calls are not handled at this moment.
The qustion:
What is the correct way to re-open the connection with the modem, successfully hanging up the connection?
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
And this has to do with C# or even .NET how? It's not a problem with whatever language/framework/platform you use, but a problem with modem commands and should be asked in an appropriate forum (and CodeProject might not be the best place for more hardware-related questions).
To note, however, not all modems work the same. Win-modems (software-driven piles of rubbish) and firmware modems do work rather differently, and some modems may work differently than their counterparts (perhaps even by the same manufacturer). These are usually minor differences, but that could be your problem here.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
Heath Stewart wrote:
And this has to do with C# or even .NET how?
The application is written in C# and .NET. Also, a number of people (you being the 1st) have quite an experience in many fields, so I was hoping I can get a professional answer here in this very forum. Moreover, I do know about modem differences. I'm just stuck with this problem for the last 3 days. I tried quite a number of aproaches, but with now result.
Just thought somebody here has met the same challenge.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Serge Lobko-Lobanovsky wrote:
The application is written in C# and .NET.
Like I said in my previous post, this doesn't matter. Whether you wrote it in C# (or any other language targeting the CLR), C, C++, Perl, or any other language, the problem would be the same. This forum is for C# questions. Even ASP.NET questions written in C# (that have to do with ASP.NET issues) are redirected to the ASP.NET forum (it's more specialized).
You may have a slight chance of finding the answer here, but you'll have a much better chance by using google to find some modem forums, mail lists, or newsgroups. You'll have much better success there.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You may need a comma after the "+++" Escape Sequence command. Many modems expect a pause at this point. Each modem manufacturer interprets the AT commands somewhat differently and it is sometimes difficult to find a command that will work for all modems.
I recommend that you perform a Google search using terms like: "AT Command", Reset, Escape, and DTR.
If you know the manufacturer of the modem chipset (like Rockwell or U.S. Robotics) you can go to their website and get the AT Command Document that explains exactly how their AT Commands work.
For your purposes it may be better to reset the modem by dropping DTR (requires certain state set by AT&D command), but is takes less time. (Check me on that.)
Regards,
|
|
|
|
|
I'm looking for a way to force an open dialog to display the files in thumbnail view.
Is there a way to do this? I guess that is something you can set for each individual folder
when browsing in an explorer window (which is what the open dialog uses, isn't it?).
But is there a way to set this programmatically? And for every all folders?
I need it for opening images and it would be nice to get the thumbnail functionality so easy...
|
|
|
|
|
I want to call the bellow function every time the content(NOT ONLY THE COLOR) of richTextBox change
void rTBOnContentChanged(.....)<br />
{<br />
....................<br />
....................<br />
....................<br />
}
|
|
|
|
|
|
I thought to use the event TextChanged, detaching and attaching again(durring color changes)
Any other better idea ?
void rTBOnContentChanged(.....) <br />
{ <br />
.................... <br />
.................... <br />
rTB.TextChanged -= new EventHandler(rTBOnContentChanged) <br />
.................... <br />
rTB.TextChanged += new EventHandler(rTBOnContentChanged) <br />
}
|
|
|
|
|
That code would load the processor tremendously. The TextChanged event is fired very often and attaching and detaching event handlers is expensive.
Instead of doing that, just use a state variable. In your handler (and why are you using the same handler which would make changes to the text, thus calling the handler again in a loop), just check if a state variable (herhaps a bool ) is set or unset (true and false , respectively). When you change the color, set the state variable, when you're done making changes, reset it. The handler would check the state of this variable and conditionally execute.
State variables are used everywhere in some form or fashion, and would be best to use here.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you very much Heath Stewart.
|
|
|
|
|
Hello,
I'm trying to solve the following. I've got a couple of say Books, Videos, Magazines. The classes are contained in various collections (derived from CollectionBase, but this is actually not importand). Now I'd like to go and write a generic Loader, which will populate a Listview Control with the items in a Collection. E.g. we'd like to load the BooksCollection. Since I'm having not only three Element-Classes, but say 50, I don't want to write a Loader for each class on its own. I'd rather like to check what kind of public fields the class has got and add the appropriate columns and values to the Listview. Question is, how can I retrieve the public fields of a class at runtime. I guess it has got something to do with reflection, but this is like a big wide desert to me. Any starting point?
Thanks in advance,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
Start by reading Discoverying Type Information at Runtime[^] in the .NET Framework SDK.
If I were you, however, write a little more elegant solution (still using either reflection or the ComponentModel, which is a little easier to use - see the class documentation for the TypeDescriptor for a starting point). Derive all your collections from a single base class (perhaps CollectionBase or some other base class that exposes a common base class for all your objects, which might define common properties - don't use fields - like ID and Name , for example).
Also define an Attribute -derived class for fields you want to be mapped to columns (perhaps with an optional column heading for better control) like so:
[AttributeUsage(AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{
string heading;
public ColumnAttribute()
{
}
public ColumnAttribute(string heading)
{
this.heading = heading;
}
public string Heading
{
get { return this.heading; }
}
} As you're enumerating properties, only show properties attributed with that attribute in the ListView , optionally using the Heading for the actual heading text (in case the property name to heading name mapping wasn't the same). You could even define some sort of order with the attribute for additional layout capabilities.
This would be attributed on properties of the objects being collected, however. The collection is rather moot (you could have one that just accepts the base class of all the other types, for example).
As far as loading this information, that really depends on what you're loading it from. The collection could be written as a smart class that knows which types to create based on the information presented to it (the navigational tree in our flag ship product works this way). You could go a step further and use a provider pattern to modularize how that information is obtained (having ADO.NET clients to get it from a database, XML Serialization providers, etc.).
XML Serialization may also be a good idea to use. Read XML and SOAP Serialization[^] in the .NET Framework SDK for more information (you can ignore the SOAP information, as that commonly applies to Web Services and .NET Remoting and is just a particular grammar of XML).
There's a lot of things you could do, but it's important you understand the concept of polymorphism: types deriving from other types that can override some information, basically. Implementing a good object model can save you a lot of time and create a more elegant solution that is easier to change, extend, and understand.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
thats more then I've dreamed to expect. Thanks a lot for your explanation. In the meantime, I have been writing some test-code which uses Reflection (no Attributes, I will think about this later on) to determine the type of items in the collection and the properties of them. It all works fine. My problem now is, that i'd like to access the value of a property of a given instance. Say I know that Car has a property MaxSpeed (because I've been using the Type.GetProperties() method). How can I access an instance' values if I only have the PropertyInfo?
Thanks again, be sure to get my 5!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
Type.GetProperty returns a PropertyInfo , which defines a GetValue method. You pass this the instance of the object you're reflecting (or null for a static property) and either null for the second param (depending on which overload you call) or an object[] array for an indexer (the only property type that can accept arguments):
Button b = new Button();
b.Text = "Click me";
PropertyInfo prop = b.GetType().GetProperty("Text");
string text = prop.GetValue(b, null);
Console.WriteLine(text); I recommend looking at the System.Reflection namespace member documentation. I also recommend you take a look at System.ComponentModel . Using the ComponentModel encapsulates reflection in a way that's easier to use and design-time friendly (if applicable to what you're doing).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hy everyone!
I know it is possible to access any folder in Outlook via MAPI but I do want to check if the opend folder is lets say the Inbox folder.
Or is it possible to check if an item (e.g. a contact item) was selected?
Because I do want my button to be only selectable/clickable when one of those match. Meaning when any other folder is open then the button should appear grayed out.
Thanks!
Stephan.
|
|
|
|
|
I'm not sure what method of MAPI you are using but
Stephan Wright wrote:
I know it is possible to access any folder in Outlook via MAPI but I do want to check if the opend folder is lets say the Inbox folder.
This is stored in the PR_CONTAINER_CLASS property.
Stephan Wright wrote:
Or is it possible to check if an item (e.g. a contact item) was selected?
PR_MESSAGE_CLASS property identifies the type. A contact is IPM.Contact or occasionally IPM.Contact.SBE
Michael
CP Blog [^]
|
|
|
|
|
thanks for the hint but I do still have two questions:
1) Where is this PR_CONTAINER_CLASS located in? Because I can't find it
2) Together with this class: Is it possible to send the data to an application via argument that way or am I just able to check if it is this type. Or is it possible to assign it somewhere?
meaning is it something like
if(item.type==IPM.contact.SBE)
.....
or do I get access (a pointer?) to the object to use it for something else?
Thanks!
Stephan.
|
|
|
|
|
What method are you using to access the MAPI data?
I'm only familiar with using Extended MAPI via C++. PR_CONTAINER_CLASS is a property of the MapiFolder data. It isn't a class, its a defintion for the mapi property id.
Michael
CP Blog [^]
|
|
|
|
|
the way I get there is
new application of Outlook then namespace of MAPI
By the way: My programminglanguage is C# in Visual Studio, but well it should be all the same in Visual Studio!
Stephan.
|
|
|
|
|
Ok. You are using the Outlook object model. Sorry, for leading you down the wrong path.
If you have a MapiFolder object then you can use GetDefaultItemType() method to get the type of items in the folder.
I can't remember all the values but a google for Outlook GetDefaultItemType should return some more details.
Michael
CP Blog [^]
|
|
|
|
|
hi,
I'm developing a mediaplayer, and I need to disable the screensaver and the poweroff functions while playing a video file.
on msdn I found that I have to use the SystemParametersInfo[^] function.
This code works only partially: the screensaver is disabled, but the monitor is still switched off by the system.
[DllImport("user32.dll")]<br />
private static extern bool SystemParametersInfo<br />
(<br />
uint action,<br />
uint param,<br />
object data,<br />
uint winini<br />
);<br />
<br />
private const int SPI_SETSCREENSAVEACTIVE = 0x0011;
private const int SPI_SETPOWEROFFACTIVE = 0x0056;
<br />
private void someMethod()<br />
{<br />
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, null, 0); <br />
<br />
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, null, 0);<br />
}
what's wrong?
thank you
________
http://www.jockersoft.altervista.org
|
|
|
|
|
|