Inheritance: ViewOptionsBase
コード例 #1
0
        public virtual void Navigate(object entityOrLite, NavigateOptions options)
        {
            if (entityOrLite == null)
            {
                throw new ArgumentNullException("entity");
            }

            Type type = entityOrLite is Lite <Entity>?((Lite <Entity>)entityOrLite).EntityType : entityOrLite.GetType();

            OpenIndependentWindow(() =>
            {
                NormalWindow win = CreateNormalWindow();
                win.SetTitleText(NormalWindowMessage.Loading0.NiceToString().FormatWith(type.NiceName()));
                return(win);
            },
                                  afterShown: win =>
            {
                try
                {
                    ModifiableEntity entity = entityOrLite as ModifiableEntity;
                    if (entity == null)
                    {
                        Lite <Entity> lite = (Lite <Entity>)entityOrLite;
                        entity             = lite.EntityOrNull ?? Server.RetrieveAndForget(lite);
                    }

                    EntitySettings es = AssertViewableEntitySettings(entity);
                    if (!es.OnIsNavigable(true))
                    {
                        throw new Exception("{0} is not navigable".FormatWith(entity));
                    }

                    if (entity is EmbeddedEntity)
                    {
                        throw new InvalidOperationException("ViewSave is not allowed for EmbeddedEntities");
                    }

                    Control ctrl = options.View != null ? options.View() : es.CreateView(entity, null);
                    ctrl         = es.OnOverrideView(entity, ctrl);


                    SetNormalWindowEntity(win, (ModifiableEntity)entity, options, es, ctrl);
                }
                catch
                {
                    win.Close();
                    throw;
                }
            },
                                  closed: options.Closed);
        }
コード例 #2
0
ファイル: EntityBase.cs プロジェクト: jeason0813/framework-2
        protected void _OnNavigating(object entity)
        {
            if (Navigating != null)
            {
                Navigating(entity);
            }
            else
            {
                var options = new NavigateOptions();

                bool isReadOnly = (ReadonlyEntity ?? Common.GetIsReadOnly(this));
                if (isReadOnly)
                {
                    options.ReadOnly = isReadOnly;
                }

                Navigator.NavigateUntyped(entity, options);
            }
        }
コード例 #3
0
 public static void Navigate <T>(T entity, NavigateOptions options = null)
     where T : IEntity
 {
     Manager.Navigate(entity, options ?? new NavigateOptions());
 }
コード例 #4
0
 public static void NavigateUntyped(object entity, NavigateOptions options = null)
 {
     Manager.Navigate(entity, options ?? new NavigateOptions());
 }
コード例 #5
0
ファイル: EntityBase.cs プロジェクト: rondoo/framework
        protected void _OnNavigating(object entity)
        {
            if (Navigating != null)
                Navigating(entity);
            else
            {
                var options = new NavigateOptions();

                bool isReadOnly = (ReadonlyEntity ?? Common.GetIsReadOnly(this));
                if (isReadOnly)
                    options.ReadOnly = isReadOnly;

                Navigator.NavigateUntyped(entity, options);
            }
        }