Ejemplo n.º 1
0
        private void EditPositionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection selectedItems = listView.SelectedItems;
            if (selectedItems.Count != 1)
            {
                MessageBox.Show("Select a single row to edit a position", "Edit Position");
                return;
            }
            ListViewItem lvi = selectedItems[0];
            // Get database ID of selected item from last column
            string itemindexString = (string)lvi.SubItems[lvi.SubItems.Count - 1].Text;
            int    itemindex       = Convert.ToInt32(itemindexString);

            // Match ID with its index in the positionsList
            foreach (ViewData data in positionsList)
            {
                if (data.id == itemindex)
                {
                    EditDialog dlg = new EditDialog(data);
                    dlg.ShowDialog(this);
                    RefreshView();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void AddPosition_button_Click(object sender, EventArgs e)
        {
            EditDialog dlg = new EditDialog();

            dlg.ShowDialog(this);
            RefreshView();
        }
Ejemplo n.º 3
0
 private void editPositionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ListView.SelectedListViewItemCollection selectedItems = listView.SelectedItems;
     if (selectedItems.Count != 1)
     {
         MessageBox.Show("Select a single row to edit a position", "Edit Position");
         return;
     }
     ListViewItem lvi = selectedItems[0];
     // Get database ID of selected item from last column
     string itemindexString = (string)lvi.SubItems[lvi.SubItems.Count - 1].Text;
     int itemindex = Convert.ToInt32(itemindexString);
     // Match ID with its index in the positionsList
     foreach (ViewData data in positionsList)
     {
         if (data.id == itemindex)
         {
             EditDialog dlg = new EditDialog(data);
             dlg.ShowDialog(this);
             RefreshView();
             break;
         }
     }
 }
Ejemplo n.º 4
0
 private void addPosition_button_Click(object sender, EventArgs e)
 {
     EditDialog dlg = new EditDialog();
     dlg.ShowDialog(this);
     RefreshView();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns>ContextMenuStrip</returns>
        public ContextMenuStrip Create(bool newDatabase)
        {
            // Add the default menu options.
            ContextMenuStrip menu = new ContextMenuStrip();
            ToolStripMenuItem item;
            ToolStripSeparator sep;

            // Settings
            item = new ToolStripMenuItem();
            item.Text = "&Settings";
            item.Click += new EventHandler(Settings_Click);
            item.Image = Resources.settings;
            menu.Items.Add(item);

            // Add
            item = new ToolStripMenuItem();
            item.Text = "&Add symbol";
            item.Click += new EventHandler(Add_Click);
            item.Image = Resources.plus;
            menu.Items.Add(item);

            // Delete
            item = new ToolStripMenuItem();
            item.Text = "&Delete symbol(s)";
            item.Click += new EventHandler(Delete_Click);
            item.Image = Resources.minus;
            menu.Items.Add(item);

            // View
            item = new ToolStripMenuItem();
            item.Text = "&View all symbols";
            item.Click += new EventHandler(View_Click);
            item.Image = Resources.eye;
            menu.Items.Add(item);

            // Separator.
            sep = new ToolStripSeparator();
            menu.Items.Add(sep);

            // About.
            item = new ToolStripMenuItem();
            item.Text = "About";
            item.Click += new EventHandler(About_Click);
            item.Image = Resources.About;
            menu.Items.Add(item);

            // Exit.
            item = new ToolStripMenuItem();
            item.Text = "Exit";
            item.Click += new System.EventHandler(Exit_Click);
            item.Image = Resources.Exit;
            menu.Items.Add(item);

            if (newDatabase)
            {
                EditDialog dlg = new EditDialog();
                dlg.ShowDialog();
            }

            return menu;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Handles the Click event of the Add control.
 /// </summary>
 void Add_Click(object sender, EventArgs e)
 {
     EditDialog dlg = new EditDialog();
     dlg.ShowDialog();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns>ContextMenuStrip</returns>
        public ContextMenuStrip Create(bool newDatabase)
        {
            // Add the default menu options.
            ContextMenuStrip   menu = new ContextMenuStrip();
            ToolStripMenuItem  item;
            ToolStripSeparator sep;

            // Settings
            item        = new ToolStripMenuItem();
            item.Text   = "&Settings";
            item.Click += new EventHandler(Settings_Click);
            item.Image  = Resources.settings;
            menu.Items.Add(item);

            // Add
            item        = new ToolStripMenuItem();
            item.Text   = "&Add symbol";
            item.Click += new EventHandler(Add_Click);
            item.Image  = Resources.plus;
            menu.Items.Add(item);

            // Delete
            item        = new ToolStripMenuItem();
            item.Text   = "&Delete symbol(s)";
            item.Click += new EventHandler(Delete_Click);
            item.Image  = Resources.minus;
            menu.Items.Add(item);

            // View
            item        = new ToolStripMenuItem();
            item.Text   = "&View all symbols";
            item.Click += new EventHandler(View_Click);
            item.Image  = Resources.eye;
            menu.Items.Add(item);

            // Separator.
            sep = new ToolStripSeparator();
            menu.Items.Add(sep);

            // About.
            item        = new ToolStripMenuItem();
            item.Text   = "About";
            item.Click += new EventHandler(About_Click);
            item.Image  = Resources.About;
            menu.Items.Add(item);

            // Exit.
            item        = new ToolStripMenuItem();
            item.Text   = "Exit";
            item.Click += new System.EventHandler(Exit_Click);
            item.Image  = Resources.Exit;
            menu.Items.Add(item);

            if (newDatabase)
            {
                EditDialog dlg = new EditDialog();
                dlg.ShowDialog();
            }

            return(menu);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Handles the Click event of the Add control.
        /// </summary>
        void Add_Click(object sender, EventArgs e)
        {
            EditDialog dlg = new EditDialog();

            dlg.ShowDialog();
        }