Ejemplo n.º 1
0
        /// <summary>
        /// Handles the DeviceStateChanged event of the CommandRunner control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DroidExplorer.Core.DeviceEventArgs"/> instance containing the event data.</param>
        void CommandRunner_DeviceStateChanged(object sender, DeviceEventArgs e)
        {
            bool enabled = e.State != CommandRunner.DeviceState.Offline && e.State != CommandRunner.DeviceState.Unknown;

            if (string.Compare(e.Device, CommandRunner.Instance.DefaultDevice, true) == 0)
            {
                if (ToolStripMenuItem != null)
                {
                    ToolStripMenuItem.SetEnabled(enabled);
                }
                if (ToolStripButton != null)
                {
                    ToolStripButton.SetEnabled(enabled);
                }
            }
        }