Ejemplo n.º 1
0
        private void OnProcessPending(object sender, DataEventArgs <int> e)
        {
            if (e.Value == 0)
            {
                //Ejecuta el Proceso de Put Away de la mercancia Pendiente
                PutAwayPendingQuantities();
            }
            else if (e.Value == 1)
            {
                //Lama al view que maneja el Receiving

                /*
                 * IReceivingPresenter presenter = container.Resolve<IReceivingPresenter>();
                 * region.Shell.ShowViewInShell(presenter.View);
                 * App.curPresenter = typeof(ICrossDockPresenter);
                 * presenter.SetDocument(View.Model.Document);
                 */


                //Lama al view que maneja el Cross Dock
                IReceivingPresenter presenter = container.Resolve <IReceivingPresenter>();
                presenter.SetDocument(View.Model.Document);

                InternalWindow window = Util.GetInternalWindow(this.Window.Parent, "Receiving Process");
                presenter.Window = window;
                window.GridContent.Children.Add((ReceivingView)presenter.View);
                window.Show();
            }
        }
Ejemplo n.º 2
0
        void Shell_LoadInquiry(object sender, DataEventArgs<string> e)
        {
            if (string.IsNullOrEmpty(e.Value))
                return;

            if (e.Value == curLook && window != null && window.IsVisible)
                return;


            ClassEntity clsEntity = Shell.CboEntity.SelectedItem as ClassEntity;

            IQueriesPresenter presenter = container.Resolve<IQueriesPresenter>();
            bool result = presenter.LoadShortCut(e.Value, clsEntity.ShortcutColumnID);

            if (result)
            {
                window = Util.GetInternalWindow(Shell.ParentContent.WindowsContainer, "Inquiry Shortcut");
                presenter.Window = window;
                window.GridContent.Children.Add((QueriesView)presenter.View);
                window.Show();
                curLook = e.Value;
                return;
            }

            if (e.Value == curLook)
                return;

            curLook = e.Value;
            Util.ShowMessage("No record found.");
            
        }
Ejemplo n.º 3
0
        public void GoBackward(bool dialogReturnValue)
        {
            InternalWindow iw = null;

            foreach (ToolWindow window in this.content.OpenedWindows)
            {
                if (window.IsActive)
                {
                    iw = (InternalWindow)window;
                }
            }
            if (iw != null)
            {
                iw.GridContent.Children.RemoveAt(iw.GridContent.Children.Count - 1);
            }
            UIElement element = (UIElement)iw.GridContent.Children[iw.GridContent.Children.Count - 1];

            element.IsEnabled = true;

            BackNavigationEventHandler handler = backFunctions.Pop();

            if (handler != null)
            {
                handler(dialogReturnValue);
            }
        }
