public MNReferencedCore FindContentObject(SMContentType type, string contentId) { MNReferencedCore value = null; //Debugger.Log(0, "", "--FindContentObject: A\n"); if (CurrentDocument.CurrentLanguage != null) { //Debugger.Log(0, "", "--FindContentObject: B\n"); value = CurrentDocument.CurrentLanguage.FindObject(contentId); } if (value == null) { if (CurrentDocument.DefaultLanguage != null) { //Debugger.Log(0, "", "--FindContentObject: DEFAULT B\n"); value = CurrentDocument.DefaultLanguage.FindObject(contentId); } } if (value == null && type == SMContentType.Text) { //Debugger.Log(0, "", "--FindContentObject: C\n"); MNReferencedText rt = CurrentDocument.FindText(contentId); if (rt != null) { //Debugger.Log(0, "", "--FindContentObject: D\n"); MNReferencedText str = new MNReferencedText(); str.Text = rt.Text; value = str; } } return(value); }
public void SetValue(string key, MNReferencedCore value) { Modified = true; if (Nodes.ContainsKey(key)) { Nodes[key] = value; } else { Nodes.Add(key, value); } }
public override void Load(RSFileReader br) { int count = br.ReadInt32(); string key = ""; string objType = ""; Nodes.Clear(); for (int i = 0; i < count; i++) { MNReferencedCore obj = null; key = br.ReadString(); objType = br.ReadString(); obj = GOFile.CreateInstance(objType); obj.Load(br); Nodes.Add(key, obj); } }
/// <summary> /// Reloading language localizations for all controls /// </summary> public void ReloadPage(bool resetStatus) { if (CurrentDocument != null && p_current_page != null) { Context.messageBox.Visible = p_current_page.ShowMessageAlways; if (resetStatus) { p_current_page.ResetStatus(); } // reinitialize status if (p_current_page.InitialStatus == null) { p_current_page.StoreStatus(); } // load content for all controls foreach (SMControl control in p_current_page.Objects) { if (control.ContentId != null && control.ContentId.Length > 0) { //Debugger.Log(0,"", "NEED LOAD CONTENT: " + control.ContentId + "\n"); MNReferencedCore value = FindContentObject(control.ContentType, control.ContentId); control.Content = value; if (value != null && value is MNReferencedAudioText) { p_current_runtext = value as MNReferencedAudioText; p_current_runtext.currentWord = 0; timerRuntext.Interval = p_current_runtext.GetCurrentTimeInterval(); timerRuntext.Start(); PlaySound(p_current_runtext.Sound); Invalidate(); } else if (value != null && value is MNReferencedSound) { PlaySound(value as MNReferencedSound); } } } } }
public MNReferencedCore FindObject(string path) { Debugger.Log(0, "", "FIND OBJECT AT PATH: " + path + "\n"); string[] p = null; if (path.IndexOf('/') >= 0) { p = path.Split('/'); } else { p = new string[] { path }; } GOFNodes data = Data; MNReferencedCore value = null; foreach (string component in p) { if (data == null) { return(null); } value = data.GetValue(component); if (value is GOFNodes) { data = (GOFNodes)value; } else { data = null; } if (value != null) { Debugger.Log(0, "", "Value [" + component + "] from path '" + path + "' found\n"); } } return(value); }
public static string InstanceToTag(MNReferencedCore obj) { if (obj is GOFNodes) { return("Nodes"); } if (obj is MNReferencedText) { return("String"); } if (obj is GOFImage) { return("Image"); } if (obj is MNReferencedAudioText) { return("RunningText"); } if (obj is MNReferencedSound) { return("Sound"); } return("Core"); }