예제 #1
0
        static void Main(string[] _)
        {
            var size = Marshal.SizeOf(typeof(D3D11_INPUT_ELEMENT_DESC));

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            var window = Window.Create();

            if (window == null)
            {
                throw new Exception("fail to create window");
            }

            using (var d3d = new D3DApp())
            {
                window.OnResize += (w, h) =>
                {
                    d3d.Resize(window.WindowHandle, w, h);
                };

                MessageLoop.Run(() =>
                {
                    d3d.Draw(window.WindowHandle);
                }, 30);
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: ousttrue/RectUI
        static void Main(string[] args)
        {
            using (var app = new App())
            {
                app.Bind(Window.Create(), BuildUI());

                MessageLoop.Run(app.Draw, 30);
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            var window = Window.Create();

            if (window == null)
            {
                throw new Exception("fail to create window");
            }

            using (var d3d = new D3DApp())
            {
                window.OnResize += (w, h) =>
                {
                    d3d.Resize(window.WindowHandle, w, h);
                };

                MessageLoop.Run(() =>
                {
                    d3d.Draw(window.WindowHandle);
                }, 30);
            }
        }
예제 #4
0
            public void Run()
            {
                var window       = Window.Create(SW.SHOW);
                var dialogWindow = window.CreateModal(400, 300);

                var dialog = new FileDialog(State.Instance.OpenDir);

                dialog.BeginDialogOpen += () =>
                {
                    dialogWindow.Show(SW.SHOW);
                };

                dialog.FileChanged += obj =>
                {
                    var f = obj as FileInfo;
                    if (f != null)
                    {
                        State.Instance.OpenFile = f.FullName;

                        window.Enable();
                        dialogWindow.Close();

                        return;
                    }

                    var d = obj as DirectoryInfo;
                    if (d != null)
                    {
                        State.Instance.OpenDir = d.FullName;
                        return;
                    }
                };

                dialogWindow.OnClose += () =>
                {
                    dialog.OnClosed();
                };

                dialog.Canceled += () =>
                {
                    dialogWindow.Close();
                };

                m_app.Bind(dialogWindow, dialog.UI);

                Action onOpen = async() =>
                {
                    var f = await dialog.OpenAsync();

                    if (f != null)
                    {
                        try
                        {
                            await Load(f.FullName);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex);
                        }
                    }
                };

                m_app.Bind(window, BuildUI(onOpen));

                //
                // main loop
                //
                MessageLoop.Run(() => m_app.Draw(), 30);

                State.Save();
            }