Exemplo n.º 1
0
        /// <summary>
        /// Click Event handler for the Add Host Menu Item.
        /// </summary>
        /// <param name="sender">Reference to the AddHostMenuItem object.</param>
        /// <param name="e">Event specific data.</param>
        private void AddHostMenuItem_Click(object sender, EventArgs e)
        {
            WolHost NewHost = new WolHost();

            using (AmendHost AmendHostForm = new AmendHost(ActionMode.Add, NewHost))
            {
                if (AmendHostForm.ShowDialog(this) == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;

                    _hostList.Items.Add(NewHost);
                    AddHostListViewItem(NewHost);

                    this.Cursor = null;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Private method to handle then atomic amendment of a Wake on LAN host.
        /// </summary>
        /// <param name="hostToAmend">The Wake on LAN which is to be amended.</param>
        private void AmendWolHost(WolHost hostToAmend)
        {
            WolHost ClonedHost = hostToAmend.Clone();

            using (AmendHost AmendHostForm = new AmendHost(ActionMode.Amend, ClonedHost))
            {
                if (AmendHostForm.ShowDialog(this) == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;

                    _hostList.Items.Remove(hostToAmend);
                    _hostList.Items.Add(ClonedHost);

                    UpdateHostListViewItem(this.HostsListView.SelectedItems[0], ClonedHost);

                    this.Cursor = null;
                }
            }
        }