コード例 #1
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void ShowWinFormsOptionsUI()
        {
            using (var dialog = new WinForms.OptionsView()) {
                var webServer = Factory.ResolveSingleton <IAutoConfigWebServer>().WebServer;
                dialog.IndexPageAddress = String.Format("{0}/{1}", webServer.LocalAddress, "WebAdmin/Index.html");
                dialog.Options          = OptionsStorage.Load();

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    OptionsStorage.Save(dialog.Options);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="parameters"></param>
        public void Startup(PluginStartupParameters parameters)
        {
            Singleton = this;
            _Options  = OptionsStorage.Load();

            var pathFromRoot = String.Format("/{0}/", ProtectedFolder);

            _WebAdminViewManager.Startup(parameters.WebSite);
            _WebAdminViewManager.RegisterTranslations(typeof(VirtualRadar.WebSite.WebSiteStrings), "", false);
            _WebAdminViewManager.RegisterTranslations(typeof(VirtualRadar.Localisation.Strings), "Server", false);
            _WebAdminViewManager.RegisterTranslations(typeof(WebAdminStrings), "WebAdmin", true);

            // Views that have a menu entry
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Index.html", WebAdminStrings.WA_Home, () => new View.MainView(parameters.UPnpManager, parameters.FlightSimulatorAircraftList), null));
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Settings.html", WebAdminStrings.WA_Title_Options, () => new View.SettingsView(), null));
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Log.html", WebAdminStrings.WA_Title_Log, () => new View.LogView(), null));
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "AircraftDetailLookupLog.html", WebAdminStrings.WS_Title_AircraftLookup_Log, () => new View.AircraftOnlineLookupLogView(), null));
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "ConnectorActivityLog.html", Strings.ConnectorActivityLog, () => new View.ConnectorActivityLogView(), null));
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Queues.html", WebAdminStrings.WA_Title_Queues, () => new View.QueuesView(), null));
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "About.html", WebAdminStrings.WA_Title_About, () => new View.AboutView(), null));

            // Views that do not have a menu entry
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "Statistics.html", null, () => new View.StatisticsView(), null));

            // Plugin options views
            _WebAdminViewManager.AddWebAdminView(new WebAdminView(pathFromRoot, "WebAdminPluginOptions.html", WebAdminStrings.PluginName, () => new View.WebAdminPluginOptionsView(), null)
            {
                Plugin = this,
            });

            _WebAdminViewManager.RegisterWebAdminViewFolder(PluginFolder, "Web");

            _WebSiteExtender         = Factory.Resolve <IWebSiteExtender>();
            _WebSiteExtender.Enabled = _Options.Enabled;
            _WebSiteExtender.PageHandlers.Add(String.Format("/{0}/ViewMap.json", ProtectedFolder), WebSite_HandleViewMapJson);
            _WebSiteExtender.ProtectFolder(ProtectedFolder);
            _WebSiteExtender.Initialise(parameters);

            var redirection = Factory.ResolveSingleton <IRedirectionConfiguration>();

            redirection.AddRedirection("/WebAdmin", "/WebAdmin/Index.html", RedirectionContext.Any);
            redirection.AddRedirection("/WebAdmin/", "/WebAdmin/Index.html", RedirectionContext.Any);

            ApplyOptions(_Options);
        }