Ejemplo n.º 1
0
        private void button_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Button button = (Button)sender;

                string[] definitions = button.AccessibleName.Split('_');

                ToothVerticalPosition verticalPosition = (ToothVerticalPosition)Enum.Parse(typeof(ToothVerticalPosition), definitions[0]);
                string horizontalPosition = definitions[1];
                int    toothNumber        = int.Parse(definitions[2]);

                int toothIndex = horizontalPosition == "LEFT" ? 8 - toothNumber : 7 + toothNumber;

                Rules(verticalPosition, toothIndex);

                Point location = button.PointToScreen(e.Location);
                contextMenuStrip1.Show(location);
            }
        }
Ejemplo n.º 2
0
        /// <param name="index">0 - 15</param>
        private void Rules(ToothVerticalPosition tvp, int index)
        {
            bool dolgu       = false;
            bool kopruSaga   = true;
            bool kopruSola   = true;
            bool gosterGizle = true;
            bool implant     = true;

            // BRIDGE LEFT
            if (_flags[tvp][index] == ToothStatusFlags.Hidden)
            {
                kopruSola = false;
            }
            else if (index < 2)
            {
                kopruSola = false;
            }
            else if (_flags[tvp][index - 2] == ToothStatusFlags.Hidden)
            {
                kopruSola = false;
            }
            else if (_flags[tvp][index - 1] != ToothStatusFlags.Hidden && _flags[tvp][index - 1] != ToothStatusFlags.Bridge)
            {
                kopruSola = false;
            }

            // BRIDGE RIGHT
            if (_flags[tvp][index] == ToothStatusFlags.Hidden)
            {
                kopruSaga = false;
            }
            else if (index > 13)
            {
                kopruSaga = false;
            }
            else if (_flags[tvp][index + 2] == ToothStatusFlags.Hidden)
            {
                kopruSaga = false;
            }
            else if (_flags[tvp][index + 1] != ToothStatusFlags.Hidden && _flags[tvp][index + 1] != ToothStatusFlags.Bridge)
            {
                kopruSaga = false;
            }

            // SHOW / HIDE
            if (_flags[tvp][index] != ToothStatusFlags.Hidden && _flags[tvp][index] != ToothStatusFlags.Normal)
            {
                gosterGizle = false;
            }
            else if (index > 0 && _flags[tvp][index - 1] == ToothStatusFlags.Bridge)
            {
                gosterGizle = false;
            }
            else if (index < 15 && _flags[tvp][index + 1] == ToothStatusFlags.Bridge)
            {
                gosterGizle = false;
            }

            // IMPLANT
            if (_flags[tvp][index] != ToothStatusFlags.Normal && _flags[tvp][index] != ToothStatusFlags.Implant)
            {
                implant = false;
            }

            btnDolgu.Visible       = dolgu;
            btnKopruSaga.Visible   = kopruSaga;
            btnKopruSola.Visible   = kopruSola;
            btnGizleGoster.Visible = gosterGizle;
            btnImplant.Visible     = implant;

            _lastSelectedToothVerticalPosition = tvp;
            _lastSelectedToothIndex            = index;
        }