Determine EditState

Discussion created by bbulla on May 4, 2010
Latest reply on May 5, 2010 by bbulla

I want to determine the EditState so that I can enable/disable buttons on a Toolbar.  I understand that I need to reference IApplication somehow, but I can't figure it out.  I keep getting a 'use of unassinged local variable' in my code.  Here is what I have:

public override bool Enabled
                IApplication app;    //I'm doing something wrong here, but I don't know how to fix it
                UID editorUID = new UID();
                editorUID.Value = "esriEditor.Editor";
                //this is where I get the error on the app variable
                IEditor2 editor = app.FindExtensionByCLSID(editorUID) as IEditor2;
                if (editor == null)
                    return false;
                return (editor.EditState == esriEditState.esriStateEditing);
                //return base.Enabled;

Thanks for your help!