/// <summary> /// This method is used in StandAlone mode to set the content to be /// displayed in various displays. /// </summary> /// <param name="obj">The content object to display</param> /// <returns>Returns true if the entire display chain has successfully /// set its content to the object passed in</returns> public bool SetContent(IContentOperations obj) { bool result = true; if (XmlRpcProxy != null) { // This is a "client" display, and must relay its content to the "server" peer result = XmlRpcProxy.SetContent(obj.GetIdentity()); } // Note: We intentionaly don't pass a clone of the object because we want the whole // chain to share a single object reference and be in sync. if (result && NextDisplay != null) { result = NextDisplay.SetContent(obj); } if (result) { content = obj; return(this.UpdateDisplay(false)); } else { return(false); } }
private ThemeWidget getWidget() { IContentOperations content = _display.content; if (content != null) { switch ((ContentType)content.GetIdentity().Type) { case ContentType.Song: return(_mainform.songThemeWidget); break; case ContentType.PlainText: return(_mainform.sermonThemeWidget); break; case ContentType.BibleVerseIdx: case ContentType.BibleVerseRef: case ContentType.BibleVerse: return(_mainform.bibleThemeWidget); break; } } return(new ThemeWidget()); }
private void Options_Load(object sender, System.EventArgs e) { IContentOperations content = _MainForm.DisplayPreview.content; if (content != null) { content.ShowRectangles = true; } _MainForm.DisplayPreview.UpdateDisplay(true); this.PopulateControls(_MainForm.Config); }
/// <summary> /// If this display is a remote server it will receive a description of the content, /// and will have to create a content object based on that. We don't want to send /// actual objects to remote servers. /// </summary> /// <param name="identity">A "description" of the content</param> public bool SetContent(ContentIdentity identity) { IContentOperations newContent = null; bool success = true; try { switch ((ContentType)identity.Type) { case ContentType.BibleVerseIdx: newContent = new ABibleVerse(bibleLib[identity.BibleTransl], identity.VerseIdx, Display.config); break; case ContentType.BibleVerseRef: BibleVersion bible = bibleLib[identity.BibleTransl]; int idx = bible.GetVerseIndex(identity.VerseRef); newContent = new ABibleVerse(bible, idx, Display.config); break; case ContentType.PlainText: newContent = new TextToolContents(identity.Text, Display.config); break; case ContentType.Song: string songFile = DreamTools.GetDirectory(DirType.Songs, identity.SongName); newContent = (Song)Song.DeserializeFrom(songFile, identity.SongStrophe, Display.config); break; } } catch { } // Covers a multitude of sins (non-existent translation, or song, or verse, etc...) if (newContent != null) { if (NextDisplay != null) { success = NextDisplay.SetContent(newContent); } if (success) { this.content = newContent; success = this.UpdateDisplay(false); } } else { success = false; } return(success); }
public FeedController() { ninjectKernel = new StandardKernel(new NinjectConfig()); COperations = ninjectKernel.Get <IContentOperations>(); }
private void Options_OkBtn_Click(object sender, System.EventArgs e) { Config config = new Config(); this._MainForm.Config = config; config.Alphablending = this.Alpha_CheckBox.Checked; config.PreRender = this.PreRendercheckBox.Checked; config.BlendSpeed = (int)Speed_Updown.Value; config.useDirect3D = this.Direct3D_CheckBox.Checked; config.BackgroundColor = this.showBeamBackground; if (config.BackgroundColor.IsEmpty) { config.BackgroundColor = Color.Black; } if (SizePosControl.SelectedIndex == 0) { config.BeamBoxAutoPosSize = true; } else { config.BeamBoxAutoPosSize = false; } if (config.BeamBoxAutoPosSize && ScreenList.SelectedIndex >= 0) { config.BeamBoxScreenNum = ScreenList.SelectedIndex; Rectangle r = System.Windows.Forms.Screen.AllScreens[ScreenList.SelectedIndex].Bounds; config.BeamBoxPosX = r.X; config.BeamBoxPosY = r.Y; config.BeamBoxSizeX = r.Width; config.BeamBoxSizeY = r.Height; } else { config.BeamBoxPosX = (int)this.BeamBox_posX.Value; config.BeamBoxPosY = (int)this.BeamBox_posY.Value; config.BeamBoxSizeX = (int)this.BeamBox_Width.Value; config.BeamBoxSizeY = (int)this.BeamBox_Height.Value; } // We need to update all displays with the new size. // They use this size to generate the bitmaps. this._MainForm.UpdateDisplaySizes(); config.SwordPath = this.Sword_PathBox.Text; if (!String.IsNullOrEmpty(this.Sword_LanguageBox.Text)) { config.BibleLang = this.Sword_LanguageBox.Text; SetBibleLocale(this._MainForm.bibles, config.SwordPath, config.BibleLang); } if (this.verseSep2L.Checked) { config.SongVerseSeparator = SongVerseSeparator.TwoBlankLines; } else { config.SongVerseSeparator = SongVerseSeparator.OneBlankLine; } config.HideMouse = this.BeamBox_HideMouse.Checked; config.AlwaysOnTop = this.BeamBox_AlwaysOnTop.Checked; switch (LanguageList.SelectedIndex) { case 0: config.Language = "en"; break; case 1: config.Language = "de"; break; } config.RememberPanelLocations = this.Options_PanelLocations_checkBox.Checked; //config.theme.Song = this.songThemeWidget.Theme as SongTheme; //config.theme.Bible = this.bibleFormatWidget.Theme as BibleTheme; //config.theme.Sermon = this.sermonThemeWidget.Theme as SermonTheme; IContentOperations content = _MainForm.DisplayPreview.content; if (content != null) { content.ShowRectangles = false; } config.ServerAddress = this.ServerAddress.Text; config.ListeningPort = (int)this.ListeningPort.Value; OperatingMode oldMode = config.AppOperatingMode; if (this.OperatingMode_StandAlone.Checked) { config.AppOperatingMode = OperatingMode.StandAlone; } else if (this.OperatingMode_Client.Checked) { config.AppOperatingMode = OperatingMode.Client; } else if (this.OperatingMode_Server.Checked) { config.AppOperatingMode = OperatingMode.Server; } if (oldMode != config.AppOperatingMode) { _MainForm.InitDisplays(); } string s = (String)DefaultSongFormatListBox.SelectedItem; config.DefaultThemes.SongThemePath = Path.Combine("Themes\\", s + ".SongTheme.xml"); s = (String)DefaultSermonFormatListBox.SelectedItem; config.DefaultThemes.SermonThemePath = Path.Combine("Themes\\", s + ".SermonTheme.xml"); s = (String)DefaultBibleFormatListBox.SelectedItem; config.DefaultThemes.BibleThemePath = Path.Combine("Themes\\", s + ".BibleTheme.xml"); config.Options_DataSet = this.Options_DataSet; this.Options_DataSet.WriteXml(DreamTools.GetDirectory(DirType.Config, _MainForm.ConfigSet + ".dataset.config.xml"), XmlWriteMode.WriteSchema); Config.SerializeTo(config, DreamTools.GetDirectory(DirType.Config, _MainForm.ConfigSet + ".config.xml")); this.Close(); }