コード例 #1
0
        private void Initialize() {
            Instance = this;
            InitializeComponent();
            Kernel.Init(KernelLoadDirective.ShadowPlugins);
            Logger.ReportVerbose("======= Kernel intialized. Building window...");
            commonConfig = Kernel.Instance.CommonConfigData;
            PopUpMsg = new PopupMsg(alertText);

            //Logger.ReportVerbose("======= Loading combo boxes...");
            lblVersion.Content = lblVersion2.Content = "Version " + Kernel.Instance.VersionStr;

            //Logger.ReportVerbose("======= Refreshing Ext Players...");
            RefreshPlayers();

            //Logger.ReportVerbose("======= Loading Config Settings...");
            LoadConfigurationSettings();
            //Logger.ReportVerbose("======= Config Settings Loaded.");

            for (char c = 'D'; c <= 'Z'; c++) {
                daemonToolsDrive.Items.Add(c.ToString());
            }

            try {
                daemonToolsDrive.SelectedValue = commonConfig.DaemonToolsDrive;
            } catch {
                // someone bodged up the config
            }

            //daemonToolsLocation.Content = config.DaemonToolsLocation; /// old
            daemonToolsLocation.Text = commonConfig.DaemonToolsLocation;


            //Logger.ReportVerbose("======= Refreshing Extender Formats...");
            RefreshExtenderFormats();
            //Logger.ReportVerbose("======= Refreshing Display Settings...");
            RefreshDisplaySettings();
            //Logger.ReportVerbose("======= Saving Config...");
            SaveConfig();

            //Logger.ReportVerbose("======= Initialize Finised.");
        }
コード例 #2
0
        private void Initialize() {
            Instance = this;
            InitializeComponent();
            Kernel.Init(KernelLoadDirective.ShadowPlugins);
            if (!Kernel.ServerConnected)
            {
                Async.Queue("error", () => MessageBox.Show("Cannot connect to the MB3 server.  Please start it or configure address.", "Cannot find server"));
                // Hide plug-in tab because we can't get to them
                plugins.Visibility = Visibility.Collapsed;
            }
            else
            {
                var user = Kernel.AvailableUsers.OrderBy(u => u.Name).FirstOrDefault();
                Kernel.CurrentUser = new User { Name = user.Name, Id = new Guid(user.Id ?? ""), Dto = user, ParentalAllowed = user.HasPassword };
            }
            //Kernel.Instance.LoadUserConfig();
            Kernel.Instance.LoadPlugins();
            Logger.ReportVerbose("======= Kernel intialized. Building window...");
            commonConfig = Kernel.Instance.CommonConfigData;
            pluginList.MouseDoubleClick += pluginList_DoubleClicked;
            PopUpMsg = new PopupMsg(alertText);
            //config = Kernel.Instance.ConfigData;

            //Logger.ReportVerbose("======= Loading combo boxes...");
            LoadComboBoxes();
            lblVersion.Content = lblVersion2.Content = "Version " + Kernel.Instance.VersionStr;

            //Logger.ReportVerbose("======= Refreshing Podcasts...");
            //RefreshPodcasts();
            //Logger.ReportVerbose("======= Refreshing Ext Players...");
            RefreshPlayers();

            //Logger.ReportVerbose("======= Loading Config Settings...");
            LoadConfigurationSettings();
            //Logger.ReportVerbose("======= Config Settings Loaded.");

            for (char c = 'D'; c <= 'Z'; c++) {
                daemonToolsDrive.Items.Add(c.ToString());
            }

            try {
                daemonToolsDrive.SelectedValue = commonConfig.DaemonToolsDrive;
            } catch {
                // someone bodged up the config
            }

            //daemonToolsLocation.Content = config.DaemonToolsLocation; /// old
            daemonToolsLocation.Text = commonConfig.DaemonToolsLocation;


            //Logger.ReportVerbose("======= Refreshing Extender Formats...");
            RefreshExtenderFormats();
            //Logger.ReportVerbose("======= Refreshing Display Settings...");
            RefreshDisplaySettings();
            //Logger.ReportVerbose("======= Saving Config...");
            SaveConfig();

            LoadAvailablePlugins();
            //Logger.ReportVerbose("======= Kicking off validations thread...");
            //Async.Queue("Startup Validations", () =>
            //{
            //    //RefreshEntryPoints(false);
            //    ValidateMBAppDataFolderPermissions();
            //});
            //Logger.ReportVerbose("======= Initialize Finised.");
        }
