Click here to Skip to main content
15,914,252 members
Home / Discussions / C#
   

C#

 
GeneralRe: face detection problem Pin
Adam R Harris26-Oct-10 11:11
Adam R Harris26-Oct-10 11:11 
GeneralRe: face detection problem Pin
inayathussaintoori26-Oct-10 11:33
inayathussaintoori26-Oct-10 11:33 
GeneralRe: face detection problem Pin
Adam R Harris26-Oct-10 11:36
Adam R Harris26-Oct-10 11:36 
GeneralRe: face detection problem Pin
inayathussaintoori26-Oct-10 11:41
inayathussaintoori26-Oct-10 11:41 
GeneralRe: face detection problem Pin
Adam R Harris26-Oct-10 11:50
Adam R Harris26-Oct-10 11:50 
GeneralRe: face detection problem Pin
inayathussaintoori26-Oct-10 12:32
inayathussaintoori26-Oct-10 12:32 
GeneralRe: face detection problem Pin
Richard MacCutchan26-Oct-10 12:08
mveRichard MacCutchan26-Oct-10 12:08 
QuestionDynamic Reference With Inheritence Pin
Adam R Harris26-Oct-10 6:07
Adam R Harris26-Oct-10 6:07 
Hey All,

I posted yesterday about dynamic reference and attaching to the AssemblyResolve event. The suggested solution i received is/was great however; that suggestion only seems to function for both Windows and Web Applications and the project i am working on is a Class Library with a few classes that inherit from the 'Dynamic Reference'. I can get it to work if i use a wrapper around my class library but unfortunately this is not going to work for the final product.

Here is a sample of what i have working for Windows/Wed Applications;
based on the reply from Ennis Ray Lynch, Jr.[^]
    public class AssemblyResolver
    {
        private bool mLoading = false;

        /// <summary>
        /// Creates a new instance of the AssemblyResolver
        /// </summary>
        /// <param name="appDomain">The current AppDomain</param>
        public AssemblyResolver(AppDomain appDomain)
        {
            appDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);
        }

        /// <summary>
        /// Resolves any unfound references
        /// </summary>
        /// <param name="sender">The caller</param>
        /// <param name="args">The assembly to load</param>
        /// <returns></returns>
        private Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
        {
            //Prevent Stack overflow, this method will recurse without this line
            Assembly result = null;

            if (!mLoading)
            {
                try
                {
                    mLoading = true;
                    if (args.Name.Contains([My Dynamic Reference]))
                    {
                        result = Assembly.LoadFrom(findDir() + "\\[Library].dll");
                    }
                }//end try				
                finally
                {
                    mLoading = false;
                }
            }//end mLoading			
            return result;
        }
}


Usage:

AssemblyResolver res = new AssemblyResolver(AppDomain.CurrentDomain);


Any help or advice would be greatly appreciated, you can find my original post here[^]

TIA,
Don't comment your code - it was hard to write, it should be hard to read!

AnswerRe: Dynamic Reference With Inheritence Pin
Ennis Ray Lynch, Jr.26-Oct-10 7:39
Ennis Ray Lynch, Jr.26-Oct-10 7:39 
GeneralRe: Dynamic Reference With Inheritence Pin
Adam R Harris26-Oct-10 7:51
Adam R Harris26-Oct-10 7:51 
GeneralRe: Dynamic Reference With Inheritence Pin
Ennis Ray Lynch, Jr.26-Oct-10 7:59
Ennis Ray Lynch, Jr.26-Oct-10 7:59 
GeneralRe: Dynamic Reference With Inheritence Pin
Adam R Harris26-Oct-10 8:04
Adam R Harris26-Oct-10 8:04 
QuestionLock the PC Pin
Jassim Rahma26-Oct-10 4:22
Jassim Rahma26-Oct-10 4:22 
AnswerRe: Lock the PC Pin
Kevin Marois26-Oct-10 5:47
professionalKevin Marois26-Oct-10 5:47 
AnswerRe: Lock the PC Pin
Ennis Ray Lynch, Jr.26-Oct-10 6:07
Ennis Ray Lynch, Jr.26-Oct-10 6:07 
AnswerRe: Lock the PC Pin
PIEBALDconsult26-Oct-10 15:53
mvePIEBALDconsult26-Oct-10 15:53 
QuestionCOM Object with Protected Methods Pin
Enobong Adahada26-Oct-10 2:42
Enobong Adahada26-Oct-10 2:42 
AnswerRe: COM Object with Protected Methods Pin
Richard MacCutchan26-Oct-10 6:54
mveRichard MacCutchan26-Oct-10 6:54 
GeneralRe: COM Object with Protected Methods Pin
Enobong Adahada26-Oct-10 23:56
Enobong Adahada26-Oct-10 23:56 
GeneralRe: COM Object with Protected Methods Pin
Richard MacCutchan27-Oct-10 2:33
mveRichard MacCutchan27-Oct-10 2:33 
Questionopen form as a tab in windows applications Pin
Zeyad Jalil26-Oct-10 1:39
professionalZeyad Jalil26-Oct-10 1:39 
AnswerRe: open form as a tab in windows applications Pin
OriginalGriff26-Oct-10 1:49
mveOriginalGriff26-Oct-10 1:49 
GeneralRe: open form as a tab in windows applications Pin
Zeyad Jalil26-Oct-10 1:50
professionalZeyad Jalil26-Oct-10 1:50 
GeneralRe: open form as a tab in windows applications Pin
OriginalGriff26-Oct-10 1:56
mveOriginalGriff26-Oct-10 1:56 
GeneralRe: open form as a tab in windows applications Pin
Zeyad Jalil26-Oct-10 2:02
professionalZeyad Jalil26-Oct-10 2:02 

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.