Click here to Skip to main content
15,884,838 members
Home / Discussions / C#
   

C#

 
GeneralRe: How To Convert This From VB.Net Pin
Kevin Marois25-Jun-12 10:12
professionalKevin Marois25-Jun-12 10:12 
AnswerRe: How To Convert This From VB.Net Pin
Karthik Harve25-Jun-12 21:46
professionalKarthik Harve25-Jun-12 21:46 
Generaldefault textbox value Pin
vins2125-Jun-12 3:34
vins2125-Jun-12 3:34 
GeneralRe: default textbox value Pin
Pete O'Hanlon25-Jun-12 3:36
mvePete O'Hanlon25-Jun-12 3:36 
GeneralRe: default textbox value Pin
vins2125-Jun-12 3:53
vins2125-Jun-12 3:53 
AnswerRe: default textbox value Pin
Eddy Vluggen25-Jun-12 4:39
professionalEddy Vluggen25-Jun-12 4:39 
GeneralRe: default textbox value Pin
Sunil P V26-Jun-12 0:05
Sunil P V26-Jun-12 0:05 
QuestionHow to access the method from an Internal Class in a assembly/dll Pin
Rocky2325-Jun-12 2:30
Rocky2325-Jun-12 2:30 
Hi am using one dll in my application.

it is used to show popup for login.
In this popup there is a link for Change Password and Reset Password, but a method for this link is declared in internal class in that dll file.
This is the internal class in that dll.

C#
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace Satis.Client
{
    internal class AuthenticationForm : Form
    {
	private string _resetPasswordUrl;
		private string _changePasswordUrl;
		private string _application;
public string ResetPasswordUrl
		{
			set
			{
				this._resetPasswordUrl = value;
			}
		}
		public string ChangePasswordUrl
		{
			set
			{
				this._changePasswordUrl = value;
			}
		}
		public string Application
		{
			set
			{
				this._application = value;
			}
		}
private void _changePasswordLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			if (!string.IsNullOrEmpty(this._changePasswordUrl))
			{
				Process.Start(this._changePasswordUrl);
			}
		}
		private void _resetPasswordLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			if (!string.IsNullOrEmpty(this._resetPasswordUrl))
			{
				Process.Start(this._resetPasswordUrl);
			}
		}
    }



Here i can able to pass the value to this properties in AuthenticationForm class, but when i click on those link, it is not firing the event and this links are not opening,
Please find my code below.

XML
    public class RTFEauthentication
    {
               IAuthentication wrapper;
        string ChangePwd = "http://gmail.com";
        string ResetPwd = "http://microsoft.com";
        string appName = "LRM";
      
        public RTFEauthentication()
        {
            wrapper = new Authentication("*****************", "LRM", "UAT", "AUTH", "1.7.3", null);
            Authentication.ChangePasswordUrl = ChangePwd;
            Authentication.ResetPasswordUrl = ResetPwd;
        }
        
public string ChangePasswordURL
        {
            get
            {
                return ChangePwd;
            }
        }
        public string ResetPasswordURL
        {
            get
            {
                return ResetPwd;
            }
        }
        public string Application
        {
            get
            {
                return appName;
            }
        }
       
        public bool ValidateRTFE()
        {
            
            object formInstance = PrivateMethodAccessHelper.GetInstanceOfClass("Satis.Client",
                "Satis.Client.AuthenticationForm", new object[] { });
                        PrivateMethodAccessHelper.SetInstancePropertyValue(formInstance.GetType(),
                "ChangePasswordUrl", formInstance, ChangePasswordURL);
            PrivateMethodAccessHelper.SetInstancePropertyValue(formInstance.GetType(),
                "ResetPasswordUrl", formInstance, ResetPasswordURL);
            PrivateMethodAccessHelper.SetInstancePropertyValue(formInstance.GetType(),
                "Application", formInstance, Application);
                       PrivateMethodAccessHelper.SetInstanceFieldValue(wrapper.GetType(),
                "_form", wrapper, formInstance);
            
            IAuthenticationResult result = wrapper.AuthenticatePopup();
            if (result == null)
                return false;
            else
                return result.Succeeded;
                }
           }

