Esempio n. 1
0
 public static UIElement add_XamlElement(this DesignerCanvas designerCanvas, string xamlCode, int top, int left, int width, int height)
 {
     return((UIElement)designerCanvas.wpfInvoke(
                () => {
         var uiElement = xamlCode.xaml_CreateUIElement();
         return designerCanvas.add_UIElement(uiElement, "", top, left, width, height);
     }));
 }
Esempio n. 2
0
 public static Connection add_Connection(this DesignerCanvas designerCanvas, DesignerItem designerItem1, DesignerItem designerItem2, string position1, string position2)
 {
     return((Connection)designerCanvas.wpfInvoke(
                () => {
         var connector1 = designerItem1.connector(position1);
         var connector2 = designerItem2.connector(position2);
         var connection = new DiagramDesigner.Connection(connector1, connector2);
         designerCanvas.Children.Add(connection);
         return connection;
     }));
 }
Esempio n. 3
0
 public static string save(this DesignerCanvas designerCanvas, string targetFile)
 {
     return((string)designerCanvas.wpfInvoke(
                () => {
         var xElementForSave = designerCanvas.getXElementForSave();
         xElementForSave.Save(targetFile);
         if (targetFile.fileExists())
         {
             return targetFile;
         }
         return "";
     }));
 }
Esempio n. 4
0
 public static T add_DesignerItem <T>(this DesignerCanvas designerCanvas, string newControlContent, int top, int left, int width, int height)
     where T : UIElement
 {
     return((T)designerCanvas.wpfInvoke <DesignerCanvas, T>(
                () => {
         try
         {
             var newControl = (T)typeof(T).ctor();
             return designerCanvas.add_UIElement(newControl, newControlContent, top, left, width, height);
         }
         catch (Exception ex)
         {
             ex.log("in DesignerCanvas add_DesignerItem");
         }
         return default(T);
     }));
 }
Esempio n. 5
0
 public static string open(this DesignerCanvas designerCanvas, string fileToOpen)
 {
     return((string)designerCanvas.wpfInvoke(
                () => {
         if (fileToOpen.fileExists())
         {
             var xRoot = fileToOpen.xRoot();
             if (xRoot.notNull())
             {
                 designerCanvas.Open(xRoot);
             }
             else
             {
                 return "";
             }
         }
         return fileToOpen;
     }));
 }