コード例 #3
0
        private void Initialize()
        {
            Instance = this;
            Kernel.Init(KernelLoadDirective.ShadowPlugins);
            ratings = new Ratings();
            //Logger.ReportVerbose("======= Kernel intialized. Building window...");
            InitializeComponent();
            pluginList.MouseDoubleClick += pluginList_DoubleClicked;
            PopUpMsg = new PopupMsg(alertText);
            config = Kernel.Instance.ConfigData;
            //put this check here because it will run before the first run of MB and we need it now
            if (config.MBVersion != Kernel.Instance.Version.ToString() && Kernel.Instance.Version.ToString() == "2.3.0.0")
            {
                try
                {
                    config.PluginSources.RemoveAt(config.PluginSources.FindIndex(s => s.ToLower() == "http://www.mediabrowser.tv/plugins/plugin_info.xml"));
                }
                catch
                {
                    //wasn't there - no biggie
                }
                if (config.PluginSources.Find(s => s == "http://www.mediabrowser.tv/plugins/multi/plugin_info.xml") == null)
                {
                    config.PluginSources.Add("http://www.mediabrowser.tv/plugins/multi/plugin_info.xml");
                    Logger.ReportInfo("Plug-in Source migrated to multi-version source");
                }
                //not going to re-set version in case there is something we want to do in MB itself
            }

            //Logger.ReportVerbose("======= Loading combo boxes...");
            LoadComboBoxes();
            lblVersion.Content = lblVersion2.Content = "Version " + Kernel.Instance.VersionStr;

            //we're showing, but disabling the media collection detail panel until the user selects one
            infoPanel.IsEnabled = false;

            // first time the wizard has run
            if (config.InitialFolder != ApplicationPaths.AppInitialDirPath) {
                try {
                    MigrateOldInitialFolder();
                } catch {
                    MessageBox.Show("For some reason we were not able to migrate your old initial path, you are going to have to start from scratch.");
                }
            }

            config.InitialFolder = ApplicationPaths.AppInitialDirPath;
            //Logger.ReportVerbose("======= Refreshing Items...");
            RefreshItems();
            //Logger.ReportVerbose("======= Refreshing Podcasts...");
            RefreshPodcasts();
            //Logger.ReportVerbose("======= Refreshing Ext Players...");
            RefreshPlayers();

            //Logger.ReportVerbose("======= Loading Config Settings...");
            LoadConfigurationSettings();
            //Logger.ReportVerbose("======= Config Settings Loaded.");

            for (char c = 'D'; c <= 'Z'; c++) {
                daemonToolsDrive.Items.Add(c.ToString());
            }

            try {
                daemonToolsDrive.SelectedValue = config.DaemonToolsDrive;
            } catch {
                // someone bodged up the config
            }

            //daemonToolsLocation.Content = config.DaemonToolsLocation; /// old
            daemonToolsLocation.Text = config.DaemonToolsLocation;

            //Logger.ReportVerbose("======= Refreshing Extender Formats...");
            RefreshExtenderFormats();
            //Logger.ReportVerbose("======= Refreshing Display Settings...");
            RefreshDisplaySettings();
            //Logger.ReportVerbose("======= Podcast Details...");
            podcastDetails(false);
            //Logger.ReportVerbose("======= Saving Config...");
            SaveConfig();

            //Logger.ReportVerbose("======= Initializing Plugin Manager...");
            PluginManager.Instance.Init();
            //Logger.ReportVerbose("======= Loading Plugin List...");
            CollectionViewSource src = new CollectionViewSource();
            src.Source = PluginManager.Instance.InstalledPlugins;
            src.GroupDescriptions.Add(new PropertyGroupDescription("PluginClass"));

            pluginList.ItemsSource = src.View;

            //pluginList.Items.Refresh();

            //Logger.ReportVerbose("======= Kicking off plugin update check thread...");
            Async.Queue("Plugin Update Check", () =>
            {
                using (new MediaBrowser.Util.Profiler("Plugin update check"))
                {
                    while (!PluginManager.Instance.PluginsLoaded) { } //wait for plugins to load
                    ForceUpgradeCheck(); //remove incompatable plug-ins
                    if (PluginManager.Instance.UpgradesAvailable())
                        Dispatcher.Invoke(DispatcherPriority.Background, (System.Windows.Forms.MethodInvoker)(() =>
                        {
                            PopUpMsg.DisplayMessage("Some of your plug-ins have upgrades available.");
                        }));
                }
            });

            SupportImprovementNag();

            //Logger.ReportVerbose("======= Kicking off validations thread...");
            Async.Queue("Startup Validations", () =>
            {
                RefreshEntryPoints(false);
                ValidateMBAppDataFolderPermissions();
            });
            //Logger.ReportVerbose("======= Initialize Finised.");
        }