public sealed class PrivateMethodAccessHelper
    {
        public static object GetInstanceOfClass(string assembly,
                   string fullyQualifiedName, params object[] contructorParams)
        {
            return Activator.CreateInstance(Type.GetType(fullyQualifiedName + "," + assembly), contructorParams);
        }

        /// <summary>
        /// Set value of the object member.
        /// </summary>
        public static void SetInstancePropertyValue(Type typ, string propName, object objInstance, object objValue)
        {
            PropertyInfo propInfo = typ.GetProperty(propName, BindingFlags.Default | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
            if (propInfo != null)
            {
                propInfo.SetValue(objInstance, objValue, null);
            }
        }

        /// <summary>
        /// Set value of the object member.
        /// </summary>
        public static void SetInstanceFieldValue(Type typ, string fieldName, object objInstance, object objValue)
        {
            FieldInfo fieldInfo = typ.GetField(fieldName, BindingFlags.Default | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
            if (fieldInfo != null)
            {
                fieldInfo.SetValue(objInstance, objValue);
            }
        }
    }


Could any one pls tell me what is the problem here and how to fix it.?
AnswerRe: How to access the method from an Internal Class in a assembly/dll Pin
BobJanova25-Jun-12 2:36
BobJanova25-Jun-12 2:36 
GeneralRe: How to access the method from an Internal Class in a assembly/dll Pin
Rocky2325-Jun-12 2:54
Rocky2325-Jun-12 2:54 
GeneralRe: How to access the method from an Internal Class in a assembly/dll Pin
BobJanova25-Jun-12 4:49
BobJanova25-Jun-12 4:49 
GeneralRe: How to access the method from an Internal Class in a assembly/dll Pin
Rocky2325-Jun-12 4:56
Rocky2325-Jun-12 4:56 
GeneralRe: How to access the method from an Internal Class in a assembly/dll Pin
BobJanova25-Jun-12 5:21
BobJanova25-Jun-12 5:21 
QuestionRe: How to access the method from an Internal Class in a assembly/dll Pin
Eddy Vluggen25-Jun-12 3:28
professionalEddy Vluggen25-Jun-12 3:28 
AnswerRe: How to access the method from an Internal Class in a assembly/dll Pin
Rocky2325-Jun-12 4:52
Rocky2325-Jun-12 4:52 
GeneralRe: How to access the method from an Internal Class in a assembly/dll Pin
Eddy Vluggen25-Jun-12 6:04
professionalEddy Vluggen25-Jun-12 6:04 
Questionhow to use desktop composition + C# Pin
jojoba201124-Jun-12 20:59
jojoba201124-Jun-12 20:59 
AnswerRe: how to use desktop composition + C# Pin
OriginalGriff24-Jun-12 21:10
mveOriginalGriff24-Jun-12 21:10 
AnswerRe: how to use desktop composition + C# Pin
OriginalGriff24-Jun-12 21:10
mveOriginalGriff24-Jun-12 21:10 
AnswerRe: how to use desktop composition + C# Pin
Midnight Ahri24-Jun-12 21:35
Midnight Ahri24-Jun-12 21:35 
AnswerRe: how to use desktop composition + C# Pin
Richard MacCutchan24-Jun-12 22:44
mveRichard MacCutchan24-Jun-12 22:44 
GeneralRe: how to use desktop composition + C# Pin
jojoba201125-Jun-12 4:26
jojoba201125-Jun-12 4:26 
GeneralRe: how to use desktop composition + C# Pin
Richard MacCutchan25-Jun-12 4:48
mveRichard MacCutchan25-Jun-12 4:48 
GeneralRe: how to use desktop composition + C# Pin
BobJanova25-Jun-12 4:52
BobJanova25-Jun-12 4:52 
GeneralRe: how to use desktop composition + C# Pin
jojoba201125-Jun-12 17:51
jojoba201125-Jun-12 17:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.