Example #1
0
        /// <summary>
        /// Creates a new <c>Session</c> and defines it as the "current" session
        /// </summary>
        /// <param name="project">The project the session is part of</param>
        /// <param name="sessionData">Information about the session</param>
        /// <param name="sessionFile">The name of the file holding the session data</param>
        internal Session(Project project, NewSessionEvent sessionData, string sessionFile)
        {
            if (sessionData == null || project == null)
                throw new ArgumentNullException();

            m_Data = sessionData;
            m_FileName = sessionFile;
            m_Project = project;
            m_Operations = new List<Operation>();
            m_LastSavedItem = sessionData.EditSequence;
        }
        public override void Close()
        {
            // Shut down any inverse calculator
            if (m_Inverse!=null)
            {
                m_Inverse.Dispose();
                m_Inverse = null;
            }

            // Write out the project settings
            if (m_Project != null)
            {
                new ProjectDatabase().CloseProject(m_Project);
                m_Project = null;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditingController"/> class.
        /// </summary>
        /// <param name="main">The main dialog for the Cadastral Editor application</param>
        internal EditingController(MainForm main)
            : base()
        {
            if (main==null)
                throw new ArgumentNullException();

            m_Project = null;
            m_ActiveLayer = null;
            m_Main = main;
            m_IsAutoSelect = 0;
            m_Inverse = null;
            m_Check = null;
            m_Sel = null;
            m_HasSelectionChanged = false;
            m_DataServer = null;

            // If we know of a database, create the access class
            string cs = LastDatabase.ConnectionString;
            if (!String.IsNullOrWhiteSpace(cs))
                m_DataServer = new DataServer(cs);
        }
        /// <summary>
        /// Records the active project.
        /// </summary>
        /// <param name="p">The project the user is working with</param>
        internal void SetProject(Project p)
        {
            m_ActiveLayer = EnvironmentContainer.FindLayerById(p.LayerId);
            if (m_ActiveLayer == null)
                throw new ApplicationException("Cannot locate map layer associated with selected project");

            m_Project = p;
        }