コード例 #1
0
ファイル: UserMetaData.cs プロジェクト: aqzou/MyGeneration
        public void EditSingle(MyMeta.Single obj, string niceName)
        {
            this.single = obj;

            DataSet   ds = new DataSet();
            DataTable dt = new DataTable("this");

            dt.Columns.Add("this", Type.GetType("System.Object"));
            ds.Tables.Add(dt);
            dt.Rows.Add(new object[] { this });

            dt = new DataTable("MyData");
            DataColumn k = dt.Columns.Add("Key", stringType);

            k.AllowDBNull = false;
            DataColumn v = dt.Columns.Add("Value", stringType);

            v.AllowDBNull = false;
            ds.Tables.Add(dt);

            UniqueConstraint pk = new UniqueConstraint(k, false);

            dt.Constraints.Add(pk);
            ds.EnforceConstraints = true;

            this.txtNiceName.Enabled = true;

            this.col_0.HeaderText      = "Key";
            this.col_0.TextBox.Enabled = true;

            this.col_1.HeaderText  = "Value";
            this.col_1.MappingName = "Value";

            this.txtNiceName.Text = niceName;
            this.txtNiceName.Tag  = obj;

            IPropertyCollection properties = obj.Properties;
            DataRowCollection   rows       = dt.Rows;

            foreach (IProperty prop in properties)
            {
                rows.Add(new object[] { prop.Key, prop.Value });
            }

            dt.AcceptChanges();

            this.Grid.DataSource = dt.DefaultView;
            this.InitializeGrid();

            this.col_0.TextBox.BorderStyle = BorderStyle.None;
            this.col_1.TextBox.BorderStyle = BorderStyle.None;

            this.col_0.TextBox.Move += new System.EventHandler(this.ColorTextBox);
            this.col_1.TextBox.Move += new System.EventHandler(this.ColorTextBox);

            dt.RowChanged  += new DataRowChangeEventHandler(PropertyGridRowChanged);
            dt.RowDeleting += new DataRowChangeEventHandler(PropertyGridRowDeleting);
            dt.RowDeleted  += new DataRowChangeEventHandler(PropertyGridRowDeleted);
        }
コード例 #2
0
 public Template(Language language, string baseNamespace, MyMeta.Single tableOrView)
     : this(language, baseNamespace)
 {
     this.table = tableOrView as ITable;
     if (this.table == null)
     {
         this.view = tableOrView as IView;
     }
 }
コード例 #3
0
ファイル: UserMetaData.cs プロジェクト: aqzou/MyGeneration
        private void CollectionGridRowChangedEvent(object sender, DataRowChangeEventArgs e)
        {
            MyMeta.Single obj = e.Row["obj"] as MyMeta.Single;
            obj.Alias = e.Row["Alias"] as string;

            e.Row.Table.RowChanged -= new DataRowChangeEventHandler(CollectionGridRowChanged);
            e.Row["Alias"]          = obj.Alias;
            e.Row.Table.RowChanged += new DataRowChangeEventHandler(CollectionGridRowChanged);
            MarkAsDirty(true);
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: junalmeida/tenor-framework
        private void LoadStep4()
        {
            //Can start generating files.
            this.Enabled      = true;
            progressBar.Value = 0;

            txtProgress.Text = "Generating classes...";
            Application.DoEvents();
            TreeNode[] nodes = GetCheckedNodes();
            progressBar.Maximum = nodes.Length - 1;

            Language language = (Language)cmbLanguage.SelectedIndex;

            switch (language)
            {
            case Language.CSharp:
                myMeta.Language = "C#";
                break;

            case Language.VBNet:
                myMeta.Language = "VB.NET";
                break;

            default:
                break;
            }


            for (int i = 0; i < nodes.Length; i++)
            {
                MyMeta.Single item = GetItem(nodes[i]);
                txtProgress.Text += "\r\nGenerating " + item.Name + "... ";
                int index = txtProgress.Lines.Length - 1;
                txtProgress.SelectionStart = txtProgress.Text.LastIndexOf("\r\n");
                txtProgress.ScrollToCaret();

                progressBar.Value = i;

                Application.DoEvents();
                string result = null;
                try
                {
                    Template t = new Template(language, txtNamespace.Text, item);
                    t.Generate(txtTargetFolder.Text);
                    result = "Done.";
                }
                catch (Exception ex)
                {
                    result = ex.Message;
                }
                txtProgress.Text += result;
            }

            txtProgress.Text += "\r\nProcess complete. You can close this wizard.";
            ProcessStartInfo pInfo = new ProcessStartInfo();

            pInfo.UseShellExecute = true;
            pInfo.FileName        = txtTargetFolder.Text;
            Process.Start(pInfo);
            Application.DoEvents();
            btnBack.Enabled = false;
        }