|
My Popup app is written in C#
|
|
|
|
|
|
I have two release configurations set up in which one has an additional symbol defined so that I can do conditional compilation for each configuration. However, one doesn't need a reference to the 3rd party library, while the other does. When I try to remove the reference in one configuration, it removes the reference in both. Is this possible, or am I doing something wrong?
My articles
BlackDice
|
|
|
|
|
Yes, You have to have the reference in your project. There is no way to remove the reference for just one configuration.
What you can do is, in the properties of the project, select the type of configuration(debug, release, etc what ever you defined) and go to "configuration properties". Then in the configuration in which you need the reference, go to "Build" category add another condition compilation constant eg: "CLASS_LIBRARY"
Modify your code for the using statement.
Only for the reference object do this.
#if CLASS_LIBRARY
using addyourreference;
#endif
This will add your reference conditionally.
|
|
|
|
|
I'm trying something new, but not quite sure how to do it. I have a class for modeling data that contains three types of data - persistant data, data that is semi-persistant, and data that is updated constantly. I would like to have each defined in a struct defined inside my data model class, like so: (This is obviously incorrect syntax, but I can't figure out how do it correctly)
<br />
public class DataModel<br />
{<br />
<br />
private struct PersistantData<br />
{<br />
int m_int1;<br />
int m_int2;<br />
}m_PersistantData;
<br />
private struct SemiPersistantData<br />
{<br />
int m_int3;<br />
int m_int4;<br />
}m_SemiPersistantData;<br />
<br />
private struct DynamicData<br />
{<br />
int m_int5;<br />
int m_int6;<br />
}<br />
<br />
public UpdatePersistantData(int int1, int int2)<br />
{<br />
m_PersistantData.m_int1 = int1;<br />
m_PersistantData.m_int2 = int2;<br />
}<br />
<br />
...<br />
}<br />
Obviously, thats not the actual program, but it shows how I would like to declare and use the structs. Is this possible?
|
|
|
|
|
I am curious as to why you want to declare the structs inside the class.
|
|
|
|
|
Plainly because they are for use only by the class, in it's internal workings.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
budidharma wrote: private struct PersistantData
{
int m_int1;
int m_int2;
}m_PersistantData; // I WOULD LIKE TO DEFINE AND INSTANTIATE THE STRUCT RIGHT HERE, INSIDE THE CLASS. IS THIS POSSIBLE?
You're doing two things at once.
private struct PersistantData
{
int m_int1;
int m_int2;
}
PersistantData m_PersistantData;
One more thing, unlike C++, C# structs have default access as private, so you'd need to make these int's public if you wanted to use them for anything
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks. I knew I could declare them like that, which is the way it's currently written, I was hoping for a shortcut to define and declare a single instance, since each class simply needs a single instance of each. Not necessary, just a little elegant.
And of course, you're correct - they are ONLY used within the internal structure of the class. I'm simply separating the data into catagories that they belong in.
|
|
|
|
|
You can't declare a struct inside a class, the same way you can't declare a struct inside a struct or a class inside a class.
---
b { font-weight: normal; }
|
|
|
|
|
You can declare classes and structs inside classes, as well as classes and structs inside structs.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Oh, you are absolutely right. Sorry about that.
---
b { font-weight: normal; }
|
|
|
|
|
... Yes, you can definately declare a struct inside a class.
|
|
|
|
|
Yes, S. Senthil Kumar already pointed that out.
---
b { font-weight: normal; }
|
|
|
|
|
I am trying to convert a picturebox into an ICO. I found out that it is a known bug that the ImageFormat.Icon does not encode the image correctly. Using this article: http://www.codeproject.com/dotnet/MultiIcon.asp I know how to encode the icon, the only problem is, that I need to get the image's raw bytes to write to the image. Does anybody have any idea how to do this or a better way to convert an image or png to an ico?
JGA
|
|
|
|
|
Hi there,
jgallen23 wrote: I found out that it is a known bug that the ImageFormat.Icon does not encode the image correctly
You might take a look on this article to get the solution
Icon
jgallen23 wrote: png to an ico
also take a look on this
Png2Icon
<< >>
|
|
|
|
|
enjoycrack wrote: You might take a look on this article to get the solution
Icon
here's are the problems with that article:
The source Bitmap must use PixelFormat.Format24BppRgb
The source Bitmap must use at most 256 colors
The source Bitmap must be 16x16 pixels
The target Icon must be 16x16 pixels
The pixel in the lower left corner (0, 15) is used to determine the transparency color
JGA
|
|
|
|
|
Hi
I am trying to design the Help feature, consisting of the tree view in one pain, and the explanation in the other, separated by a spliter. How can I create an HTML file, and how can I bind it to the explanation section? Do I use, textbox, etc...? Any help would be very valuable.
Thank you.
|
|
|
|
|
Hi all,
Im looking for a way (.net or not) to monitor file access and permit access to certain application to it...
I want to be able to get an event saying (this file) tries to do "this" to this file
Acess - Deny
Thanks
|
|
|
|
|
Please be more specific. Your problem is not really clear to understand. Or try to give an example of what you are looking for. That will help.
|
|
|
|
|
Something like Zone alarm
process XXX is trying to modify file (*.txt)
Allow / Deny
Be able to get every application that try to access a file
and
have the possibility to allow it to access it or not.
|
|
|
|
|
To do something like that, you have to hook into some pretty low-level system API's. Usually, such hooks require a windows driver to be written (most firewalls use kernel-level drivers with high priority to accomplish the task of allow/deny). If you try to do this at a higher level than kernel, people will easily be able to get by your app by writing their own kernel-level driver. I'd give you some examples, but its been years since I did anything like this, and I never got too deep into the theory anyway. So its a little beyond my league.
|
|
|
|
|
Hi all,
I have several config files in my application. In my app.config file, I currently have some entries that look like this:
<configurationsections>
<configurationsection name="options" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="options.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
<configurationsection name="state" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="state.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
<configurationsection name="main" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="main.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
I would like to encrypt the main.config file in this example. I noticed that there is an encrypt="false" there. If I would like to encrypt it, how would I do that? I don't see anywhere where I can specify a password. Also, I would somehow have to get my existing decrypted main.config file in the new encrypted format. How would I do that?
Thanks a lot for your help!
|
|
|
|
|
Oops, looks like my xml tags got encoded as html tags and aren't visible. Well, essentially what I put there was the config file configuration section.
Again, thanks for your help!
|
|
|
|
|
You can use Microsoft Enterprise Library Configuration block to encrypt the config file. For details you can go to MSDN and search for Enterprise library configuration block or just google it. There will be tons of examples.
Thanks
|
|
|
|