コード例 #1
0
        /*  ------------------------------------------------- EVENTS -------------------------------------------------- */

        private void OnClick(object sender, MouseButtonEventArgs e)
        {
            if (!csu.isSimulation)
            {
                HideScriptingButton();
                HideConsumerEmptyButton();
                var position = GetPosition(e.GetPosition(view));

                GridItem3D item = grid.GetItemAtPosition(position);

                if (item != null) // Wenn auf Position Item liegt - ITEM SELECT
                {
                    SelectItem(item);
                    SetItemInformations(item);
                }
                else // Wenn Feld frei ist -> immer deselektieren und evtl Item setzen
                {
                    grid.ClearAndDeselectAllItems();
                    MachinePositionXBox.Text = "";
                    MachinePositionYBox.Text = "";
                    LoadTextBox.Text         = "";
                    int id = toolbox.GetSelectedClassID();
                    if (id > 0 && id < 6)
                    {
                        grid.CreateItemOnServer(position, id);
                    }
                }
                ShowSelectedItems();
            }
        }