示例#1
0
 void loadItems()
 {
     try
     {
         var items = Helper.Client.InvokeSync <EJ.InterfaceInModule[]>("GetInterfaceInModule", this.InterfaceItemNode.Module.id.Value);
         foreach (var item in items)
         {
             Type type = typeof(InterfaceItemNode).Assembly.GetType(item.Type);
             if (type == typeof(UI.DescriptionView))
             {
                 DescriptionView view = new DescriptionView("", item);
                 view.LoadJsonData(item.JsonData);
                 view.Margin = new Thickness((double)item.x, (double)item.y, 0, 0);
                 if (item.width != null)
                 {
                     view.Width  = item.width.Value;
                     view.Height = item.height.Value;
                 }
                 m_Grid.Children.Add(view);
             }
             else if (type == typeof(UI.ClassView))
             {
                 ClassView view = new ClassView(item);
                 view.Margin = new Thickness((double)item.x, (double)item.y, 0, 0);
                 m_Grid.Children.Add(view);
             }
         }
         this.Dispatcher.BeginInvoke(new Action(() =>
         {
             foreach (FrameworkElement view in m_Grid.Children)
             {
                 if (view is DescriptionView)
                 {
                     ((DescriptionView)view).LoadConnects();
                 }
             }
         }), System.Windows.Threading.DispatcherPriority.Loaded, null);
     }
     catch (Exception ex)
     {
         Helper.ShowError(ex);
     }
 }
示例#2
0
        void menuitem_添加class_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ClassSelector frm = new ClassSelector(this.InterfaceItemNode.Module.ProjectID.Value);

            if (frm.ShowDialog() == true)
            {
                var          value  = frm.SelectedValue;
                TreeNodeBase parent = value.Parent;
                while (!(parent is EJClient.Forms.InterfaceCenter.Nodes.DLLNode))
                {
                    parent = parent.Parent;
                }
                string filepath = ((EJClient.Forms.InterfaceCenter.Nodes.DLLNode)parent).FilePath;


                EJ.InterfaceInModule data = new EJ.InterfaceInModule()
                {
                    ModuleID = InterfaceItemNode.Module.id,
                    x        = (int)m_RightButtonDownPoint.X,
                    y        = (int)m_RightButtonDownPoint.Y,
                    Type     = typeof(ClassView).FullName,
                };
                UI.ClassView view = new ClassView(value, filepath, data);
                try
                {
                    data.JsonData = view.GetJsonData();
                    data.id       = Helper.Client.InvokeSync <int>("UpdateInterfaceInModule", data);
                    data.ChangedProperties.Clear();

                    view.Margin = new Thickness(m_RightButtonDownPoint.X, m_RightButtonDownPoint.Y, 0, 0);
                    m_Grid.Children.Add(view);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(MainWindow.instance, ex.Message);
                }
            }
        }