コード例 #1
0
        public override void Run()
        {
            ResourceService.RegisterNeutralImages(Properties.Resources.ResourceManager);
            ResourceService.RegisterNeutralStrings(Strings.ResourceManager);

            if (!Platform.IsRunningOnMono)
            {
                ResourcePreviewerFactory.RegisterPreviewer(LocalConnection.PROVIDER_NAME, new LocalPreviewer());

                System.Windows.Forms.Application.ApplicationExit += new EventHandler(OnAppExit);
            }
            else
            {
                LoggingService.Info("Skipping local connection provider registration because I am guessing we're running Mono on Linux/Mac"); //LOCALIZEME
            }
        }
コード例 #2
0
        public override void Run()
        {
            ResourceService.RegisterNeutralImages(Properties.Resources.ResourceManager);
            ResourceService.RegisterNeutralStrings(Strings.ResourceManager);

            Workbench.WorkbenchInitialized += (sender, e) =>
            {
                PreviewSettings.UseAjaxViewer   = PropertyService.Get(ConfigProperties.PreviewViewerType, "AJAX") == "AJAX"; //NOXLATE
                PreviewSettings.UseLocalPreview = PropertyService.Get(ConfigProperties.UseLocalPreview, ConfigProperties.DefaultUseLocalPreview);

                var urlLauncher = ServiceRegistry.GetService <UrlLauncherService>();
                var vcMgr       = ServiceRegistry.GetService <ViewContentManager>();
                ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher, vcMgr)); //NOXLATE
                ResourcePreviewerFactory.RegisterPreviewer("Maestro.Rest", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher, vcMgr)); //NOXLATE
                //A stub previewer does nothing, but will use local map previews for applicable resources if the configuration
                //property is set
                ResourcePreviewerFactory.RegisterPreviewer("Maestro.LocalNative", new LocalMapPreviewer(new StubPreviewer(), urlLauncher, vcMgr)); //NOXLATE

                ServiceRegistry.GetService <NewItemTemplateService>().InitUserTemplates();
                var wb = Workbench.Instance;

                Themes.CurrentTheme = Props.Get <string>(ConfigProperties.SelectedTheme, ConfigProperties.DefaultSelectedTheme);
                var themeToApply = Themes.Get(Themes.CurrentTheme);
                if (themeToApply != null)
                {
                    wb.ApplyTheme(themeToApply);
                }

                wb.FormClosing += new System.Windows.Forms.FormClosingEventHandler(OnWorkbenchClosing);
                wb.Text         = "MapGuide Maestro"; //NOXLATE

                if (Props.Get(ConfigProperties.ShowMessages, true))
                {
                    vcMgr.OpenContent <MessageViewer>(ViewRegion.Bottom);
                }

                if (Props.Get(ConfigProperties.ShowOutboundRequests, true))
                {
                    vcMgr.OpenContent <OutboundRequestViewer>(ViewRegion.Bottom);
                }

                LoginCommand.RunInternal(true);
            };
        }
コード例 #3
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            Application.SetCompatibleTextRenderingDefault(false);

            //Init the Maestro connection registry with additional providers from ConnectionProviders.xml
            ConnectionProviderRegistry.InitRegistry();

            //Register previewers
            var urlLauncher = new OurUrlLauncher();

            ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher, null)); //NOXLATE
            //A stub previewer does nothing, but will use local map previews for applicable resources if the configuration
            //property is set
            ResourcePreviewerFactory.RegisterPreviewer("Maestro.LocalNative", new LocalMapPreviewer(new StubPreviewer(), urlLauncher, null)); //NOXLATE

            //Can't use this code, it requires a call to MgdPlatform.Initialize which we can't call indirectly :(

            /*
             * //Try to tap into mg-desktop coordinate system services if possible
             * try
             * {
             *  var provEntry = ConnectionProviderRegistry.FindProvider("Maestro.Local"); //NOXLATE
             *  if (provEntry != null)
             *  {
             *      string path = provEntry.AssemblyPath;
             *      Assembly asm = Assembly.LoadFrom(path); //NOXLATE
             *      if (asm != null)
             *      {
             *          Type mpuType = asm.GetType("OSGeo.MapGuide.MaestroAPI.Native.LocalNativeMpuCalculator"); //NOXLATE
             *          Type catType = asm.GetType("OSGeo.MapGuide.MaestroAPI.Native.LocalNativeCoordinateSystemCatalog"); //NOXLATE
             *
             *          if (mpuType != null && catType != null)
             *          {
             *              IMpuCalculator calc = (IMpuCalculator)Activator.CreateInstance(mpuType);
             *              ICoordinateSystemCatalog csCatalog = (ICoordinateSystemCatalog)Activator.CreateInstance(catType);
             *
             *              CsHelper.DefaultCalculator = calc;
             *              CsHelper.DefaultCatalog = csCatalog;
             *              Debug.WriteLine("Using mg-desktop coordinate system services where possible");
             *          }
             *      }
             *  }
             *  else
             *  {
             *      Debug.WriteLine("No mg-desktop coordinate system services to tap into. Using default services");
             *  }
             * }
             * catch (Exception ex)
             * {
             * }
             */

            var login = new Login.LoginDialog();

            if (login.ShowDialog() == DialogResult.OK)
            {
                var conn = login.Connection;

                //TODO: Validate connection capabilities
                Application.Run(new MainForm(conn));
            }
        }