zoukankan      html  css  js  c++  java
  • XAF进修二:在XAF中打开自定义的WinForm

    在建造WinForm时须要加上一机关函数和Show办法

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using DevExpress.ExpressApp.Win;
    using DevExpress.ExpressApp;
    
    namespace WinWjXAF.Module.Win
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            public Form1(XafApplication app, DetailViewActionsObject post) : this() {
       // We don""t currently have a singleton reference to the running
       // app in Windows Forms -- will be changed.
       // It would be possible to make changes to WinApplication.cs and
       // a static property manually of course. In this case
       // I want to keep changes in a single area for simplicity,
       // so I""m taking the app reference as a parameter instead.
       using (IObjectSpace os =app.ObjectSpaceProvider.CreateObjectSpace() ){
                    //app.ObjectSpaceProvider.CreateObjectSpace( )) {
        int postCount = os.GetObjectsCount(typeof(DetailViewActionsObject), null);
    
        // Of course we can work with the post that has been passed in
                    //contentLabel.Text =
                    //    String.Format("This post has the title ""{0}"". It""s one of {1} posts.",
                    //    post.Title, postCount);
       }
      }
    
      public static void Show(XafApplication app, DetailViewActionsObject post) {
       using (Form1 form = new Form1(app, post)) {
        form.ShowDialog( );
                }
      }
     }
        }
    
     二、建树ViewController,并在ViewController中添加simpleACtion来浮现它
    
    public partial class CustomFormController : ViewController
        {
            public CustomFormController()
            {
                InitializeComponent();
                RegisterActions(components);
            }
    
            private void simpleAction1_Execute(object sender, SimpleActionuteEventArgs e)
            {
             
                Form1.Show(Application, (DetailViewActionsObject)e.CurrentObject);
            }
        }
  • 相关阅读:
    Fruit HDU
    排列组合 HDU
    XOR and Favorite Number CodeForces
    BZOJ-6-2460: [BeiJing2011]元素-线性基
    CDH 安装与部署
    Apache Hadoop集群搭建
    大数据架构与技术选型
    项目落实方案选择思考(KUDU)
    JAVA 高级篇
    大数据就业岗位
  • 原文地址:https://www.cnblogs.com/ddlzq/p/4500413.html
Copyright © 2011-2022 走看看