/// <summary> /// Deserializes xml markup from file into an attributes object /// </summary> /// <param name = "fileName">string xml file to load and deserialize</param> /// <param name = "obj">Output attributes object</param> /// <param name = "exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out Attributes obj, out Exception exception) { exception = null; obj = default(Attributes); try { obj = LoadFromFile(fileName); return true; } catch (Exception ex) { exception = ex; return false; } }
public static bool LoadFromFile(string fileName, out Attributes obj) { Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
public static bool Deserialize(string xml, out Attributes obj) { Exception exception = null; return Deserialize(xml, out obj, out exception); }
/// <summary> /// Deserializes workflow markup into an attributes object /// </summary> /// <param name = "xml">string workflow markup to deserialize</param> /// <param name = "obj">Output attributes object</param> /// <param name = "exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out Attributes obj, out Exception exception) { exception = null; obj = default(Attributes); try { obj = Deserialize(xml); return true; } catch (Exception ex) { exception = ex; return false; } }
//TODO: Need to use "last attribute" somehow for measures without attributes set /// <summary> /// Render the attributes of a measure /// </summary> /// <param name="attributes">The attributes object to render</param> /// <param name="c">The canvas to render onto</param> /// <param name="staff">The staff being rendered for</param> /// <returns>A canvas with the attributes of a measure rendered onto it</returns> private static Panel RenderAttributes(Attributes attributes, int staff, double fontSize) { Panel grid = WPFRendering.CreateAutoSizingGrid(); double left = 0; //todo: render multiple clefs because of multi-line parts FrameworkElement element = RenderClef(attributes.clef[0], fontSize); element.Margin = new Thickness(fontSize * 2 / 3, 0, 0, 0); grid.Children.Add(element); left += fontSize * 2 / 3; //todo: render key signature element = RenderKeySignature(fontSize); element.Margin = new Thickness(left, 0, 0, 0); grid.Children.Add(element); left += element.ActualWidth; //todo: render time signature element = RenderTimeSignature(attributes.time[staff], fontSize); element.Margin = new Thickness(left, WPFRendering.GetFontFraction(9, fontSize), 0, 0); grid.Children.Add(element); left += element.ActualWidth; grid.VerticalAlignment = VerticalAlignment.Top; WPFRendering.RecalculateSize(grid); return grid; }
public static bool LoadFromFile(string fileName, out Attributes obj) { Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }
public static bool Deserialize(string xml, out Attributes obj) { Exception exception = null; return(Deserialize(xml, out obj, out exception)); }