private void NewNode(ConnectionNode nodeFrom)
        {
            NodeConfig nc = new NodeConfig();

            if (null == nodeFrom)
            {
                ConnectionNodeBuilder.Defaults(nc.Node);
            }
            else
            {
                nc.Node           = nodeFrom.Clone();
                nc.Node.IsBuiltIn = false;
                nc.Node.Name      = "New Node - " + Guid.NewGuid().ToString().Substring(0, 5);
            }

            if (nc.ShowDialog() == DialogResult.OK)
            {
                ConnectionNodes.Instance().Add(nc.Node);
                BuildView();
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
                }
                UpdateView();
            }
        }
 private void button5_Click(object sender, EventArgs e)
 {
     if (ConnectionNodes.Instance().Nodes[SelectedNode].IsBuiltIn)
     {
         NewNode(ConnectionNodes.Instance().Nodes[SelectedNode]);
     }
     else
     {
         EditNode();
     }
 }
Exemple #3
0
        private void MainView_FormClosing(object sender, FormClosingEventArgs e)
        {
            Model.MessageChanged -= new EventHandler(Model_MessageChanged);

            try
            {
                ConnectionNodes.Instance().Save(GetNodesSettingsFileName());
            }
            catch
            {
                //ignored
            }
        }
        private void EditNode()
        {
            NodeConfig nc           = new NodeConfig();
            int        selectedNode = SelectedNode;

            nc.Node = ConnectionNodes.Instance().Nodes[selectedNode];
            if (nc.ShowDialog() == DialogResult.OK)
            {
                BuildView();
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = selectedNode;
                }
                UpdateView();
            }
        }
 private void SendHl7MessageView_Load(object sender, EventArgs e)
 {
     ConnectionNodes.Instance().AddDefaults();
     BuildView();
     if (!string.IsNullOrEmpty(PreferredNode))
     {
         for (int index = 0; index < comboBox1.Items.Count; index++)
         {
             if (comboBox1.Items[index].ToString().ToLower().Contains(PreferredNode.ToLower()))
             {
                 comboBox1.SelectedIndex = index;
                 break;
             }
         }
     }
     UpdateView();
 }
Exemple #6
0
        private void MainView_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 0;

            Model.MessageChanged += new EventHandler(Model_MessageChanged);

            Model.MessageFromStruct("ORU_R01", "V26");

            try
            {
                ConnectionNodes.Instance().Load(GetNodesSettingsFileName());
            }
            catch
            {
                //ignored
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         var node = ConnectionNodes.Instance().Nodes[SelectedNode];
         Model.SendMessage(node);
         MessageBox.Show("HL7 Message was sent successfully");
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
        private void BuildView()
        {
            List <string> nodes = new List <string>();

            int i = 0;

            foreach (ConnectionNode node in ConnectionNodes.Instance().Nodes)
            {
                if (!string.IsNullOrEmpty(node.Name))
                {
                    nodes.Add(node.Name);
                }
                else
                {
                    nodes.Add("(Unnamed) - " + (++i));
                }
            }
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(nodes.ToArray());
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
 private void button4_Click(object sender, EventArgs e)
 {
     ConnectionNodes.Instance().Remove(comboBox1.SelectedIndex);
     BuildView();
     UpdateView();
 }