|
The class library is part of our proprietary web engine. My tool sits on top of it managing the externalized data that creates the web pages.
The dll is loaded locally -- I'm not doing anything kinky like over a remote connection. I listed in this thread how I'm doing my call to get the methods of the particular type.
I did not fiddle with the .NET security config since all of the documentation points to just what I have to execute in my code. I am fiddling with ReflectionPermission to Assert() the correct security. However I am also doing this on a tightly managed enterprise developer machine. However I do not think that this is a problem since (as stated earlier) Reflector displays the methods without problem. So I think it is just getting the ReflectionPermission set correctly. Here is the source that is trying to look at the DLL (fat client code) It loads each method as a node in a tree that has the parent nodes already created.
public PageLayoutEditor()
{
InitializeComponent();
commands.AllowDrop = true;
ReflectionPermission sec = new ReflectionPermission(ReflectionPermissionFlag.MemberAccess);
sec.Assert();
}
#region Windows Form Designer generated code
private void PageLayoutEditor_Load(object sender, System.EventArgs e)
{
try
{
string objectName = Path.Combine(@"C:\Inetpub\wwwroot\TCASampleApp\bin", "TCA.UI.dll");
Assembly container = Assembly.LoadFile(objectName);
Type widgetType = container.GetType("Progressive.TCA.Widgets.LayoutWidget");
Type layoutType = container.GetType("Progressive.TCA.LayoutManagers.TCACoreLayoutManager");
SetNames(objectView.Nodes[0], layoutType, "ProcessInstruction");
SetNames(objectView.Nodes[1], widgetType, "ProcessInstruction_");
}
catch (Exception se)
{
MessageBox.Show(this, "Problems were encountered getting the process instructions within the layout manager."
+ System.Environment.NewLine + se.Message);
}
finally
{
SetButtons(true);
actionsBar.Buttons[6].Enabled = ValidatedClipboard(Clipboard.GetDataObject());
}
}
private void SetNames(TreeNode parent, Type assembly, string LookFor)
{
MethodInfo[] items = assembly.GetMethods
(BindingFlags.Public|BindingFlags.Instance|BindingFlags.DeclaredOnly|BindingFlags.NonPublic|BindingFlags.Static);
SortedList names = new SortedList(items.Length);
foreach (MethodInfo item in items)
{
if (item.Name.StartsWith(LookFor))
{
string newItem = item.Name.Substring(LookFor.Length);
names.Add(newItem, newItem);
}
}
for (int i=0; i<names.Count; i++)
{
TreeNode newChild = new TreeNode((string)names.GetKey(i), 0, 0);
parent.Nodes.Add(newChild);
}
}
This signature left intentionally blank
|
|
|
|
|
|
I was trying different things. I guess after awhile I stopped paying attention to the BindingFlags !! Once I pulled that flag everything worked great.
Thanks lippie!
Michael
|
|
|
|
|
Hi all
I'm working with the FileInfo object.
Is there a way to get hold of the detailed attributes of a jpeg using this object?
Like if you right click on the jpeg in windows explorer - properties - summary: title, subject, author etc etc.
If not, are there any other ways?
Any ideas gratefully received
Steven
|
|
|
|
|
|
|
Cheers guys
The description property using the FileVersionInfo was returning an empty string for my jpgs, but the PropertyItems collection does the job great.
Thanks very much!
|
|
|
|
|
I'd like to store components in a TreeStructure and wanted to be able to design the TreeStructure within the designer. So I've made a Class Item which itself has a Collection ItemCollection (this is the same like TreeNode which has itself a TreeNodeCollection).
This should work and it worked, but:
As I add my items and the subitems and want to save with "OK" there is the following error:
"Object not set to an instance of an Object" - this happens only, if I add Items to a level higher than two:
Item1
SubItem (OK)
SubItem (Error when saving)
Item2
Item3
...
I do not know which Object is null.
Can anyone help me with this problem?
Thank a lot!
Stefan
|
|
|
|
|
I know my answer is not what you expected, but if you have a IDE you can go step by step into the code and find out why it doesn`t work. Your problem may come form a bad code line, or a wrong condition.
I hope you understand...
|
|
|
|
|
Thank you for your answer.
I design the Collection in the Form-Designer, so Debugging is not possible.
The problem is that I cannot see what the Designer wants to code because the designer tries to put code and cannot because the code would be wrong, so I can't see what the designer want to write.
Thanks
Stefan
|
|
|
|
|
Hi Gurus!
I developing a C# asp.net application. I want my application write something to it's own event log, but when I trying
to do this I got folllowing error -
"Requested Registry Access Is Not Allowed" Error Message When ASP.NET Application Tries to Write New EventSource in the EventLog
I found some solutiong here - http://support.microsoft.com/?id=329291 but it not helps in my case... I have done all modifications to my code exactly like in former article, but I still recieve this error...
I hope someone could help me. Thanx.
xedom developers team
|
|
|
|
|
Alex Getman wrote:
I have done all modifications to my code exactly like in former article, but I still recieve this error...
Its not a code-alone fix. The registry entry needs to be create on the machine with a user with sufficient priviliges.
Alex Getman wrote:
xedom developers team
403: Forbidden
top secret xacc-ide 0.0.1
|
|
|
|
|
1.
So if I understood you right - there is no solution exists for my problem throught code tricks?
2. I know. It's all about money
xedom developers team
|
|
|
|
|
Alex Getman wrote:
there is no solution exists for my problem throught code tricks?
You have to have appropriate permissions to write to the registry, does that make sense?
- Nick Parker My Blog | My Articles
|
|
|
|
|
Well, yes, it does. All I need it's just to install my application and when an error occurs to write some entry to the EventLog. Is possible to do it in some way without manual registry tuning?
xedom developers team
|
|
|
|
|
Alex Getman wrote:
All I need it's just to install my application and when an error occurs to write some entry to the EventLog. Is possible to do it in some way without manual registry tuning?
You stated that your application was an ASP.NET application, which changes things. The question should be in the ASP.NET forum. You need to understand that your ASP.NET application is running under the ASPNET user account, which does not have appropriate privileges to create the event source. You can programmatically change the registry (to thus allow you to create the event source), however the account you are running as (ASPNET in your case) must have appropriate permissions to do so. Making changes to the registry is something that can be done with an install package, however the person installing the application also needs to have appropriate rights as well. Does that make sense?
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi,
I would add some labels to my form at run time. I want to delete a lebel, when I press del button.
Can we handle keydown/keyup/keypress event for a label ?? Is it possible ??
CNU
|
|
|
|
|
hi,
Here i have a form with a button control.I am trying to remove button on keydown event.
"Keys" enumeration will help you do find the possiblity of other key's. Here i am check only delete key.
private void button1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode==Keys.Delete)
this.Controls.Remove(button1);
}
this is a sample lead to achive your task. remaining is upto yop to develop
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
It is OK with a button control. But for a Label there is no key realted events defined. So, how can we handle keydown event??
CNU
|
|
|
|
|
Upto my leval best it won't recognize keypress/keydown/keyup . I think so other guru can help you out.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Exactly !! I too think the same.
Can we have a button control without border...means it looks like a label ??
I tried with FlatStyle property but invain.
CNU
|
|
|
|
|
hi,
override th paint event
And check for this.
private void button1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
e.Graphics
}
this property is very flexible and self explanatory
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I have done like this and it works well :
<br />
private void OnPaint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
System.Windows.Forms.Button btnMsg = (Button)sender;<br />
if(btnMsg == null) return;<br />
Rectangle borderRectangle = btnMsg.ClientRectangle;<br />
ControlPaint.DrawBorder(e.Graphics, borderRectangle, this.pnlHost.BackColor, System.Windows.Forms.ButtonBorderStyle.Solid); <br />
}<br />
Thanks a lot Sreejith !!
Cheers
CNU
|
|
|
|
|
hi,
your welcome.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
You could write your own class that inherits from Control giving you access to the KeyDown , KeyPress , and KeyUp events or you could simply override the WndProc , watch for the appropriate windows messages and act accordingly.
- Nick Parker My Blog | My Articles
|
|
|
|