Beispiel #1
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();
        }
Beispiel #2
0
 public void SetChangeHandler(EventHandler handler)
 {
     if (!isInitChanged)
     {
         this.OnChanged += handler;
         var paths = GlobalPath.GetInstallPaths();
         this.cmbInstallPath.Items.AddRange(paths);
         if (this.cmbInstallPath.Items.Count > 0)
         {
             this.cmbInstallPath.SelectedIndex = 0;
         }
         this.cmbInstallPath.SelectedIndexChanged += Changed;
         this.chkAllowChange.CheckedChanged       += Changed;
         this.txtLicence.TextChanged             += Changed;
         this.chkForAll.CheckedChanged           += Changed;
         this.chkAllowChangeUsers.CheckedChanged += Changed;
         isInitChanged = true;
     }
 }