Ejemplo n.º 4
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native)
            {
                options.Width = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;
            if (options.ScreenMode == ScreenMode.FixedWindow)
                windowFlags = GameWindowFlags.FixedWindow;
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
                windowFlags = GameWindowFlags.Fullscreen;

            this.refreshMode = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
                this.internalWindow.Cursor = MouseCursor.Empty;
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write("Window Specification: {0}Mode: {1}{0}VSync: {2}{0}SwapInterval: {3}{0}",
                Environment.NewLine,
                this.internalWindow.Context.GraphicsMode,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            Assembly entryAssembly = Assembly.GetEntryAssembly();
            if (entryAssembly != null)
            {
                string executablePath = Path.GetFullPath(entryAssembly.Location);
                if (File.Exists(executablePath))
                {
                    this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                }
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
                this.internalWindow.WindowState = WindowState.Fullscreen;

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            DualityApp.Mouse.Source = new GameWindowMouseInputSource(this.internalWindow);
            DualityApp.Keyboard.Source = new GameWindowKeyboardInputSource(this.internalWindow);
            DualityApp.UserDataChanged += this.OnUserDataChanged;

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Ejemplo n.º 5
0
 void IDisposable.Dispose()
 {
     this.UnhookFromDuality();
     if (this.internalWindow != null)
     {
         this.internalWindow.Dispose();
         this.internalWindow = null;
     }
 }
Ejemplo n.º 6
0
 void IDisposable.Dispose()
 {
     this.UnhookFromDuality();
     if (this.internalWindow != null)
     {
         DisplayDevice.Default.RestoreResolution();
         this.internalWindow.Dispose();
         this.internalWindow = null;
     }
 }
Ejemplo n.º 7
0
        public ToolWindow ShowViewInWindow(UserControlBase view)
        {
            //throw new NotImplementedException();
            InternalWindow dialog = new InternalWindow();

            dialog.Parent        = ShellPanel();
            dialog.CanResize     = true;
            dialog.ShowStatusBar = false;
            dialog.StartPosition = ToolWindowStartPosition.CenterParent;
            dialog.GridContent.Children.Add(view);
            dialog.Show();
            return(dialog);
        }
Ejemplo n.º 8
0
        public static InternalWindow GetInternalWindow(Panel parent, string wName)
        {
            InternalWindow window = new InternalWindow();

            window.Parent        = parent;
            window.CanResize     = true;
            window.ShowStatusBar = false;
            window.Header        = wName;
            window.StartPosition = ToolWindowStartPosition.CenterParent;
            window.Height        = SystemParameters.FullPrimaryScreenHeight - 150;
            window.Width         = SystemParameters.FullPrimaryScreenWidth - 10;
            return(window);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellPresenter"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="shell">The shell.</param>
        public ShellPresenter(IUnityContainer container, IShellView shell)
        {
            this.container     = container;
            Shell              = shell;
            Shell.Model        = this.container.Resolve <ShellPresenterModel>();
            Shell.ShowReports += new System.EventHandler <System.EventArgs>(Shell_ShowReports);
            Shell.LoadInquiry += new System.EventHandler <DataEventArgs <string> >(Shell_LoadInquiry);

            //Menu = menu;
            //Menu.Model = this.container.Resolve<MainMenuPresenterModel>();
            //Menu.OpenModule += new EventHandler<DataEventArgs<ModuleRegion>>(this.OnOpenModule);

            window = new InternalWindow();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellPresenter"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="shell">The shell.</param>
        public ShellPresenter(IUnityContainer container, IShellView shell)
        {
            this.container = container;
            Shell = shell;
            Shell.Model = this.container.Resolve<ShellPresenterModel>();
            Shell.ShowReports += new System.EventHandler<System.EventArgs>(Shell_ShowReports);
            Shell.LoadInquiry += new System.EventHandler<DataEventArgs<string>>(Shell_LoadInquiry);

            //Menu = menu;
            //Menu.Model = this.container.Resolve<MainMenuPresenterModel>();
            //Menu.OpenModule += new EventHandler<DataEventArgs<ModuleRegion>>(this.OnOpenModule);

            window = new InternalWindow();

        }
Ejemplo n.º 11
0
        public void SetWindow(ModuleSubmenu ms)
        {
            InternalWindow window = new InternalWindow();

            window.Parent        = this.content.WindowsContainer as Panel;
            window.CanResize     = true;
            window.ShowStatusBar = false;
            window.Header        = ms.Name;
            window.StartPosition = ToolWindowStartPosition.CenterParent;
            window.Height        = SystemParameters.FullPrimaryScreenHeight - 150;
            window.Width         = SystemParameters.FullPrimaryScreenWidth - 10;
            window.Icon          = new BitmapImage(new Uri(ms.IconPath, UriKind.Relative));
            //window.Width = 800;

            //window.Icon = Util.GetImageSource(ms.Image);
            window.GridContent.Children.Add((UserControlBase)ms.Module.Execute(ms.PresenterType, window));
            window.Show();
        }
Ejemplo n.º 12
0
        private void OnViewConnections(object sender, EventArgs e)
        {
            ProcessWindow pw = new  ProcessWindow("Loading Connections ... ");

            try
            {
                IConnectionPresenter presenter = container.Resolve <ConnectionPresenter>();

                InternalWindow window = Util.GetInternalWindow(this.Window.Parent, "Connections");
                presenter.Window = window;
                window.GridContent.Children.Add((ConnectionView)presenter.View);
                window.Show();
            }
            catch { }
            finally
            {
                pw.Close();
            }
        }
Ejemplo n.º 13
0
        public void NavigateTo(object useCase, BackNavigationEventHandler backFromDialog)
        {
            InternalWindow iw = null;

            foreach (ToolWindow window in this.content.OpenedWindows)
            {
                if (window.IsActive)
                {
                    iw = (InternalWindow)window;
                }
            }
            if (iw != null)
            {
                foreach (UIElement item in iw.GridContent.Children)
                {
                    item.IsEnabled = false;
                }
            }

            iw.GridContent.Children.Add((UserControlBase)useCase);
            backFunctions.Push(backFromDialog);
        }
Ejemplo n.º 14
0
        public void AddWindow(string viewName, object window, Action close)
        {
            try
            {
                rwLock.EnterWriteLock();

                if (!windows.ContainsKey(viewName))
                {
                    var internalWindow = new InternalWindow
                    {
                        Window = window,
                        Close  = close
                    };

                    windows.Add(viewName, internalWindow);
                }
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
Ejemplo n.º 15
0
        void Shell_LoadInquiry(object sender, DataEventArgs <string> e)
        {
            if (string.IsNullOrEmpty(e.Value))
            {
                return;
            }

            if (e.Value == curLook && window != null && window.IsVisible)
            {
                return;
            }


            ClassEntity clsEntity = Shell.CboEntity.SelectedItem as ClassEntity;

            IQueriesPresenter presenter = container.Resolve <IQueriesPresenter>();
            bool result = presenter.LoadShortCut(e.Value, clsEntity.ShortcutColumnID);

            if (result)
            {
                window           = Util.GetInternalWindow(Shell.ParentContent.WindowsContainer, "Inquiry Shortcut");
                presenter.Window = window;
                window.GridContent.Children.Add((QueriesView)presenter.View);
                window.Show();
                curLook = e.Value;
                return;
            }

            if (e.Value == curLook)
            {
                return;
            }

            curLook = e.Value;
            Util.ShowMessage("No record found.");
        }
Ejemplo n.º 16
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if ((options.ScreenMode & (ScreenMode.ChangeResolution | ScreenMode.FullWindow)) != 0)
            {
                if (DisplayDevice.Default != null)
                {
                    options.Size = new Point2(
                        DisplayDevice.Default.Width,
                        DisplayDevice.Default.Height);
                }
            }

            screenMode = options.ScreenMode & (ScreenMode.FullWindow | ScreenMode.FixedSize | ScreenMode.ChangeResolution);

            GameWindowFlags windowFlags = GameWindowFlags.Default;

            if ((screenMode & ScreenMode.FixedSize) != 0)
            {
                windowFlags = GameWindowFlags.FixedWindow;
            }
            else if ((screenMode & ScreenMode.ChangeResolution) != 0)
            {
                windowFlags = GameWindowFlags.Fullscreen;
            }

            VSyncMode vsyncMode;

            switch (options.RefreshMode)
            {
            default:
            case RefreshMode.NoSync:
            case RefreshMode.ManualSync:
                vsyncMode = VSyncMode.Off;
                break;

            case RefreshMode.VSync:
                vsyncMode = VSyncMode.On;
                break;

            case RefreshMode.AdaptiveVSync:
                vsyncMode = VSyncMode.Adaptive;
                break;
            }

            this.refreshMode    = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Size.X,
                options.Size.Y,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
            {
                this.internalWindow.Cursor = MouseCursor.Empty;
            }
            this.internalWindow.VSync = vsyncMode;

            App.Log(
                "Window Specification: " + Environment.NewLine +
                "  Buffers: {0}" + Environment.NewLine +
                "  Samples: {1}" + Environment.NewLine +
                "  ColorFormat: {2}" + Environment.NewLine +
                "  AccumFormat: {3}" + Environment.NewLine +
                "  Depth: {4}" + Environment.NewLine +
                "  Stencil: {5}" + Environment.NewLine +
                "  VSync: {6}" + Environment.NewLine +
                "  SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            string executablePath = null;

            try {
                Assembly entryAssembly = Assembly.GetEntryAssembly();
                if (entryAssembly != null)
                {
                    executablePath = Path.GetFullPath(entryAssembly.Location);
                    if (File.Exists(executablePath))
                    {
                        this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                    }
                }
            }
            // As described in issue 301 (https://github.com/AdamsLair/duality/issues/301), the
            // icon extraction can fail with an exception under certain circumstances. Don't fail
            // just because of an icon. Log the error and continue.
            catch (Exception e) {
                App.Log(
                    "There was an exception while trying to extract the " +
                    "window icon from the game's main executable '{0}'. This is " +
                    "uncritical, but still an error: {1}",
                    executablePath,
                    e);
            }

            if ((screenMode & ScreenMode.FullWindow) != 0)
            {
                this.internalWindow.WindowState = WindowState.Fullscreen;
            }

            DualityApp.WindowSize = new Point2(this.internalWindow.ClientSize.Width,
                                               this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Ejemplo n.º 17
0
 public void ShowMainWindow()
 {
     InternalWindow.Show();
 }
Ejemplo n.º 18
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.FullWindow)
            {
                if (DisplayDevice.Default != null)
                {
                    options.Size = new Point2(
                        DisplayDevice.Default.Width,
                        DisplayDevice.Default.Height);
                }
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;

            if (options.ScreenMode == ScreenMode.FixedWindow)
            {
                windowFlags = GameWindowFlags.FixedWindow;
            }
            else if (options.ScreenMode == ScreenMode.Fullscreen)
            {
                windowFlags = GameWindowFlags.Fullscreen;
            }

            VSyncMode vsyncMode;

            switch (options.RefreshMode)
            {
            default:
            case RefreshMode.NoSync:
            case RefreshMode.ManualSync:
                vsyncMode = VSyncMode.Off;
                break;

            case RefreshMode.VSync:
                vsyncMode = VSyncMode.On;
                break;

            case RefreshMode.AdaptiveVSync:
                vsyncMode = VSyncMode.Adaptive;
                break;
            }

            this.refreshMode    = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Size.X,
                options.Size.Y,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
            {
                this.internalWindow.Cursor = MouseCursor.Empty;
            }
            this.internalWindow.VSync = vsyncMode;

            // Log some general info on the graphics context we've set up
            GraphicsBackend.LogOpenGLContextSpecs(this.internalWindow.Context);

            // Retrieve icon from executable file and set it as window icon
            string executablePath = null;

            try
            {
                Assembly entryAssembly = Assembly.GetEntryAssembly();
                if (entryAssembly != null)
                {
                    executablePath = Path.GetFullPath(entryAssembly.Location);
                    if (File.Exists(executablePath))
                    {
                        this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                    }
                }
            }
            // As described in issue 301 (https://github.com/AdamsLair/duality/issues/301), the
            // icon extraction can fail with an exception under certain circumstances. Don't fail
            // just because of an icon. Log the error and continue.
            catch (Exception e)
            {
                Logs.Core.WriteWarning(
                    "There was an exception while trying to extract the " +
                    "window icon from the game's main executable '{0}'. This is " +
                    "uncritical, but still means something went wrong: {1}",
                    executablePath,
                    LogFormat.Exception(e));
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
            {
                this.internalWindow.WindowState = WindowState.Fullscreen;
            }

            DualityApp.WindowSize = new Point2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Let's see what rendering features we have available
            GraphicsBackend.ActiveInstance.QueryOpenGLCapabilities();
        }
Ejemplo n.º 19
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native && DisplayDevice.Default != null)
            {
                options.Width = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;
            if (options.ScreenMode == ScreenMode.FixedWindow)
                windowFlags = GameWindowFlags.FixedWindow;
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
                windowFlags = GameWindowFlags.Fullscreen;

            this.refreshMode = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
                this.internalWindow.Cursor = MouseCursor.Empty;
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write(
                "Window Specification: " + Environment.NewLine +
                "  Buffers: {0}"         + Environment.NewLine +
                "  Samples: {1}"         + Environment.NewLine +
                "  ColorFormat: {2}"     + Environment.NewLine +
                "  AccumFormat: {3}"     + Environment.NewLine +
                "  Depth: {4}"           + Environment.NewLine +
                "  Stencil: {5}"         + Environment.NewLine +
                "  VSync: {6}"           + Environment.NewLine +
                "  SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            string executablePath = null;
            try
            {
                Assembly entryAssembly = Assembly.GetEntryAssembly();
                if (entryAssembly != null)
                {
                    executablePath = Path.GetFullPath(entryAssembly.Location);
                    if (File.Exists(executablePath))
                    {
                        this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                    }
                }
            }
            // As described in issue 301 (https://github.com/AdamsLair/duality/issues/301), the
            // icon extraction can fail with an exception under certain circumstances. Don't fail
            // just because of an icon. Log the error and continue.
            catch (Exception e)
            {
                Log.Core.WriteError(
                    "There was an exception while trying to extract the " +
                    "window icon from the game's main executable '{0}'. This is " +
                    "uncritical, but still an error: {1}",
                    executablePath,
                    Log.Exception(e));
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
                this.internalWindow.WindowState = WindowState.Fullscreen;

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Ejemplo n.º 20
0
 void IDisposable.Dispose()
 {
     this.UnhookFromDuality();
     if (this.internalWindow != null)
     {
         if (DisplayDevice.Default != null)
             DisplayDevice.Default.RestoreResolution();
         this.internalWindow.Dispose();
         this.internalWindow = null;
     }
 }
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native && DisplayDevice.Default != null)
            {
                options.Width  = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;

            if (options.ScreenMode == ScreenMode.FixedWindow)
            {
                windowFlags = GameWindowFlags.FixedWindow;
            }
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
            {
                windowFlags = GameWindowFlags.Fullscreen;
            }

            this.refreshMode    = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
            {
                this.internalWindow.Cursor = MouseCursor.Empty;
            }
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write(
                "Window Specification: " + Environment.NewLine +
                "Buffers: {0}" + Environment.NewLine +
                "Samples: {1}" + Environment.NewLine +
                "ColorFormat: {2}" + Environment.NewLine +
                "AccumulatorFormat: {3}" + Environment.NewLine +
                "Depth: {4}" + Environment.NewLine +
                "Stencil: {5}" + Environment.NewLine +
                "VSync: {6}" + Environment.NewLine +
                "SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            Assembly entryAssembly = Assembly.GetEntryAssembly();

            if (entryAssembly != null)
            {
                string executablePath = Path.GetFullPath(entryAssembly.Location);
                if (File.Exists(executablePath))
                {
                    this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                }
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
            {
                this.internalWindow.WindowState = WindowState.Fullscreen;
            }

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Ejemplo n.º 22
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native)
            {
                options.Width = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;
            if (options.ScreenMode == ScreenMode.FixedWindow)
                windowFlags = GameWindowFlags.FixedWindow;
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
                windowFlags = GameWindowFlags.Fullscreen;

            this.refreshMode = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
                this.internalWindow.Cursor = MouseCursor.Empty;
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write(
                "Window Specification: " + Environment.NewLine +
                "Buffers: {0}"           + Environment.NewLine +
                "Samples: {1}"           + Environment.NewLine +
                "ColorFormat: {2}"       + Environment.NewLine +
                "AccumulatorFormat: {3}" + Environment.NewLine +
                "Depth: {4}"             + Environment.NewLine +
                "Stencil: {5}"           + Environment.NewLine +
                "VSync: {6}"             + Environment.NewLine +
                "SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            Assembly entryAssembly = Assembly.GetEntryAssembly();
            if (entryAssembly != null)
            {
                string executablePath = Path.GetFullPath(entryAssembly.Location);
                if (File.Exists(executablePath))
                {
                    this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                }
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
                this.internalWindow.WindowState = WindowState.Fullscreen;

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Ejemplo n.º 23
0
 public static InternalWindow GetInternalWindow(Panel parent, string wName)
 {
     InternalWindow window = new InternalWindow();
     window.Parent = parent;
     window.CanResize = true;
     window.ShowStatusBar = false;
     window.Header = wName;
     window.StartPosition = ToolWindowStartPosition.CenterParent;
     window.Height = SystemParameters.FullPrimaryScreenHeight - 150;
     window.Width = SystemParameters.FullPrimaryScreenWidth - 10;
     return window;
 }
Ejemplo n.º 24
0
        void IDisposable.Dispose()
        {
            if (DualityApp.Mouse.Source is GameWindowMouseInputSource)
                DualityApp.Mouse.Source = null;
            if (DualityApp.Keyboard.Source is GameWindowKeyboardInputSource)
                DualityApp.Keyboard.Source = null;
            DualityApp.UserDataChanged -= this.OnUserDataChanged;

            if (this.internalWindow != null)
            {
                DisplayDevice.Default.RestoreResolution();
                this.internalWindow.Dispose();
                this.internalWindow = null;
            }
        }
Ejemplo n.º 25
0
        public void SetWindow(ModuleSubmenu ms)
        {
            InternalWindow window = new InternalWindow();            
            window.Parent = this.content.WindowsContainer as Panel;
            window.CanResize = true;
            window.ShowStatusBar = false;
            window.Header = ms.Name;
            window.StartPosition = ToolWindowStartPosition.CenterParent;
            window.Height = SystemParameters.FullPrimaryScreenHeight - 150;
            window.Width = SystemParameters.FullPrimaryScreenWidth - 10;
            window.Icon =  new BitmapImage(new Uri(ms.IconPath, UriKind.Relative));
            //window.Width = 800;

            //window.Icon = Util.GetImageSource(ms.Image);            
            window.GridContent.Children.Add((UserControlBase)ms.Module.Execute(ms.PresenterType, window));
            window.Show();
        }
Ejemplo n.º 26
0
 public ToolWindow ShowViewInWindow(UserControlBase view)
 {
     //throw new NotImplementedException();
     InternalWindow dialog = new InternalWindow();
     dialog.Parent = ShellPanel();
     dialog.CanResize = true;
     dialog.ShowStatusBar = false;
     dialog.StartPosition = ToolWindowStartPosition.CenterParent;
     dialog.GridContent.Children.Add(view);
     dialog.Show();
     return dialog;
 }