Esempio n. 1
0
        /// <summary>
        /// Occurs when the user double clicks in the listview.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> containing event data.</param>
        private void OnListViewDoubleClick(object sender, EventArgs e)
        {
            var directoryInfo = this.GetSelectedDirectory();
            var fileInfo      = this.GetSelectedFile();
            var shortcutInfo  = this.GetSelectedFileSystemInfo() as OutputShortcutInfo;

            var lvi = this.listView1.SelectedItems.Count > 0 ? this.listView1.SelectedItems[0] : null;

            if (directoryInfo != null)
            {
                var parentNode = this.listView1.Tag as TreeNode;

                if (parentNode != null)
                {
                    foreach (var nodeObject in parentNode.Nodes)
                    {
                        var node = nodeObject as TreeNode;

                        if (node != null && node.Tag == directoryInfo)
                        {
                            this.treeView1.SelectedNode = node;
                            break;
                        }
                    }
                }
            }
            else if (fileInfo != null || shortcutInfo != null)
            {
                IncludeRule includeRule = null;

                if (fileInfo != null)
                {
                    includeRule = fileInfo.IncludeRule;
                }
                else if (shortcutInfo != null)
                {
                    var targetFile = shortcutInfo.Target as OutputFileInfo;

                    if (targetFile != null)
                    {
                        includeRule = targetFile.IncludeRule;
                    }
                }

                if (includeRule != null && lvi != null)
                {
                    if (IncludeRuleEditForm.ShowDialog(this, includeRule) == DialogResult.OK)
                    {
                        if (fileInfo != null)
                        {
                            this.PopulateListViewItem(lvi, fileInfo);
                        }
                        else if (shortcutInfo != null)
                        {
                            this.PopulateListViewItem(lvi, shortcutInfo);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void btnIncludeAdd_Click(object sender, EventArgs e)
        {
            IncludeRule value;

            if (IncludeRuleEditForm.ShowDialog(this, out value) == DialogResult.OK && value != null)
            {
                this.Add(value);
            }
        }
Esempio n. 3
0
        public static DialogResult ShowDialog(IWin32Window owner, IncludeRule includeRule)
        {
            if (includeRule == null)
            {
                throw new ArgumentNullException("includeRule");
            }

            using (var f = new IncludeRuleEditForm())
            {
                f.Value = includeRule;

                return(f.ShowDialog(owner));
            }
        }
Esempio n. 4
0
        public static DialogResult ShowDialog(IWin32Window owner, out IncludeRule includeRule)
        {
            using (var f = new IncludeRuleEditForm())
            {
                var dialogResult = f.ShowDialog(owner);

                if (dialogResult == DialogResult.OK)
                {
                    includeRule = f.Value;
                }
                else
                {
                    includeRule = null;
                }

                return(dialogResult);
            }
        }
Esempio n. 5
0
        private void btnIncludeEdit_Click(object sender, EventArgs e)
        {
            if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
            {
                var lvi = this.listView2.SelectedItems[0];
                if (lvi != null)
                {
                    var rule = lvi.Tag as IncludeRule;

                    if (rule != null)
                    {
                        if (IncludeRuleEditForm.ShowDialog(this, rule) == DialogResult.OK)
                        {
                            this.PopulateListView(lvi, rule);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        public static DialogResult ShowDialog(IWin32Window owner, IncludeRule includeRule)
        {
            if (includeRule == null)
            {
                throw new ArgumentNullException("includeRule");
            }

            using (var f = new IncludeRuleEditForm())
            {
                f.Value = includeRule;

                return f.ShowDialog(owner);
            }
        }
Esempio n. 7
0
        public static DialogResult ShowDialog(IWin32Window owner, out IncludeRule includeRule)
        {
            using (var f = new IncludeRuleEditForm())
            {
                var dialogResult = f.ShowDialog(owner);

                if (dialogResult == DialogResult.OK)
                {
                    includeRule = f.Value;
                }
                else
                {
                    includeRule = null;
                }

                return dialogResult;
            }
        }