Exemplo n.º 1
0
        /// <summary>
        ///     MouseClick event handler to intercept the mouse right-click, to show Context Menu.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">event argument</param>
        private void TvDbItems_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Right)
                {
                    TreeView.SelectedNode = e.Node;

                    if (e.Node.Text.Trim()
                        .StartsWithAnItemInArray(_filterableNodes))
                    {
                        filterSettingToolItem.Enabled           = resetFilterToolItem.Enabled = true;
                        generateCClassToolStripMenuItem.Enabled = generateSimpleTypedDatatableToolStripMenuItem.Enabled = false;
                    }
                    else if (e.Node.Parent?.Text.Trim()
                             .StartsWithAnItemInArray(_filterableNodes) == true)
                    {
                        filterSettingToolItem.Enabled           = resetFilterToolItem.Enabled = false;
                        generateCClassToolStripMenuItem.Enabled = generateSimpleTypedDatatableToolStripMenuItem.Enabled = true;
                    }
                    else
                    {
                        filterSettingToolItem.Enabled           = resetFilterToolItem.Enabled = false;
                        generateCClassToolStripMenuItem.Enabled = generateSimpleTypedDatatableToolStripMenuItem.Enabled = false;
                    }

                    cntxMenu.Show(TreeView, e.Location);
                }
            }
            catch (Exception ex)
            {
                ErrorViewerForm.ShowError(ex, this);
            }
        }
 private void ResetAction_Click(object sender, EventArgs e)
 {
     try
     {
         ResetSettingsToDefault();
     }
     catch (Exception ex)
     {
         ErrorViewerForm.ShowError(ex, Parent);
     }
 }
Exemplo n.º 3
0
 private static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new MainForm());
     }
     catch (Exception ex)
     {
         ErrorViewerForm.ShowError(ex);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Event handler of 'Copy Name' mmenu Item cllick.
 /// </summary>
 /// <param name="sender">sender of this event.</param>
 /// <param name="e">event argument of this event.</param>
 private void copyNameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (tvDBItems != null && tvDBItems.SelectedNode != null)
         {
             Clipboard.SetText(tvDBItems.SelectedNode.Text);
         }
     }
     catch (Exception ex)
     {
         ErrorViewerForm.ShowError(ex, this);
         throw;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        ///     Event handler when 'Reset filter' menu item is clicked.
        /// </summary>
        /// <param name="sender">sender of this event.</param>
        /// <param name="e">Event argument of this handler.</param>
        private void ResetFilterToolItem_Click(object sender, EventArgs e)
        {
            try
            {
                var tn = TreeView.SelectedNode;

                if (tn?.Text.Trim()
                    .StartsWithAnItemInArray(_filterableNodes) == true &&
                    tn.Tag != null)
                {
                    ResetFilter(tn);
                }
            }

            catch (Exception ex)
            {
                ErrorViewerForm.ShowError(ex, this);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Click event handler when 'Filter' menu item is clicked.
        /// </summary>
        /// <param name="sender">sender of this event.</param>
        /// <param name="e">Event argument of this handler.</param>
        private void FilterSettingToolItem_Click(object sender, EventArgs e)
        {
            try
            {
                var tn = TreeView.SelectedNode;

                if (tn?.Text.Trim()
                    .StartsWithAnItemInArray(_filterableNodes) == true)
                {
                    var filterForm = tn.Tag as FilterForm;

                    if (filterForm == null)
                    {
                        filterForm = new FilterForm(_server, tn.Parent.Text.Trim());
                        tn.Tag     = filterForm;
                    }

                    if (filterForm.ShowDialog(this) == DialogResult.OK)
                    {
                        if (filterForm.FilterText.Length > 0)
                        {
                            var dbObjectFilter = filterForm.FilterText.Trim();
                            var filterType     = filterForm.FilterType.Trim();
                            FilterNode(tn, dbObjectFilter, filterType);

                            if (!tn.Text.EndsWith(Constants.FILTERED_TEXT))
                            {
                                tn.Text = tn.Text + Constants.FILTERED_TEXT;
                            }
                        }
                        else
                        {
                            ResetFilter(tn);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorViewerForm.ShowError(ex, this);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Event handler when 'Reset filter' menu item is clicked.
        /// </summary>
        /// <param name="sender">sender of this event.</param>
        /// <param name="e">Event argument of this handler.</param>
        private void resetFilterToolItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (tvDBItems.SelectedNode != null)
                {
                    TreeNode tn = tvDBItems.SelectedNode;

                    if (tn.Text.Trim().StartsWithAnItemInArray(filterableNodes) && tn.Tag != null)
                    {
                        ResetFilter(tn);
                    }
                }
            }

            catch (Exception ex)
            {
                ErrorViewerForm.ShowError(ex, this);
            }
        }