예제 #1
0
        /// <summary> Preferences are being requested from the object to be encoded and 
        /// returned as a string value.  
        /// <note>This is a required named method by FalconView</note>
        /// <note>The DispId MUST be 2</note>
        /// </summary>
        /// <returns>
        /// Encoded preference string
        /// </returns>
        /// <remarks>
        /// The encoding of the string and preference values is entirely up to the
        /// plug-in developer.  Since the developer "owns" both the preference control
        /// and the overlay (both the encoding and use in both directions), any encoding
        /// which results in a valid string value is allowed.
        /// </remarks>
        public string GetPreferences()
        {
            PreferenceClass StoredPrefernces = null;
            System.IO.StreamReader stReader = null;

            try
            {
                string prefsFile = USER_DATA + m_DataDirectory + "\\PrefsFile.xml";

                if (System.IO.File.Exists(prefsFile))
                {
                    stReader = new System.IO.StreamReader(prefsFile);
                    System.Xml.Serialization.XmlSerializer xSerializer = new System.Xml.Serialization.XmlSerializer(typeof(PreferenceClass));

                    StoredPrefernces = (PreferenceClass)xSerializer.Deserialize(stReader);
                }

                if (StoredPrefernces == null)
                {
                    StoredPrefernces = new PreferenceClass();
                }
            }
            catch (Exception)
            {
                // If for any reason we can't read it, defaults will be taken from the PreferenceClass object
                StoredPrefernces = new PreferenceClass();
            }
            finally
            {
                if (stReader != null)
                {
                    stReader.Close();
                    stReader.Dispose();
                }
            }

            return StoredPrefernces.ToString();
        }
예제 #2
0
        /// <summary> Return the users preferences packed in to a string
        /// </summary>
        /// <returns> 
        /// Encoded preference string
        /// </returns>
        public string GetPreferences()
        {
            PreferenceClass thePrefs = new PreferenceClass();

            thePrefs.m_ShowBanner = m_OverlayBannerCk.Checked;

            thePrefs.m_HideAbove = GetScaleFactor(m_HideAboveCB);

            thePrefs.m_HideLabelsAbove = GetScaleFactor(m_HideLabelsAboveCB);

            thePrefs.m_UseBlueIcons = RBBlueIcons.Checked;

            return thePrefs.ToString();
        }
예제 #3
0
        /// <summary> Called when the property page is created by the overlay options dialog. 
        /// </summary>
        /// <param name="propertyPageGuid"> uid specifed in the property pages config file
        /// </param>
        /// <param name="pMapView"> The Current Map View object
        /// </param>
        /// <param name="hWndParent"> the HWND of the parent window in the overlay options 
        /// dialog box. The property page should be created as a child of this window
        /// </param>
        /// <param name="pEvents"> can implement IMapChangeNotifyEvents, IDisplayChangeNotifyEvents, and IFvPropertyPageEvents
        /// </param>
        public void OnCreate(Guid propertyPageGuid, FalconViewOverlayLib.IFvMapView pMapView, int hWndParent, object pEvents)
        {
            // The GUID of the property page that is being requested.  i.e. "this" provides several configurations of the
            // property control (itself).

            // Save aside the callback objects for use
            m_MapView = pMapView;
            m_MapChangeNotifyEvents = pEvents as FalconViewOverlayLib.IMapChangeNotifyEvents;
            m_DisplayChangeNotifyEvents = pEvents as FalconViewOverlayLib.IDisplayChangeNotifyEvents;

            m_PropertyPageNotifyEvents = pEvents as FalconViewOverlayLib.IPropertyPageNotifyEvents;

            // Critical step to get the draw notification
            SetParent(Handle, new IntPtr(hWndParent));

            int OverlayOnTop = m_MapView.OverlayManager.SelectByOverlayDescGuid(new Guid("f9109e69-faa5-4144-9b74-aaf6fd933d7d"));

            if (OverlayOnTop == 1)
            {
                m_TheOverlay = m_MapView.OverlayManager.CurrentOverlay as FvOverlay;
            }
            else
            {
                do
                {
                    int result = m_MapView.OverlayManager.MoveNext();
                    if (result == 0)
                        break;

                    m_TheOverlay = m_MapView.OverlayManager.CurrentOverlay as FvOverlay;
                } while (m_TheOverlay == null);
            }

            PreferenceClass thePrefs = null;

            if (m_TheOverlay != null)
                thePrefs = PreferenceClass.CreateFromString(m_TheOverlay.GetPreferences());
            else
                thePrefs = new PreferenceClass();

            SetSelectedItem(thePrefs.m_HideAbove, m_HideAboveCB);
            SetSelectedItem(thePrefs.m_HideLabelsAbove, m_HideLabelsAboveCB);

            m_OverlayBannerCk.Checked = thePrefs.m_ShowBanner;

            RBBlueIcons.Checked = thePrefs.m_UseBlueIcons;
            RBRedIcons.Checked = !thePrefs.m_UseBlueIcons;
        }
예제 #4
0
        /// <summary> Called when the page has been marked dirty in the Overlay Options Dialog and the 
        /// user has pressed Apply/OK on the dialog
        /// </summary>
        public void OnApply()
        {
            PreferenceClass thePrefs = new PreferenceClass();

            thePrefs.m_HideAbove = GetScaleFactor(m_HideAboveCB);
            thePrefs.m_HideLabelsAbove = GetScaleFactor(m_HideLabelsAboveCB);

            thePrefs.m_ShowBanner = m_OverlayBannerCk.Checked;

            thePrefs.m_UseBlueIcons = RBBlueIcons.Checked;

            if (m_TheOverlay != null)
                m_TheOverlay.SetPreferences(thePrefs.ToString());
        }