using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml; using Dongke.IBOSS.Basics.FlowSetting; using Dongke.IBOSS.PRD.WCF.Proxys; namespace FlowSettingTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); this.flowBox1.NodeDoubleClick += flowBox1_NodeDoubleClick; textBox1.Text = this.flowBox1.CanvasSize.Width.ToString(); textBox2.Text = this.flowBox1.CanvasSize.Height.ToString(); } void flowBox1_NodeDoubleClick(object sender, NodeEventArgs e) { MessageBox.Show(e.Node.Name); } private void Form1_Paint(object sender, PaintEventArgs e) { } private void button1_Click_3(object sender, EventArgs e) { FlowNode n= this.flowBox1.NewNode(); //n.BorderWidth = 1; if (n == null) { MessageBox.Show(this.flowBox1.BoxMode.ToString()); return; } if(checkBox1.Checked && openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { n.NodeImage = Image.FromFile(openFileDialog1.FileName); } else { n.BorderWidth = 1; } n.CanSkip = checkBox2.Checked; this.flowBox1.RefreshItems(); } private void button2_Click_1(object sender, EventArgs e) { FlowLine n = this.flowBox1.NewLine(); if (n == null) { MessageBox.Show(this.flowBox1.BoxMode.ToString()); return; } n.ShowName = this.checkBox3.Checked; this.flowBox1.RefreshItems(); } private void button3_Click_1(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.Show(); Graphics g = this.CreateGraphics(); ControlPaint.DrawFocusRectangle(g,new Rectangle(10,10,50,50),this.BackColor,Color.Transparent); } private void button4_Click(object sender, EventArgs e) { string ff = null; if (checkBox1.Checked && openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ff = openFileDialog1.FileName; } FlowNode n = this.flowBox1.DrawingNode(); if (n == null) { MessageBox.Show(this.flowBox1.BoxMode.ToString()); return; } if (!string.IsNullOrEmpty(ff)) { n.NodeImage = Image.FromFile(ff); } else { n.BorderWidth = 1; } n.CanSkip = checkBox2.Checked; } private void button7_Click(object sender, EventArgs e) { int w = Convert.ToInt32(textBox1.Text); int h = Convert.ToInt32(textBox2.Text); this.flowBox1.CanvasSize = new Size(w, h); } private void button8_Click(object sender, EventArgs e) { if (openFileDialog2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { flowBox1.CanvasBackgroundImage = Image.FromFile(openFileDialog2.FileName); } } private void button9_Click(object sender, EventArgs e) { flowBox1.CanvasBackgroundImage = null; } private void button10_Click(object sender, EventArgs e) { FlowLine n = this.flowBox1.DrawingLine(); if (n == null) { MessageBox.Show(this.flowBox1.BoxMode.ToString()); return; } n.ShowName = this.checkBox3.Checked; } private void button11_Click(object sender, EventArgs e) { bool check = this.flowBox1.CheckFlow(); //if (!check) //{ // MessageBox.Show(this.flowBox1.ErrorMessages[0]); //} Form3 f3 = new Form3(this.flowBox1); f3.Show(); } private void button12_Click(object sender, EventArgs e) { this.flowBox1.RefreshItems(); } private void button13_Click(object sender, EventArgs e) { this.flowBox1.ClearFlow(); } private void button15_Click(object sender, EventArgs e) { if (openFileDialog3.ShowDialog() == System.Windows.Forms.DialogResult.OK) { using (FileStream fs = new FileStream(openFileDialog3.FileName,FileMode.Open, FileAccess.Read)) { flowBox1.LoadFlow(fs); textBox1.Text = this.flowBox1.CanvasSize.Width.ToString(); textBox2.Text = this.flowBox1.CanvasSize.Height.ToString(); } } } private void button14_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { XmlDocument xd = flowBox1.SaveFlowXmlDoc(); if (xd.OuterXml == xd.InnerXml) { } xd.Save(saveFileDialog1.FileName); } } private void flowBox1_NodeDoubleClick_1(object sender, NodeEventArgs e) { MessageBox.Show(e.Node.Code); } private void flowBox1_FlowNodeLoading(object sender, NodeEventArgs e) { //Version v = new Version(1, 2, 3, 4); //Version v1 = new Version(0, 0); //Version v2 = new Version(); //Version v3 = new Version(0, 0, 0, 0); if (e.Node.NodeImageType.HasValue) { string v = flowBox1.LoadVersion.ToString(); if ("1.0" == v) { if (e.Node.NodeImageType == 1) { e.Node.NodeImage = new Bitmap(this.GetType(), "images.convergeNode.png"); } else { e.Node.NodeImage = new Bitmap(this.GetType(), "images.gatherNode.png"); } } else { if (e.Node.NodeImageType == 1) { e.Node.NodeImage = new Bitmap(this.GetType(), "images.newflow.png"); } else { e.Node.NodeImage = new Bitmap(this.GetType(), "images.newflowcheck.png"); } } } } private void button5_Click(object sender, EventArgs e) { if (this.flowBox1.DeletedNodes.Count > 0) { FlowNode[] nodes = this.flowBox1.DeletedNodes.ToArray(); foreach (FlowNode node in nodes) { this.flowBox1.UndeleteNodeByNodeCode(node.ItemCode); } this.flowBox1.RefreshItems(); } } private void button6_Click(object sender, EventArgs e) { WCFTestProxy.Service.Test(); } } }