private void OnWindowOpened(WindowManager.Window window)
        {
            // Check if window has data context.
            var context = window.Context as Context;

            if (context == null)
            {
                return;
            }

            // Set context in context holder.
            var contextHolder = window.Root.GetComponent <ContextHolder>();

            if (contextHolder != null)
            {
                contextHolder.Context = context;
            }

            // Set window reference if window context.
            var windowContext = context as WindowContext;

            if (windowContext != null)
            {
                windowContext.Window = window;
            }
        }
예제 #2
0
 public virtual void RenderSetup(WindowManager.Window target)
 {
     if (MatrixStack.Count == 0)
     {
         MatrixStack.Push(Matrix4.Identity);
     }
 }
예제 #3
0
        private static void WindowManager_WindowRemoved(object sender, EventArgs e)
        {
            WindowManager.Window win = sender as WindowManager.Window;
            if (win == null || !Contexts.ContainsKey(win.ContextID))
            {
                return;
            }

            Contexts.Remove(win.ContextID);
        }
예제 #4
0
        private static void WindowManager_WindowResized(object sender, EventArgs e)
        {
            WindowManager.Window win = sender as WindowManager.Window;
            if (win == null || !Contexts.ContainsKey(win.ContextID) || Contexts[win.ContextID].Canvases.Count == 0)
            {
                return;
            }

            Contexts[win.ContextID].Canvases.Peek().Resize();
        }
예제 #5
0
        private static void WindowManager_WindowAdded(object sender, EventArgs e)
        {
            WindowManager.Window win = sender as WindowManager.Window;
            if (win == null)
            {
                return;
            }

            ContextInfo info = new ContextInfo();

            info.ContextID = win.ContextID;
            info.Layer.CurrentContextID = win.ContextID;
            Contexts.Add(win.ContextID, info);
        }
        public override void RenderSetup(WindowManager.Window target)
        {
            CurrentContextID = target.ContextID;

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();
            var mat = Matrix4.CreateOrthographic(target.Width, target.Height, 0.01f, 1000);

            GL.LoadMatrix(ref mat);
            GL.MatrixMode(MatrixMode.Modelview);

            ClearDrawables();
            MatrixStack.Clear();
            MatrixStack.Push(Matrix4.CreateTranslation(target.Width * -0.5f, target.Height * -0.5f, -800));
        }
예제 #7
0
        public virtual void Render(WindowManager.Window target)
        {
            RenderSetup(target);
            if (Drawables.Count == 0)
            {
                foreach (var item in RenderItemList)
                {
                    item.Render(this);
                }
                Sort();
            }
            Draw();

            foreach (var child in ChildLayers)
            {
                child.Render(target);
            }
        }
        public override void Render(WindowManager.Window target)
        {
            RenderSetup(target);

            if (CurrentCanvas != null)
            {
                CurrentCanvas.Render(this);
            }

            // we don't sort GUI stuff, because stacking order matters.

            Draw();

            foreach (var child in ChildLayers)
            {
                child.Render(target);
            }
        }
예제 #9
0
        private void AuthenticationWindow_OnClose(Object sender, EventArgs e)
        {
            if (MercuryApplication != null)
            {
                Work.InitializeAll();

                ShowWorkspace();

                WireEvents();
            }

            else
            {
                WindowManager.Window authenticationWindow = WindowManager.OpenWindow("Workspace.Authentication", new Dictionary <String, Object> ());

                authenticationWindow.OnClose += new EventHandler <EventArgs> (AuthenticationWindow_OnClose);
            }

            return;
        }
예제 #10
0
        public Workspace()
        {
            InitializeComponent();


            WindowManager.OnWindowActivated += new EventHandler <EventArgs> (WindowManager_OnWindowActivated);


            if (MercuryApplication != null)
            {
                ShowWorkspace();

                WireEvents();
            }

            else
            {
                WindowManager.Window authenticationWindow = WindowManager.OpenWindow("Workspace.Authentication", new Dictionary <String, Object> ());

                authenticationWindow.OnClose += new EventHandler <EventArgs>(AuthenticationWindow_OnClose);
            }

            return;
        }