Пример #1
0
        /// <summary>
        /// Executes the background action behind this item.
        /// </summary>
        /// <returns></returns>
        public async Task Execute(SeeingSharpApplication app)
        {
            // Load all translation data
            await app.Translator.QueryTranslationsAsync(
                app.AppAssemblies).ConfigureAwait(false);

            // Translate all translatable classes
            app.Translator.TranslateAllTranslatableClasses();
        }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Default initializations
            SeeingSharpApplication.InitializeAsync(
                Assembly.GetExecutingAssembly(),
                new Assembly[] {
                typeof(GraphicsCore).Assembly
            },
                new string[0]).Wait();
            SeeingSharpApplication.Current.InitializeUIEnvironment();
            GraphicsCore.Initialize();
        }
Пример #3
0
        public void Initialize(CoreApplicationView applicationView)
        {
            SeeingSharpApplication.InitializeAsync(
                this.GetType().GetTypeInfo().Assembly,
                new Assembly[]
            {
                typeof(SeeingSharpApplication).GetTypeInfo().Assembly,
                typeof(GraphicsCore).GetTypeInfo().Assembly
            },
                new string[] { }).Wait();
            GraphicsCore.Initialize(enableDebug: true);

            applicationView.Activated += this.OnViewActivated;

            // Register event handlers for app lifecycle.
            CoreApplication.Suspending += this.OnSuspending;
            CoreApplication.Resuming   += this.OnResuming;
        }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Default initializations
            SeeingSharpApplication.InitializeAsync(
                Assembly.GetExecutingAssembly(),
                new Assembly[] {
                typeof(GraphicsCore).Assembly
            },
                new string[0]).Wait();
            GraphicsCore.Initialize();

            // Run the application
            MainWindow mainWindow = new MainWindow();

            SeeingSharpApplication.Current.InitializeUIEnvironment();
            Application.Run(mainWindow);
        }
Пример #5
0
        public static async Task InitializeWithGrahicsAsync()
        {
            // Initialize main application singleton
            if (!SeeingSharpApplication.IsInitialized)
            {
                await SeeingSharpApplication.InitializeAsync(
                    Assembly.GetExecutingAssembly(),
                    new Assembly[] { typeof(GraphicsCore).Assembly },
                    new string[0]);
            }

            // Initialize the graphics engine
            if (!GraphicsCore.IsInitialized)
            {
                GraphicsCore.Initialize();
                GraphicsCore.Current.SetDefaultDeviceToSoftware();
                GraphicsCore.Current.DefaultDevice.ForceDetailLevel(DetailLevel.High);
            }

            Assert.True(GraphicsCore.IsInitialized, "GraphicsCore could not be initialized!");
        }
Пример #6
0
        /// <summary>
        /// Performs default initialization logic.
        /// </summary>
        /// <returns></returns>
        public static async Task InitializeDefaultAsync()
        {
            if (s_current != null)
            {
                return;
            }

#if DESKTOP
            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }
#endif

            if (m_defaultInitTask != null)
            {
                await m_defaultInitTask;
                return;
            }
            else
            {
                // Initialize application object
                if (!SeeingSharpApplication.IsInitialized)
                {
                    m_defaultInitTask = SeeingSharpApplication.InitializeAsync(
                        typeof(GraphicsCore).GetTypeInfo().Assembly,
                        new Assembly[] {
                        typeof(ResourceLink).GetTypeInfo().Assembly,
                    },
                        new string[0]);
                    await m_defaultInitTask.ConfigureAwait(false);
                }

                // Initialize graphics core object
                if (!GraphicsCore.IsInitialized)
                {
                    GraphicsCore.Initialize(false, false);
                }
            }
        }
Пример #7
0
        protected async override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Default initializations
            await SeeingSharpApplication.InitializeAsync(
                Assembly.GetExecutingAssembly(),
                new Assembly[] {
                typeof(GraphicsCore).Assembly
            },
                new string[0]);

            // Initialize UI and Graphics
            SeeingSharpApplication.Current.InitializeUIEnvironment();
            GraphicsCore.Initialize();

            // Load the main window
            MainWindow mainWindow = new SeeingSharpModelViewer.MainWindow();

            SeeingSharpApplication.Current.InitializeAutoErrorReporting_Wpf(this, mainWindow);
            mainWindow.Show();
        }
        /// <summary>
        /// Executes the background action behind this item.
        /// </summary>
        /// <param name="app">The current application instance.</param>
        public async Task Execute(SeeingSharpApplication app)
        {
            MainWindowViewModel modelVM = null;

            using (MemoryRenderTarget dummyRenderTarget = new MemoryRenderTarget(128, 128))
            {
                modelVM = new MainWindowViewModel();

                // Assign main scene and camera to the dummy render target
                dummyRenderTarget.Scene  = modelVM.Scene;
                dummyRenderTarget.Camera = modelVM.Camera;

                // Initialize the scen
                await modelVM.InitializeAsync();

                // Perform some dummy renderings
                await dummyRenderTarget.AwaitRenderAsync();

                await dummyRenderTarget.AwaitRenderAsync();
            }

            // All went well, so register the main viewmode globally
            app.RegisterSingleton(modelVM);
        }
Пример #9
0
        /// <summary>
        /// Wird aufgerufen, wenn die Anwendung durch den Endbenutzer normal gestartet wird.  Weitere Einstiegspunkte
        /// werden z. B. verwendet, wenn die Anwendung gestartet wird, um eine bestimmte Datei zu öffnen.
        /// </summary>
        /// <param name="e">Details über Startanforderung und -prozess.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Initialize application and graphics
            if (!SeeingSharpApplication.IsInitialized)
            {
                await SeeingSharpApplication.InitializeAsync(
                    this.GetType().GetTypeInfo().Assembly,
                    new Assembly[]
                {
                    typeof(SeeingSharpApplication).GetTypeInfo().Assembly,
                    typeof(GraphicsCore).GetTypeInfo().Assembly
                },
                    new string[] { e.Arguments });

                GraphicsCore.Initialize();

                // Force high texture quality on tablet devices
                foreach (EngineDevice actDevice in GraphicsCore.Current.LoadedDevices)
                {
                    if (actDevice.IsSoftware)
                    {
                        continue;
                    }
                    actDevice.Configuration.TextureQuality = TextureQuality.Hight;
                }

                // Initialize the UI environment
                SeeingSharpApplication.Current.InitializeUIEnvironment();
            }

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Пример #10
0
 public InfrastructureTests()
 {
     SeeingSharpApplication.InitializeForUnitTests();
 }