void root_Generate(BaseNode node, StringBuilder builder)
 {
     if (this.Generate != null)
     {
         this.Generate(node, builder);
     }
 }
 void root_Refresh(BaseNode node)
 {
     if (this.Refresh != null)
     { this.Refresh(node); }
 }
 public TreeEventSource(BaseNode root)
 {
     root.Refresh += new RefreshDelegate(root_Refresh);
     root.Generate += new GenerateDelegate(root_Generate);
 }
Exemple #4
0
 protected virtual void OnDeleteChild(BaseNode child)
 {
     if (this.Parent.Children.Contains(child))
         this.Parent.OnDeleteChild(child);
 }
Exemple #5
0
        protected virtual void OnGenerate(BaseNode sender, StringBuilder args)
        {
            if (this.EventSource.Generate != null)
            {
                if (!args.ToString().StartsWith("#region COPYRIGHT COMPANY"))
                {
                    var filename = "";
                    var content = args.ToString();

                    var tag = "public class";
                    var tagLength = tag.Length;

                    var tagIndex = content.IndexOf(tag);
                    if (tagIndex < 0)
                    {
                        tag = "public interface";
                        tagLength = tag.Length;
                        tagIndex = content.IndexOf(tag);
                    }
                    if (tagIndex < 0)
                    {
                        tag = "public static class";
                        tagLength = tag.Length;
                        tagIndex = content.IndexOf(tag);
                    }

                    if (tagIndex > -1)
                    {
                        try
                        {
                            content.Substring(tagIndex + tag.Length).ToList().ForEach(
                                c =>
                                {
                                    if (c == ':' || c == '\r' || c == '\n' || c == '{')
                                    {
                                        throw new Exception("终止查找");
                                    }
                                    else
                                    {
                                        filename += c;
                                    }
                                }
                                );
                        }
                        catch
                        {
                        }
                        var coreId = System.Configuration.ConfigurationManager.AppSettings["CoreId"];
                        var crno = System.Configuration.ConfigurationManager.AppSettings["CRNO"];
                        if (crno == null) crno = "";
                        crno = crno.PadLeft(14);

                        filename = filename.Trim();

                        args.Insert(0, string.Format(@"#region COPYRIGHT COMPANY
            /*******************************************************************************
            *                     COPYRIGHT 2014 COMPANY SOLUTIONS, INC
            *                           ALL RIGHTS RESERVED.
            *                     COMPANY SOLUTIONS CONFIDENTIAL PROPRIETARY
            ********************************************************************************
            *
            *   FILE NAME       : {0}.cs
            *
            *--------------------------------- REVISIONS -----------------------------------
            * CR/PR             Core ID   Date        Description
            * ---------------   --------  ----------  --------------------------------------
            * {1}    {2}   {3}   Creation
            *******************************************************************************/
            #endregion", filename, crno, coreId, DateTime.Now.ToString("MM/dd/yyyy")) + "\r\n");
                    }
                }
                this.EventSource.Generate(sender, args);
            }
        }
 void eventSource_Refresh(BaseNode node)
 {
     //TreeNode targetNode = this.GetTreeNodeByTag(node);
     //this.FindModel(this.ProjectTreeNode, node, ref targetNode);
     //if (targetNode != null)
     //{
     //    this.RefreshTreeNode(node, targetNode);
     //    this.treeView1.Update();
     //}
 }
Exemple #7
0
        protected override void OnDeleteChild(BaseNode child)
        {
            if (child is DBModelNode)
            {

            }
            base.OnDeleteChild(child);
        }
 void eventSource_Generate(BaseNode node, StringBuilder builder)
 {
     var frm = new ShowCodeFrm();
     frm.SetText(builder.ToString());
     frm.ShowDialog();
     //this.panelOutput.Controls.Clear();
     ////this.panelWorkArea.Controls.Remove(this.textEditor);
     //this.textEditor = new TextEditorControl();
     //this.textEditor.Dock = DockStyle.Fill;
     //this.panelOutput.Controls.Add(this.textEditor);
     //this.textEditor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("C#");
     ////this.textEditor.Document.Remove(0, this.textEditor.Document.TextLength);
     ////this.textEditor.Validate();
     ////this.textEditor.Update();
     ////this.textEditor.ActiveTextAreaControl.TextArea.Update();
     //this.textEditor.Document.TextContent = builder.ToString();
     ////this.textEditor.Text = builder.ToString();
 }
Exemple #9
0
 public virtual bool CaptureMovedNode(BaseNode node)
 {
     return true;
 }
Exemple #10
0
 public virtual void CaptureIO(BaseNode node)
 {
 }
Exemple #11
0
 public virtual bool CanCapture(BaseNode node)
 {
     return false;
 }
Exemple #12
0
        protected virtual void OnGenerate(BaseNode sender, StringBuilder args)
        {
            if (this.EventSource.Generate != null)
            {
                if (!args.ToString().StartsWith("#region COPYRIGHT COMPANY"))
                {
                    var filename = "";
                    var content  = args.ToString();

                    var tag       = "public class";
                    var tagLength = tag.Length;

                    var tagIndex = content.IndexOf(tag);
                    if (tagIndex < 0)
                    {
                        tag       = "public interface";
                        tagLength = tag.Length;
                        tagIndex  = content.IndexOf(tag);
                    }
                    if (tagIndex < 0)
                    {
                        tag       = "public static class";
                        tagLength = tag.Length;
                        tagIndex  = content.IndexOf(tag);
                    }

                    if (tagIndex > -1)
                    {
                        try
                        {
                            content.Substring(tagIndex + tag.Length).ToList().ForEach(
                                c =>
                            {
                                if (c == ':' || c == '\r' || c == '\n' || c == '{')
                                {
                                    throw new Exception("终止查找");
                                }
                                else
                                {
                                    filename += c;
                                }
                            }
                                );
                        }
                        catch
                        {
                        }
                        var coreId = System.Configuration.ConfigurationManager.AppSettings["CoreId"];
                        var crno   = System.Configuration.ConfigurationManager.AppSettings["CRNO"];
                        if (crno == null)
                        {
                            crno = "";
                        }
                        crno = crno.PadLeft(14);

                        filename = filename.Trim();

                        args.Insert(0, string.Format(@"#region COPYRIGHT COMPANY
/*******************************************************************************
*                     COPYRIGHT 2014 COMPANY SOLUTIONS, INC
*                           ALL RIGHTS RESERVED.
*                     COMPANY SOLUTIONS CONFIDENTIAL PROPRIETARY
********************************************************************************
*
*   FILE NAME       : {0}.cs
*
*--------------------------------- REVISIONS -----------------------------------
* CR/PR             Core ID   Date        Description
* ---------------   --------  ----------  --------------------------------------
* {1}    {2}   {3}   Creation
*******************************************************************************/
#endregion", filename, crno, coreId, DateTime.Now.ToString("MM/dd/yyyy")) + "\r\n");
                    }
                }
                this.EventSource.Generate(sender, args);
            }
        }