Esempio n. 1
0
        private void InstancesListView_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                var mousePos = InstancesListView.PointToClient(MousePosition);
                var hitTest  = InstancesListView.HitTest(mousePos);

                if (hitTest.Item != null)
                {
                    var columnIndex = hitTest.Item.SubItems.IndexOf(hitTest.SubItem);
                    if (IsActionColumn(columnIndex))
                    {
                        Cursor = Cursors.Hand;
                        return;
                    }
                }

                if (Cursor == Cursors.Hand)
                {
                    Cursor = Cursors.Arrow;
                }
            }
            catch (Exception exc)
            {
                Report(exc);
            }
        }
Esempio n. 2
0
        private void InstancesListView_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                var mousePos    = InstancesListView.PointToClient(MousePosition);
                var hitTest     = InstancesListView.HitTest(mousePos);
                var columnIndex = hitTest.Item.SubItems.IndexOf(hitTest.SubItem);

                if (IsActionColumn(columnIndex))
                {
                    Cursor = Cursors.WaitCursor;

                    var item     = hitTest.Item;
                    var instance = (RunningInstance)hitTest.Item.Tag;

                    item.SubItems[StateColumnIndex].Text =
                        IsRunning(instance)
                                                ? Stop(instance).Name
                                                : Start(instance).Name;
                }
            }
            catch (Exception exc)
            {
                Report(exc);
            }
            finally
            {
                Cursor = Cursors.Arrow;
            }
        }