|
Hi all,
I am writing a software that allow dynamic pluging of additional components
(dlls) into the major system by C# on .Net. in runtime.
I want to ask for runtime, can I plug c# classes instead of dll into the main program ? Why I asked this is that I found to dynamic plugging many
small units into the main program, if these units are in form of dll, this
will require long long time to compile in VS.Net(as there are many projects by the dlls).
Or in other view, can I inject c# classes in a dll dynamically in runtime ?
Thanks
|
|
|
|
|
Dear Sir. or Miss,
Now I like to use C# program to modify tnsnames.ora content using
the related methods provided by system lib.
For example, after a client accepts the related values , such as
"zgafc", "109.52.8.8", "1521" and "db.source", then the client can modify (or insert) the file "tnsnames.ora", as following :
ZGAFC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 109.52.8.8)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = db.source)
)
)
then the client can access the db by "zgafc" in client program.
that's to say, if the client just install the oracle client, and do not
config the source in client, however, it can access the appointed database
after the client accept the values related to connection.
If we can find the methods, we can create the database source in client by program, rather than config the datasource in client by manual.
|
|
|
|
|
hi,
i want to know any method to implement #define similar thing in C#. i need to declare some const like below in C++
#define STATUS_A 'a'
currently, i used
public const char STATUS_A = 'a';
or
enum STATUS
{
A = 'a';
}
apart from above methods, any other method?
thanks,
jim
|
|
|
|
|
You already found it. C# doesn't support compiler directives.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Not quite.
You can use defines in C# as well, although not exactly like in C/C++.
You _can_ define symbols at the very beginning of a C# file (before any using directives) or in the project settings in VS.NET.
In your code you can use #if, #elif, #else and #endif and some other preprocessor directives to compile or not compile part of your code, depending on the symbols you define. MSDN has a list:
C# preprocessor directives[^]
Regards,
mav
|
|
|
|
|
My bad! :-> I could have sworn that it didn't. This topic came up before about 6 months ago and I thought that was what the answer was.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello..
i want to use checkbox in datagrid and i want to check all and get all selected columns?
and also want to change selected column background..
tell anybody what is the procedure?
|
|
|
|
|
I'm looking for a way to delete a single XmlElement from a document.
I'm using the following to add an element:
<br />
XmlNode node = KatalogForm.configDoc.DocumentElement.SelectSingleNode("categories");<br />
<br />
XmlElement newCat = KatalogForm.configDoc.CreateElement("category");<br />
newCat.InnerText = addNewCategoryTextEdit.Text;<br />
node.InsertAfter(newCat, node.LastChild);<br />
KatalogForm.configDoc.Save("katalog.config");<br />
But I can't find a comparable RemoveElement() or DeleteElement() or some other XmlDocument member method.
Does anyone have any ideas?
thanks all
|
|
|
|
|
|
ok makes sense, but I need to delete the element who has a specific value, for instance, the line in the xml file contraining the value comboBox.SelectedItem. The format of the xml file looks something like
<configuration>
<categories>
<category> blah 1 </category>
<category> blah 2 </category>
</categories>
</configureation>
so I can't just RemoveChild based on the node name.
|
|
|
|
|
So you'll have to develop a algorithm that searches your XmlDocument for the nodes that match your criteria. This shouldn't be too hard
Everytime you found one, delete it with following cde snippet:
XmlNode nodeToDelete, parentNode;
parentNode = nodeToDelete.ParentNode;
parentNode.RemoveChild(nodeToDelete);
www.troschuetz.de
|
|
|
|
|
ok hehe, thanks a lot for your help.
I'm thinking I need to something to the effect of:
<br />
if(node.InnerText == ComboBox.SelectedItem)<br />
{<br />
}<br />
|
|
|
|
|
|
ok so I've done some thinking about this and here's what I've come up with. The XML file followed by Psuedo code followed by the code.
XML FIle:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<categories>
<category>Operating System</category>
<category>Productivity</category>
<category>Entertainment</category>
<category>Games</category>
<category>Misc.</category>
</categories>
<disk_numbers>
<disk>001</disk>
<disk>002</disk>
<disk>003</disk>
</disk_numbers>
</configuration>
Psuedo Code:
start in parent node "categories"
for each child node it has named "category"
check if innerText is equal to the selected item in the combo box
if it is
remove the child node
if it isn't
go to the next child node
during one pass through the child nodes this can never fail since the combo box item wouldn't be
listed if it wasn't in the file
Code:
private void mainToolbarRemoveCategoryButton_ItemClick(object sender,
DevExpress.XtraBars.ItemClickEventArgs e)
{
XmlNode parentNode = configDoc.SelectSingleNode("/configuration/categories");
if(MessageBox.Show("Are you sure?", "Katalog", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation) == DialogResult.No)
{
return;
}
else
{
foreach(XmlNode n in parentNode)
{
if(n.InnerText.ToString() == programCategoryComboBoxEdit.SelectedItem.ToString())
{
try
{
parentNode = n.ParentNode;
parentNode.RemoveChild(n);
configDoc.Save("katalog.config");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
So hopefully it's obvious what I'm trying to do, I guess the foreach loop is where the issue is, is this how I would traverse each child node?
thanks!
|
|
|
|
|
you should use the removeChild(xmlNode) method of xmlDocument or xmlNode
|
|
|
|
|
Evertime i try i get this exception.
System.InvalidOperationException: There was an error reflecting type 'serialize.UserControl1'. ---> System.NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface.
|
|
|
|
|
not everything in dot net is serializable you should be able to find info on what is and isnt on msdn
|
|
|
|
|
Serializing an UI control directly doesn't make sense. Better aproach is to put all your data in a simpler data structure like dataset or array.
No one ever became great by imitation.
Samuel Johnson (1709-1784)
|
|
|
|
|
Well i was thinking for the sake of recreating bugs that happen on other peoples computers, how cool it would be to recreate the environment as much as possible.
Also i got another weird problem. After making functions to serialize and deserialize a test class i made...I decided to make that class extend control because i figured, the error messages only told me this in an inner exception:
<codecannot serialize="" member="" system.componentmodel.component.site="" of="" type="" system.componentmodel.isite="" because="" it="" is="" an="" interface.="">
So i did this to smack the xmlignore property on their:
[XmlIgnore]<br />
public override ISite Site<br />
{<br />
get<br />
{<br />
return base.Site;<br />
}<br />
set<br />
{<br />
base.Site = value;<br />
}<br />
}
and the exception message is unchanged.
|
|
|
|
|
Well i was thinking for the sake of recreating bugs that happen on other peoples computers, how cool it would be to recreate the environment as much as possible.
Also i got another weird problem. After making functions to serialize and deserialize a test class i made...I decided to make that class extend control because i figured, the error messages only told me this in an inner exception:
Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface.
So i did this to smack the xmlignore property on their:
[XmlIgnore]<br />
public override ISite Site<br />
{<br />
get<br />
{<br />
return base.Site;<br />
}<br />
set<br />
{<br />
base.Site = value;<br />
}<br />
}
and the exception message is unchanged.
|
|
|
|
|
Arg! i tried overrided every public member in control and putting the [XmlIgnore] tag on them, and same error message...
|
|
|
|
|
I am trying to create a form that needs to do some fast rendering (simple frequent resize, move, transparency). As far as I know GDI+ is not hardware accelerated, and it is PAINFULLY slow. I gave up trying to use double buffering and other methods of "improving" performance of GDI+.
Is there a way that I can create a form using hardware accelerated GDI(no plus) and handle its events?
I have a very simple form: full screen 50% transparent main form and a panel on it that is rapidly resized and moved about using the mouse. Doesn't seem like a tough task for a modern computer, but GDI+ is simply choking on this.
Any info/help/suggestions are greatly appreciated.
Thank you.
|
|
|
|
|
Hardware acceleration == DirectX. GDI isn't going to do it any faster - why would it ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I already got it to work using API calls and is A LOT faster.
Version 1.0 of GDI+ is very slow since its not hardware accelerated. GDI+ currently uses the cpu to perform its operations and no amount of double buffering techniques can stop graphics (or simple controls in my case) from severely flickering when moved about or resized.
|
|
|
|
|
I realise we are supposed to open and close database connections when required rather than leaving a connection open but doing so kills the performance of my app which is a high speed database analysis tool. I do a lot of ExecuteScalar and ExecuteReader statements and opening and closing the connection every time seriously impacts the performance. Is there something I am unware of to make it faster?
|
|
|
|