Exemple #1
0
        //============================================================================*
        // OnViewTool()
        //============================================================================*

        protected void OnViewTool(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Get the selected object
            //----------------------------------------------------------------------------*

            ListViewItem Item = m_ToolsListView.SelectedItems[0];

            if (Item == null)
            {
                return;
            }

            cTool Tool = (cTool)Item.Tag;

            if (Tool == null)
            {
                return;
            }

            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cToolForm ToolForm = new cToolForm(Tool, m_DataFiles, true);

            Cursor = Cursors.Default;

            ToolForm.ShowDialog();

            m_ToolsListView.Focus();
        }
Exemple #2
0
        //============================================================================*
        // OnEditTool()
        //============================================================================*

        protected void OnEditTool(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Get the selected Firearm
            //----------------------------------------------------------------------------*

            ListViewItem Item = m_ToolsListView.SelectedItems[0];

            if (Item == null)
            {
                return;
            }

            cTool Tool = (cTool)Item.Tag;

            if (Tool == null)
            {
                return;
            }

            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cToolForm ToolForm = new cToolForm(Tool, m_DataFiles);

            Cursor = Cursors.Default;

            if (ToolForm.ShowDialog() == DialogResult.OK)
            {
                //----------------------------------------------------------------------------*
                // Get the new Tool Data
                //----------------------------------------------------------------------------*

                cTool NewTool = ToolForm.Tool;
                m_DataFiles.Preferences.LastTool = ToolForm.Tool;

                UpdateTool(Tool, NewTool);
            }

            UpdateToolsTabButtons();

            m_ToolsListView.Focus();
        }
Exemple #3
0
        //============================================================================*
        // OnAddTool()
        //============================================================================*

        protected void OnAddTool(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cToolForm ToolForm = new cToolForm(null, m_DataFiles);

            Cursor = Cursors.Default;

            if (ToolForm.ShowDialog() == DialogResult.OK)
            {
                //----------------------------------------------------------------------------*
                // Get the new Tool Data
                //----------------------------------------------------------------------------*

                cTool NewTool = ToolForm.Tool;
                m_DataFiles.Preferences.LastTool = ToolForm.Tool;

                m_ToolsListView.Focus();

                //----------------------------------------------------------------------------*
                // See if the Tool already exists
                //----------------------------------------------------------------------------*

                foreach (cTool CheckTool in m_DataFiles.ToolList)
                {
                    if (CheckTool.CompareTo(NewTool) == 0)
                    {
                        return;
                    }
                }

                AddTool(NewTool);
            }

            UpdateToolsTabButtons();
        }