示例#1
0
        public StandaloneController(App app)
        {
            medicalConfig = new MedicalConfig();
            this.app      = app;

            guiManager = new GUIManager();
            guiManager.MainGUIShown  += guiManager_MainGUIShown;
            guiManager.MainGUIHidden += guiManager_MainGUIHidden;

            MyGUIInterface.OSTheme = PlatformConfig.ThemeFile;

            String title;

            if (MedicalConfig.BuildName != null)
            {
                title = String.Format("{0} {1}", app.Title, MedicalConfig.BuildName);
            }
            else
            {
                title = app.Title;
            }
            mainWindow         = new MainWindow(title);
            mainWindow.Closed += mainWindow_Closed;

            //Setup DPI
            float pixelScale = mainWindow.WindowScaling;

            if (MedicalConfig.PixelScaleOverride > 0.5f)
            {
                pixelScale = MedicalConfig.PixelScaleOverride;
            }

            float scaleFactor = pixelScale;

            pixelScale += MedicalConfig.PlatformExtraScaling * scaleFactor;

            switch (MedicalConfig.ExtraScaling)
            {
            case UIExtraScale.Smaller:
                pixelScale -= .15f * scaleFactor;
                break;

            case UIExtraScale.Larger:
                pixelScale += .25f * scaleFactor;
                break;
            }

            ScaleHelper._setScaleFactor(pixelScale);

            //Initialize engine
            medicalController = new MedicalController(mainWindow);
            idleHandler       = new IdleHandler(medicalController.MainTimer.OnIdle);

            PointerManager.Instance.Visible = false;

            ((RenderWindow)OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget).DeactivateOnFocusChange = false;
        }
示例#2
0
 /// <summary>
 /// Save the current app state as config files.
 /// </summary>
 public void saveConfiguration()
 {
     if (LicenseManager != null && LicenseManager.Valid)
     {
         MedicalConfig.save();
         if (DocumentController != null)
         {
             DocumentController.saveRecentDocuments();
         }
         if (guiManager != null && MedicalConfig.WindowsFile != null)
         {
             ConfigFile configFile = new ConfigFile(MedicalConfig.WindowsFile);
             guiManager.saveUI(configFile, UpdateController.CurrentVersion);
             configFile.writeConfigFile();
         }
     }
 }
示例#3
0
        void keyValid()
        {
            MedicalConfig.setUserDirectory(controller.LicenseManager.User);

            controller.GUIManager.setMainInterfaceEnabled(true);

            mainPlugin = new AnomalousMainPlugin(controller.LicenseManager, this);
            controller.AtlasPluginManager.addPlugin(mainPlugin);
            controller.loadConfigAndCommonResources();

            //Load remaining plugins after core ones are loaded.
            if (AddAdditionalPlugins != null)
            {
                AddAdditionalPlugins.Invoke(this, controller);
            }

            System.Threading.Tasks.Task.Run(() =>
            {
                Thread.Sleep(500);

                MedicalConfig.PluginConfig.findPlugins();

                foreach (String plugin in MedicalConfig.PluginConfig.Plugins)
                {
                    bool isSafe = controller.AtlasPluginManager.isPluginPathSafeToLoad(plugin);
                    ThreadManager.invokeAndWait(() =>
                    {
                        controller.AtlasPluginManager.addPlugin(plugin, isSafe);
                    });
                }

                ThreadManager.invoke(mainPlugin.allPluginsLoaded);
            });

            controller.MedicalController.MainTimer.resetLastTime();
        }