Example #1
0
        /// <summary>
        /// Update object tree.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 0)
            {
                TransactionWork = new GXAsyncWork(this, OnAsyncStateChange, Refresh, new object[] { ObjectTree.SelectedNode.Tag });
            }
            else
            {
                GXDLMSObjectCollection items = new GXDLMSObjectCollection();
                foreach (ListViewItem it in ObjectList.SelectedItems)
                {
                    items.Add(it.Tag as GXDLMSObject);
                }
                TransactionWork = new GXAsyncWork(this, OnAsyncStateChange, Refresh, new object[] { items });
            }

            TransactionWork.Start();
        }
Example #2
0
 /// <summary>
 /// Disconnect to the selected device.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DisconnectMnu_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 0)
     {
         TransactionWork = new GXAsyncWork(this, OnAsyncStateChange, Disconnect, new object[] { ObjectTree.SelectedNode.Tag });
     }
     else
     {
         TransactionWork = new GXAsyncWork(this, OnAsyncStateChange, Disconnect, new object[] { GetDevices() });
     }
     TransactionWork.Start();
 }
Example #3
0
 /// <summary>
 /// Read selected DLMS object.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ReadMnu_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 0)
     {
         //Set focus to the tree or Read count do not updated.
         this.ObjectTree.Focus();
         if (this.ObjectTree.SelectedNode != null)
         {
             TransactionWork = new GXAsyncWork(this, OnAsyncStateChange, Read, new object[] { this.ObjectTree.SelectedNode.Tag, SelectedView });
             TransactionWork.Start();
         }
     }
     else
     {
         if (this.ObjectList.SelectedItems.Count != 0)
         {
             GXDLMSObjectCollection items = new GXDLMSObjectCollection();
             foreach (ListViewItem it in this.ObjectList.SelectedItems)
             {
                 items.Add(it.Tag as GXDLMSObject);
             }
             TransactionWork = new GXAsyncWork(this, OnAsyncStateChange, Read, new object[] { items, SelectedView });
             TransactionWork.Start();
         }
     }
 }