Saturday, 26 November 2011

Disabling Autoupdater @ runtime - - - > Possible?

oh, yea very well possible will share 2mrw, time to bed ;)

Quick helper to get IMMPxApplication reference


IMMPxIntegrationCache mmPxIntegrationCache =
                Application.FindExtensionByName("Session Manager Integration Extension") as IMMPxIntegrationCache;
            IMMPxApplication mmPxApplication = mmPxIntegrationCache .Application;


but have in mind, this gonna not work if you have WFM(workflow manager) in place :)

U got to use "Workflow Manager Integration" instead of "Session Manager Integration Extension"


Cheers,
happy coding...
would be sharing my findings always

GUIDs


IGraphicsLayer
"{34B2EF81-F4AC-11D1-A245-080009B6F22B}"

IDataLayer
"{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"

IAnnotationLayer
"{4AEDC069-B599-424B-A374-49602ABAD308}"

ICadLayer
"{E299ADBC-A5C3-11D2-9B10-00C04FA33299}"

ICompositeGraphicsLayer
"{9646BB82-9512-11D2-A2F6-080009B6F22B}"

ITopologyLayer
"{FB6337E3-610A-4BC2-9142-760D954C22EB}"

IRasterLayer
"{D02371C7-35F7-11D2-B1F2-00C04F8EDEFF}"

IGroupLayer
"{EDAD6644-1810-11D1-86AE-0000F8751720}"

IDimensionLayer
"{0737082E-958E-11D4-80ED-00C04F601565}"

IGeoFeatureLayer
"{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}"

IFeatureLayer
"{40A9E885-5533-11D0-98BE-00805F7CED21}"

ILayer
"{34C20002-4D3C-11D0-92D8-00805F7C28B0}"

IMapServerLayer
"{E9B56157-7EB7-4DB3-9958-AFBF3B5E1470}"

IMapServerSublayer
"{B059B902-5C7A-4287-982E-EF0BC77C6AAB}"

INetworkLayer
"{82870538-E09E-42C0-9228-CBCB244B91BA}"

IRasterCatalogLayer
"{AF9930F0-F61E-11D3-8D6C-00C04F5B87B2}"

ArcSDE Query to increase the BLOB size during "UNABLE TO SAVE STORED DISPLAY"

sdeconfig -o alter -v MAXBLOBSIZE=3000000 -i 5151 -s myserver -u sde -p sde

Thursday, 24 November 2011

"UNABLE TO SAVE STORED DISPLAY" - - - Quick Tip

Sometimes, our stored displays will not get saved, it prompts "UNABLE TO SAVE STORED DISPLAY."
A quick trick to solve this is to do Alt+F+A (save as) to your MXD and overrite your stored display. Most of the times this will help you. If not you got to increase your BLOB size. Will share the query soon, not in mind at present ;)

Cheers
Happy coding! ! !

Monday, 21 November 2011

Custom Symbology does not display after a particular zoom level - S O L V E D :)

IMap pMap= mxDocument.FocusMap;
IGraphicsContainer graphicContainer= pMap as IGraphicsContainer;

// QI FeatureLayer to IGeofeatureLayer-> renderer-> use the method to get symbology of any feature by
//passing your IFeature

IElement element= markerElement as IElement;
IGroupElement grpElement= new GroupElementClass();
grpElement.Add(element);

// QI the IGroupElement back to IEement after adding all your element to a IGroupElement.
// you can also loop the IEnumElement from IGroupElement to add individual element to the active view, but
// HERE COMES THE ISSUE OF NOT DISPLAYING THE SYMBOLOGY GRAPHICS
// BEYOND CERTAIN ZOOM SCALE. My case was 200 scale, I doubt this could be a ESRI bug!!!.

graphicContainer.Add(graphicContainer as IElement,0);

// Refesh your active view


Cheers
happy Coding


Monday, 7 November 2011

Change your cursor with ESRI Add-in Tool

I was fighting a bit to change my Add-In cursor to a wait cursor during execution process. First cycle goes smooth and from then on I could not find the change in the cursor. All I could realise is that the cursor is not gettin changed but in reality the cursor was getting changed to WAITCURSOR which was not reflecting in the screen.
The reason behind was Windows sends the window that contains the mouse cursor the WM_SETCURSOR message, giving it an opportunity to change the cursor shape. A control like TextBox takes advantage of that, changing the cursor into a I-bar. The Control.Cursor property determines what shape will be used.
The Current.Cursor property changes the shape directly, without waiting for a WM_SETCURSOR response. In most cases, that shape is unlikely to survive for long. As soon as the user moves the mouse, WM_SETCURSOR changes it back to Control.Cursor.
The UseWaitCursor property was added in .NET 2.0 to make it easier to display an hourglass. Unfortunately,
it doesn't work very well. It requires a WM_SETCURSOR message to change the shape and that won't happen when you set the property to true and then do something that takes a while.

 Use this class to set the cursor
public class UseWaitCursor : IDisposable
    {

        public UseWaitCursor()
        {
            Enabled = true;
        }
        #region IDisposable Members

        public void Dispose()
        {
            Enabled = false;
        }
        public static bool Enabled
        {
            get { return MyAddinTool._ myDocWindow.UseWaitCursor; }
            set
            {
           if (value.Equals(MyAddinTool._myDocWindow.UseWaitCursor)) return;
                MyAddinTool._ myDocWindow.UseWaitCursor = value;
                if (_myDocWindow.ActiveControl != null && MyAddinTool._ myDocWindow.ActiveControl.Handle != null)
                    SendMessage(MyAddinTool._ myDocWindow.ActiveControl.Handle, 0x20, MyAddinTool._ myDocWindow.ActiveControl.Handle, (IntPtr)1);
            }
        }

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern IntPtr SendMessage(IntPtr hwnd, int msg, IntPtr wp, IntPtr lp);
        #endregion
    }


using (new UseWaitCursor())
{
   //TODO all your code goes here or this ares says how long your curosr needs to
    be in WAITCUROSR style.
}
If required, use Finally block to change your cursor back to default Tool's cursor.



After Implementing the class above I was able to see my cursor change happening in the screen. Similar goes for Settin status message sometimes :)

Cheers
Happy coding

Thursday, 3 November 2011

Handle ESRI AddIn DockableWindow Close event

Friends,

I have really not used the close event of the Dockable window, instead I have used the OnUpdate method in to check the DockableWindow visibility to do necessary actions.
Snippet as below


protected override void OnUpdate()
{
     Enabled = ArcMap.Application != null;

     if (!_dockWindow.IsVisible() && !_toRollBack)
          RollBackActiveView()}

_toRollBack is a bool variable to avoid infinite loop during execution.

Do not forget to set the BOOL variable to false where ever you make the DockableWindow visible.

would be interested to understand few discussions? ? ?




Cheers Happy Coding :)