public static void CreateNotifyDialog() { GUIWindow dlg = new LiveScoreNotifyDialog(); dlg.Init(); GUIWindowManager.Add(ref dlg); }
public void Start() { pluginIconPath = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Thumbs, "AirPlayer", "airplay-icon.png"); GUIWindow window = new PhotoWindow(); window.Init(); GUIWindowManager.Add(ref window); photoWindow = (PhotoWindow)window; PluginSettings settings = new PluginSettings(); allowVolumeControl = settings.AllowVolume; sendCommands = settings.SendCommands; allowHDStreams = settings.AllowHDStreams; videoBuffer = settings.VideoBuffer; airtunesServer = new RaopServer(settings.ServerName, settings.Password); airtunesServer.MacAddress = settings.CustomAddress; airtunesServer.Port = settings.RtspPort; airtunesServer.AudioPort = settings.UdpPort; airtunesServer.AudioBufferSize = (int)(settings.AudioBuffer * 1000); airtunesServer.StreamStarting += airtunesServer_StreamStarting; airtunesServer.StreamReady += airtunesServer_StreamReady; airtunesServer.StreamStopped += airtunesServer_StreamStopped; airtunesServer.PlaybackProgressChanged += airtunesServer_PlaybackProgressChanged; airtunesServer.MetaDataChanged += airtunesServer_MetaDataChanged; airtunesServer.ArtworkChanged += airtunesServer_ArtworkChanged; if (allowVolumeControl) { airtunesServer.VolumeChanged += airtunesServer_VolumeChanged; } airtunesServer.Start(); airplayServer = new AirplayServer(settings.ServerName, settings.Password); airplayServer.MacAddress = settings.CustomAddress; airplayServer.Port = settings.AirplayPort; airplayServer.iOS8Workaround = settings.iOS8Workaround; airplayServer.ShowPhoto += airplayServer_ShowPhoto; airplayServer.VideoReceived += airplayServer_VideoReceived; airplayServer.PlaybackInfoRequested += airplayServer_PlaybackInfoRequested; airplayServer.GetPlaybackPosition += airplayServer_GetPlaybackPosition; airplayServer.PlaybackPositionChanged += airplayServer_PlaybackPositionChanged; airplayServer.PlaybackRateChanged += airplayServer_PlaybackRateChanged; if (allowVolumeControl) { airplayServer.VolumeChanged += airplayServer_VolumeChanged; } airplayServer.SessionStopped += airplayServer_SessionStopped; airplayServer.Start(); g_Player.PlayBackChanged += g_Player_PlayBackChanged; g_Player.PlayBackStopped += g_Player_PlayBackStopped; g_Player.PlayBackEnded += g_Player_PlayBackEnded; GUIWindowManager.OnNewAction += GUIWindowManager_OnNewAction; }
public override bool Init() { Settings.Load(); History.Instance.ToString(); GUIWindow window = (GUIWindow)guiWindowChat; GUIWindowManager.Add(ref window); guiWindowChat.Init(); if (Settings.autoConnectStartup) { Helper.JABBER_CLIENT.Login(); } return(Load(Helper.SKIN_FILE_MAIN)); }
public static void LoadWindowPlugin(string strFile) { if (!IsPlugInEnabled(strFile)) { return; } try { Assembly assem = Assembly.LoadFrom(strFile); if (assem != null) { Log.Info("PluginManager: '{0}' file version: {1}", strFile, FileVersionInfo.GetVersionInfo(strFile).ProductVersion); Type[] types = assem.GetExportedTypes(); if (types.Any(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(GUIWindow))) && !CompatibilityManager.IsPluginCompatible(assem)) { Log.Error("PluginManager: '{0}' is tagged as incompatible with the current MediaPortal version and won't be loaded!", assem.FullName); _incompatibilities.Add(assem); } else { //MarkPluginAsCompatible(assem); foreach (Type t in types) { try { if (t.IsClass) { if (t.IsAbstract) { continue; } Object newObj = null; if (t.IsSubclassOf(typeof(GUIWindow))) { try { if (!CompatibilityManager.IsPluginCompatible(t)) { Log.Error("PluginManager: {0} is tagged as incompatible with the current MediaPortal version and won't be loaded!", t.FullName); _incompatibilities.Add(t); continue; } newObj = Activator.CreateInstance(t); var win = (GUIWindow)newObj; if (win.GetID >= 0 && IsWindowPlugInEnabled(win.GetType().ToString())) { try { win.Init(); _guiPlugins.Add(win); } catch (Exception ex) { Log.Error("Error initializing window:{0} {1} {2} {3}", win.ToString(), ex.Message, ex.Source, ex.StackTrace); } GUIWindowManager.Add(ref win); } } catch (Exception guiWindowsException) { Log.Error("Exception while loading GUIWindows instances: {0}", t.FullName); Log.Error(guiWindowsException.Message); Log.Error(guiWindowsException.StackTrace); } } TypeFilter myFilter2 = MyInterfaceFilter; Type[] foundInterfaces; try { foundInterfaces = t.FindInterfaces(myFilter2, "MediaPortal.GUI.Library.ISetupForm"); if (foundInterfaces.Length > 0) { if (newObj == null) { newObj = Activator.CreateInstance(t); } var setup = (ISetupForm)newObj; if (!PluginEntryExists(setup.PluginName())) { Log.Info("PluginManager: {0} {1} not found in Mediaportal.xml so adding it now", setup.PluginName(), t.Assembly.ManifestModule.Name); AddPluginEntry(setup.PluginName(), t.Assembly.ManifestModule.Name); } if (IsPluginNameEnabled(setup.PluginName())) { _setupForms.Add(setup); } } } catch (Exception iSetupFormException) { Log.Error("Exception while loading ISetupForm instances: {0}", t.FullName); Log.Error(iSetupFormException.Message); Log.Error(iSetupFormException.StackTrace); } try { foundInterfaces = t.FindInterfaces(myFilter2, "MediaPortal.GUI.Library.IWakeable"); if (foundInterfaces.Length > 0) { if (newObj == null) { newObj = Activator.CreateInstance(t); } var setup = (IWakeable)newObj; if (PluginEntryExists(setup.PluginName()) && IsPluginNameEnabled(setup.PluginName())) { _wakeables.Add(setup); } } } catch (Exception iWakeableException) { Log.Error("Exception while loading IWakeable instances: {0}", t.FullName); Log.Error(iWakeableException.Message); Log.Error(iWakeableException.StackTrace); } } } catch (NullReferenceException) {} } } } } catch (BadImageFormatException) { } catch (Exception ex) { Log.Info("PluginManager: Plugin file {0} is broken or incompatible with the current MediaPortal version and won't be loaded!", strFile.Substring(strFile.LastIndexOf(@"\", StringComparison.Ordinal) + 1)); Log.Info("PluginManager: Exception: {0}", ex); } }