public void GraphicObject() { string [] tests = new string [] { "0", "1", "3", "4", "5" }; foreach (string s in tests) { string fileName = Path.Combine("Interfaces", s + ".crow"); iface.AddWidget(fileName); iface.Update(); iface.Update(); using (Cairo.Surface surf = new Cairo.ImageSurface(iface.bmp, Cairo.Format.Argb32, iface.ClientRectangle.Width, iface.ClientRectangle.Height, iface.ClientRectangle.Width * 4)) { surf.WriteToPng(@"tmp.png"); surf.WriteToPng(fileName + ".png"); } byte [] model = File.ReadAllBytes("ExpectedOutputs/" + s + ".png"); byte [] result = File.ReadAllBytes(@"tmp.png"); //CollectionAssert.AreEqual (model, result); iface.ClearInterface(); } }
void reload_iTor(Instantiator new_iTot) { itor = new_iTot; lock (imlVE.UpdateMutex) { try { imlVE.ClearInterface(); if (itor != null) { imlVE.AddWidget(itor.CreateInstance(imlVE)); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } }
// DockWindow loadDockWindow(string path){ // lock (MainIFace.UpdateMutex) { // GraphicObject g = MainIFace.FindByName (path); // if (g == null){ // try { // g = MainIFace.Load (path); // mainDock.AddChild (g); // g.Name = path; // g.DataSource = CurrentSolution; // } catch (Exception ex) { // System.Diagnostics.Debug.WriteLine (ex.ToString ()); // } // } // return g as DockWindow; // } // } Window loadWindow(string path, object dataSource = null) { try { GraphicObject g = MainIFace.FindByName(path); if (g != null) { return(g as Window); } g = MainIFace.AddWidget(path); g.Name = path; g.DataSource = dataSource; return(g as Window); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } return(null); }
bool tryAddObjectTo(ILayoutable parent, Widget go) { if (go == null) { return(false); } // lock (imlVE.UpdateMutex) { Interface i = null; if (parent == null) { i = imlVE; } else { i = parent as Interface; } if (i != null) { if (i.GraphicTree.Count > 0) { return(false); } i.AddWidget(go); imlProjFile.Instance = go; EditorIsDirty = true; return(true); } Container c = parent as Container; if (c != null) { if (c.Child != null) { return(false); } //return tryAddObjectTo (c.Parent, go); c.SetChild(go); EditorIsDirty = true; return(true); } TemplatedContainer tc = parent as TemplatedContainer; if (tc != null) { if (tc.Content != null) { return(false); } //return tryAddObjectTo (c.Parent, go); tc.Content = (go); EditorIsDirty = true; return(true); } Group g = parent as Group; if (g != null) { g.AddChild(go); EditorIsDirty = true; return(true); } return(false); //tryAddObjectTo (parent.Parent, go); // } }