Exemplo n.º 1
0
        private void LoadRendererCore(IRenderer renderer)
        {
            RendererSurface surface = Model.Project.GetRendererSurface(renderer.Model.Guid);

            // * Lock
            // 렌더러를 모델에 의해 생성하는경우 초기화를 방지하기 위해 잠굼
            DesignTime.Lock(renderer as ControlLayer);

            // Metadata mapping
            renderer.Metadata.CreatedPosition = surface.Metadata.CreatedPosition;
            renderer.Metadata.CreatedTime     = surface.Metadata.CreatedTime;

            // * Pending rollback
            // 렌더러가 생성되고 WPF 컨트롤이 Load 될 때 바인딩을 진행하기 때문에
            // 모델의 속성에 영향을 주지 않음 (덤프 가능 상태)
            var dump = new DumpDependencyObject(renderer.Model);

            renderer.ElementAttached += ElementAttached;

            void ElementAttached(object sender, EventArgs e)
            {
                renderer.ElementAttached -= ElementAttached;

                // Property Rollback
                dump.CopyTo(renderer.Model);

                // Unlock
                DesignTime.Unlock(renderer as ControlLayer);

                Canvas.SetLeft(renderer.Element, surface.Location.X);
                Canvas.SetTop(renderer.Element, surface.Location.Y);
            }
        }
Exemplo n.º 2
0
        public void RemoveChild(IRenderer child)
        {
            this.RendererChildren.SafeRemove(child);

            if (!DesignTime.IsLocked(this))
            {
                OnRemovedChild(child);
            }
        }
Exemplo n.º 3
0
        public void AddChild(IRenderer child, Point position)
        {
            this.RendererChildren.SafeAdd(child);

            if (!DesignTime.IsLocked(this))
            {
                OnAddedChild(child, position);
            }
        }
Exemplo n.º 4
0
        private void InitializeSelector()
        {
            this.AddSelectedHandler(OnSelected);
            this.AddUnselectedHandler(OnUnselected);

            if (!DesignTime.IsLocked(this))
            {
                GroupSelector.Select(this, true);
            }
        }
        private string GetDesignModeValue()
        {
            var    provider = DesignTime.GetTranslationProvider(this._parent) ?? TranslationManager.TranslationProvider;
            string language = DesignTime.GetLanguage(this._parent);
            var    culture  = language == null ? TranslationManager.CurrentLanguage : new CultureInfo(language);

            if (provider == null || culture == null)
            {
                return(string.Format("!!{0}.{1}!!", this._group, this._key));
            }

            return(provider.Translate(this._group, this._key, culture));
        }
Exemplo n.º 6
0
        public void TestInitialize()
        {
            DesignTime.ResetInDesignModeToDefault();
            var compositionProvider = new MefCompositionProvider();

            Authenticator.Instance.DefaultAuthenticationContext = null;
            var batch = new CompositionBatch();

            PrepareCompositionContainer(batch);
            compositionProvider.Configure(batch);
            Composition.SetProvider(compositionProvider);

            PlatformProvider.Current = new TestPlatformProvider();

            Context();
        }
Exemplo n.º 7
0
 static AppBootstrapper()
 {
     //TODO: How to enable design time.
     DesignTime.EnableDesignTimeSupport <TempHireEntities>();
     DesignTime.EnableDesignTimeSupport <SecurityEntities>();
 }