示例#1
0
 private void 添加Oracle数据源ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.treeViewConnections.SelectedNode is FlowProjectNode)
         {
             FlowProjectNode     selectedNode = this.treeViewConnections.SelectedNode as FlowProjectNode;
             OracleConnectionFrm frm          = new OracleConnectionFrm();
             if (frm.ShowDialog(this) == DialogResult.OK)
             {
                 ScadaConnectionNode node = new ScadaConnectionNode(frm.Connection)
                 {
                     ContextMenuStrip = this.contextMenuConnectionDelete
                 };
                 selectedNode.Nodes.Add(node);
                 selectedNode.Project.ScadaConnections.Add(frm.Connection);
             }
         }
     }
     catch (Exception exception1)
     {
         MessageBox.Show(exception1.Message);
     }
 }
示例#2
0
 private void 编辑数据源ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.treeViewConnections.SelectedNode is ScadaConnectionNode)
         {
             FlowProjectNode     parent       = this.treeViewConnections.SelectedNode.Parent as FlowProjectNode;
             ScadaConnectionNode selectedNode = this.treeViewConnections.SelectedNode as ScadaConnectionNode;
             if (selectedNode.ScadaConnection.DataBaseType == DataBaseType.SQLServer)
             {
                 SqlServerConnectionFrm frm = new SqlServerConnectionFrm
                 {
                     Connection = (SqlServer_Connection)selectedNode.ScadaConnection
                 };
                 if (frm.ShowDialog(this) == DialogResult.OK)
                 {
                     selectedNode.ScadaConnection = frm.Connection;
                     selectedNode.Text            = frm.Connection.ToString();
                 }
             }
             else if (selectedNode.ScadaConnection.DataBaseType == DataBaseType.Oracle)
             {
                 OracleConnectionFrm frm2 = new OracleConnectionFrm
                 {
                     Connection = (Oracle_Connection)selectedNode.ScadaConnection
                 };
                 if (frm2.ShowDialog(this) == DialogResult.OK)
                 {
                     selectedNode.ScadaConnection = frm2.Connection;
                     selectedNode.Text            = frm2.Connection.ToString();
                 }
             }
             else if (selectedNode.ScadaConnection.DataBaseType == DataBaseType.MySQL)
             {
                 MySqlConnectionFrm frm3 = new MySqlConnectionFrm
                 {
                     Connection = (MySQL_Connection)selectedNode.ScadaConnection
                 };
                 if (frm3.ShowDialog(this) == DialogResult.OK)
                 {
                     selectedNode.ScadaConnection = frm3.Connection;
                     selectedNode.Text            = frm3.Connection.ToString();
                 }
             }
             else if (selectedNode.ScadaConnection.DataBaseType == DataBaseType.SQLite)
             {
                 SQLiteConnectionFrm frm4 = new SQLiteConnectionFrm
                 {
                     Connection = (SQLite_Connection)selectedNode.ScadaConnection
                 };
                 if (frm4.ShowDialog(this) == DialogResult.OK)
                 {
                     selectedNode.ScadaConnection = frm4.Connection;
                     selectedNode.Text            = frm4.Connection.ToString();
                 }
             }
             else if (selectedNode.ScadaConnection.DataBaseType == DataBaseType.SyBase)
             {
                 SyBaseConnectionFrm frm5 = new SyBaseConnectionFrm
                 {
                     Connection = (SyBase_Connection)selectedNode.ScadaConnection
                 };
                 if (frm5.ShowDialog(this) == DialogResult.OK)
                 {
                     selectedNode.ScadaConnection = frm5.Connection;
                     selectedNode.Text            = frm5.Connection.ToString();
                 }
             }
         }
     }
     catch (Exception exception1)
     {
         MessageBox.Show(exception1.Message);
     }
 }