Example #1
0
        /// <summary>
        /// Handle the user's clicking on a one-line element
        /// </summary>
        /// <param name="ClickedElement"></param>
        /// <param name="e"></param>
        private void OneLine_OneLineElementClicked(MM_OneLine_Element ClickedElement, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            //viewPropertyPage.SetElement(ClickedElement.BaseElement);
            //else
            {
                MM_Popup_Menu c = new MM_Popup_Menu();
                if (ClickedElement.ElemType == MM_OneLine_Element.enumElemTypes.Descriptor || ClickedElement.ElemType == MM_OneLine_Element.enumElemTypes.SecondaryDescriptor)
                {
                    c.Show(ClickedElement, e.Location, ClickedElement.ParentElement.BaseElement, true, olView.DataSourceApplication);
                }
                else
                {
                    c.Show(ClickedElement, e.Location, ClickedElement.BaseElement, true, olView.DataSourceApplication);
                }

                /*
                 * //ClickedElement.BaseElement.BuildMenuItems(c, false, true);
                 * if (ClickedElement.ConnectedElements != null)
                 * {
                 *  c.Items.Add("-");
                 *  foreach (Int32 Conn in ClickedElement.ConnectedElements)
                 *      c.Items.Add(" Connected to: " + viewOneLine.Elements[Conn].BaseElement.ElemType + " " + viewOneLine.Elements[Conn].BaseElement.Name);
                 * }
                 * c.Show(ClickedElement, e.Location);*/
            }
        }
Example #2
0
 /// <summary>
 /// When our user right-clicks, produce a pop-up menu for our items
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MM_LoadGen_Tracking_Operator_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         Menu.Show(this, e.Location, Elements, true);
     }
 }
Example #3
0
        /// <summary>
        /// Handle the right-click event on a cell
        /// </summary>
        /// <param name="e"></param>
        protected override void OnCellMouseClick(DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }
            MM_Element Elem = Rows[e.RowIndex].Cells["TEID"].Value as MM_Element;

            SettingDataSource = true;
            this.CurrentCell  = Rows[e.RowIndex].Cells[e.ColumnIndex];
            if (MM_Server_Interface.Client != null)
            {
                AssociatedPropertyPage.SetElement(Elem);
            }
            SettingDataSource = false;
            if (e.Button == MouseButtons.Right)
            {
                RightClickMenu.Show(this, e.Location, Elem, true);
            }

            base.OnCellMouseClick(e);
            if (e.Button == MouseButtons.Left)
            {
                FindForm().Refresh();
            }
        }
Example #4
0
 /// <summary>
 /// Handle a node mouse click event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NewView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Button == MouseButtons.Right && e.Node.Tag is MM_Element)
     {
         RightClickMenu.Show(this, e.Location, e.Node.Tag as MM_Element, true);
     }
 }
Example #5
0
        /// <summary>
        /// Handle the user's right-click on an item, to bring up the appropriate menu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvSearch_MouseClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo ht = lvSearch.HitTest(e.Location);

            if (ht.Item == null)
            {
                return;
            }
            if (e.Button == MouseButtons.Right && ht.Item.Tag is MM_Element)
            {
                RightClickMenu.Show(lvSearch, e.Location, ht.Item.Tag as MM_Element, true);
            }
        }
Example #6
0
 /// <summary>
 /// Handle our cell mouse click
 /// </summary>
 /// <param name="e"></param>
 protected override void OnCellMouseClick(DataGridViewCellMouseEventArgs e)
 {
     base.OnCellMouseClick(e);
     if (e.Button == System.Windows.Forms.MouseButtons.Right && e.RowIndex >= 0)
     {
         MM_Bound_Element Elem = (MM_Bound_Element)Rows[e.RowIndex].DataBoundItem;
         if (Elem != null)
         {
             CurrentCell = Rows[e.RowIndex].Cells[e.ColumnIndex];
             Rectangle CellRect = GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
             mnuPopup.Show(this, new Point(CellRect.Left + e.X, CellRect.Top + e.Y), Elem.BaseElement, true);
         }
     }
 }
Example #7
0
        /// <summary>
        /// Handle the right-click option on a note
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvNotes_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            ListViewHitTestInfo ht = lvNotes.HitTest(e.Location);

            if (ht.Item != null && ht.Item.Tag is MM_Note && (ht.Item.Tag as MM_Note).AssociatedElement != 0)
            {
                MM_Element AsssociatedElement = MM_Repository.TEIDs[(ht.Item.Tag as MM_Note).AssociatedElement];
                RightClickMenu.Show(this, e.Location, AsssociatedElement, true);
            }
        }
        /// <summary>
        /// Handle the mouse click on our component
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvHistory_MouseClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo hti = lvHistory.HitTest(e.Location);

            if (hti.Item != null && e.Button == MouseButtons.Right)
            {
                MM_UserInteraction FoundInteraction = hti.Item as MM_UserInteraction;
                MM_Substation      FoundSub         = FoundInteraction.Elem.Substation;
                if (FoundSub == null)
                {
                    return;
                }
                PopupMenu.Show(this, e.Location, FoundSub, true);
            }
        }
Example #9
0
        /// <summary>
        /// Handle a mouse right-click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvItems_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                ListViewHitTestInfo hti = lvItems.HitTest(e.Location);
                if (hti.Item == null || e.Button != MouseButtons.Right)
                {
                    return;
                }

                MM_Blackstart_Corridor_Element Elem = hti.Item.Tag as MM_Blackstart_Corridor_Element;
                mnuMain.Show(lvItems, e.Location, Elem.AssociatedElement, true);
            }
            catch (Exception)
            { }
        }
Example #10
0
        /// <summary>
        /// Answer our question
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AnswerQuestion(object sender, MouseEventArgs e)
        {
            if (IsAnswered)
            {
                return;
            }

            tmrQuestion.Enabled = false;

            Label Sender = sender as Label;

            TotalQuestions++;

            int Selected = int.Parse(Sender.Name.Substring(Sender.Name.Length - 1, 1));
            KeyValuePair <MM_Element, bool> kvp = (KeyValuePair <MM_Element, bool>)Sender.Tag;

            if (e.Button == MouseButtons.Right)
            {
                RightClickMenu.Show(this, e.Location, kvp.Key, true);
                return;
            }
            else if (kvp.Value)
            {
                CorrectQuestions++;
                for (int a = 1; a <= 4; a++)
                {
                    Controls["lblAnswer" + a.ToString()].BackColor = a == Selected ? Color.LightGreen : Sender.Parent.BackColor;
                }
            }
            else
            {
                for (int a = 1; a <= 4; a++)
                {
                    Control lbl = Controls["lblAnswer" + a.ToString()] as Control;
                    lbl.BackColor = a == Selected ? Color.Red : ((KeyValuePair <MM_Element, bool>)lbl.Tag).Value ? Color.LightGreen : Sender.Parent.BackColor;
                }
            }
            lblScore.Text        = "Score: " + CorrectQuestions.ToString("#,##0") + "/" + TotalQuestions.ToString("#,##0");
            IsAnswered           = true;
            tmrQuestion.Interval = 3000;
            tmrQuestion.Enabled  = true;
        }