Exemplo n.º 1
0
        private void deviceGrid_Leftclick(object sender, MouseButtonEventArgs e)
        {
            //Used instead of   void txtBlock_Leftclick(object sender, RoutedEventArgs e)
            //void txtBlock_Leftclick(object sender, RoutedEventArgs e) left as example of left click on textbox
            //IInputElement elem = FocusManager.GetFocusedElement(this);

            int selectedColumnIndex = -1, selectedRowIndex = -1;
            var grid = sender as Grid;

            if (grid != null)
            {
                var pos  = e.GetPosition(grid);
                var temp = pos.X;
                for (var i = 0; i < grid.ColumnDefinitions.Count; i++)
                {
                    var colDef = grid.ColumnDefinitions[i];
                    temp -= colDef.ActualWidth;
                    if (temp <= -1)
                    {
                        selectedColumnIndex = i;
                        break;
                    }
                }

                temp = pos.Y;
                for (var i = 0; i < grid.RowDefinitions.Count; i++)
                {
                    var rowDef = grid.RowDefinitions[i];
                    temp -= rowDef.ActualHeight;
                    if (temp <= -1)
                    {
                        selectedRowIndex = i;
                        break;
                    }
                }
            }

            if ((selectedColumnIndex == 0) || (selectedRowIndex == 0))
            {
                return;
            }

            string cardtype = mTxtBlockA[selectedRowIndex, 1].Text;

            Window2 wDeviceConfig = new Window2();

            wDeviceConfig.SetDeviceParams(selectedRowIndex, selectedColumnIndex, cardtype, regDevices[selectedRowIndex - 1].SlotID, regDevices);
            wDeviceConfig.Title = "Define Devices";
            wDeviceConfig.Owner = this;
            wDeviceConfig.ShowDialog();
        }
Exemplo n.º 2
0
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            Window2 wDeviceConfig = new Window2();

            wDeviceConfig.Show();
        }