示例#1
0
        /// <summary>
        /// Open a Edition view for a fonctionality
        /// This method shall be called by the PageManager
        /// </summary>
        /// <param name="token">NavigationToken</param>
        protected OperationState openEditionPage(NavigationToken token)
        {
            Controllable page = null;

            try
            {
                String functionality = token.Functionality;

                if (functionality == FunctionalitiesCode.FILE_SAVE)
                {
                    return(saveFile(token));
                }

                page = searchInOpenedPages(functionality);

                if (page == null)
                {
                    page = ApplicationManager.ControllerFactory.GetController(functionality, token.ViewType, token.EditionMode);
                    if (page == null)
                    {
                        return(openHomePage());
                    }
                    OpenedPages.Add(page);
                    page.NavigationToken = token;
                    page.Initialize();
                }
                openPage(page);
                EditionMode editionMode = token.EditionMode;
                object      oid         = token.ItemId;
                if (editionMode == EditionMode.CREATE)
                {
                    page.Create();
                }
                else if (editionMode == EditionMode.READ_ONLY)
                {
                    if (token.ItemIds.Count == 0)
                    {
                        page.Open(oid);
                    }

                    foreach (object id in token.ItemIds)
                    {
                        if (id != null)
                        {
                            page.Open(id);
                        }
                    }
                }
                else if (editionMode == EditionMode.MODIFY)
                {
                    if (token.ItemIds.Count == 0)
                    {
                        page.Edit(oid);
                    }
                    foreach (object id in token.ItemIds)
                    {
                        if (id != null)
                        {
                            page.Edit(id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                InternalErrorMessage = ex.Message;
                OnClosePage(page);
            }
            return(OperationState.CONTINUE);
        }