Пример #1
0
        public DlgShortCut()
        {
            InitializeComponent();

            var paths = GlobalPath.GetShortCutPaths();

            this.cmbTargetDir.Items.AddRange(paths);
            if (this.cmbTargetDir.Items.Count > 0)
            {
                this.cmbTargetDir.SelectedIndex = 0;
            }

            this.btnOk.Click     += BtnOk_Click;
            this.btnCancel.Click += BtnCancel_Click;
        }
Пример #2
0
        private void InitGlobal()
        {
            this.lvGlobal.ShowGroups = true;
            this.lvGlobal.Items.Clear();
            var vars = this.context.PageItemKeys;

            if (vars.Any())
            {
                var grp = new ListViewGroup("变量");
                this.lvGlobal.Groups.Add(grp);
                foreach (var @var in vars)
                {
                    var item = new ListViewItem($"$[{@var}]", grp);
                    this.lvGlobal.Items.Add(item);
                }
            }

            var paths = GlobalPath.GetInstallPaths().Concat(GlobalPath.GetShortCutPaths()).Concat(GlobalPath.GetFilePaths());

            if (paths.Any())
            {
                var grp = new ListViewGroup("路径");
                this.lvGlobal.Groups.Add(grp);
                foreach (var path in paths)
                {
                    var item = new ListViewItem(path, grp);
                    this.lvGlobal.Items.Add(item);
                }
            }

            if (this.context.Files != null && this.context.Files.Any())
            {
                var grp = new ListViewGroup("文件");
                this.lvGlobal.Groups.Add(grp);
                foreach (var file in this.context.Files)
                {
                    var item = new ListViewItem(file.Key, grp);
                    this.lvGlobal.Items.Add(item);
                }
            }

            this.lvGlobal.EnableGroupEvent();
            this.lvGlobal.EnableSort();
        }