示例#1
0
        /// <summary>
        /// Formats a ToolUpdatesDlg form for use in testing.
        /// </summary>
        /// <param name="itemsSelected">If true, this will check all the tools listed in the ToolUpdatesDlg. If false, it will uncheck all of them.</param>
        /// <param name="updateHelper">The update helper for the ToolUpdatesDlg.</param>
        /// <param name="testingDownloadOnly">If true, it will only test the DownloadTools function of the ToolUpdatesDlg.</param>
        private static ToolUpdatesDlg FormatToolUpdatesDlg(bool itemsSelected, IToolUpdateHelper updateHelper, bool testingDownloadOnly)
        {
            var toolUpdatesDlg = ShowDialog <ToolUpdatesDlg>(() => SkylineWindow.ShowToolUpdatesDlg(updateHelper));

            if (itemsSelected)
            {
                RunUI(toolUpdatesDlg.SelectAll);
            }
            else
            {
                RunUI(toolUpdatesDlg.DeselectAll);
            }
            toolUpdatesDlg.TestingDownloadOnly = testingDownloadOnly;
            return(toolUpdatesDlg);
        }
示例#2
0
        public ToolUpdatesDlg(SkylineWindow parent, IEnumerable <ToolDescription> tools, IToolUpdateHelper updateHelper)
        {
            InitializeComponent();

            checkedListBoxTools.Height += labelOperation.Bottom - checkedListBoxTools.Bottom;
            Icon = Resources.Skyline;

            _parent       = parent;
            _tools        = new Dictionary <ToolUpdateInfo, ICollection <ToolDescription> >();
            _updateHelper = updateHelper;

            // group tools with multiple components together by their package identifier
            foreach (var tool in tools)
            {
                var info = new ToolUpdateInfo(tool.PackageIdentifier, tool.PackageName);
                ICollection <ToolDescription> toolComponents;
                if (_tools.TryGetValue(info, out toolComponents))
                {
                    toolComponents.Add(tool);
                }
                else
                {
                    _tools.Add(info, new List <ToolDescription> {
                        tool
                    });
                }
            }

            // populate the checklistbox with the tools package names
            checkedListBoxTools.Items.AddRange(_tools.Select(pair => pair.Key._packageName).Cast <Object>().ToArray());

            // set all tools to checked
            for (int i = 0; i < checkedListBoxTools.Items.Count; i++)
            {
                checkedListBoxTools.SetItemCheckState(i, CheckState.Checked);
            }
        }
示例#3
0
        public ToolUpdatesDlg(SkylineWindow parent, IEnumerable<ToolDescription> tools, IToolUpdateHelper updateHelper)
        {
            InitializeComponent();

            checkedListBoxTools.Height += labelOperation.Bottom - checkedListBoxTools.Bottom;
            Icon = Resources.Skyline;

            _parent = parent;
            _tools = new Dictionary<ToolUpdateInfo, ICollection<ToolDescription>>();
            _updateHelper = updateHelper;

            // group tools with multiple components together by their package identifier
            foreach (var tool in tools)
            {
                var info = new ToolUpdateInfo(tool.PackageIdentifier, tool.PackageName);
                ICollection<ToolDescription> toolComponents;
                if (_tools.TryGetValue(info, out toolComponents))
                {
                    toolComponents.Add(tool);
                }
                else
                {
                    _tools.Add(info, new List<ToolDescription> {tool});
                }
            }

            // populate the checklistbox with the tools package names
            checkedListBoxTools.Items.AddRange(_tools.Select(pair => pair.Key._packageName).Cast<Object>().ToArray());

            // set all tools to checked
            for (int i = 0; i < checkedListBoxTools.Items.Count; i++)
            {
                checkedListBoxTools.SetItemCheckState(i, CheckState.Checked);
            }
        }
示例#4
0
 /// <summary>
 /// Formats a ToolUpdatesDlg form for use in testing.
 /// </summary>
 /// <param name="itemsSelected">If true, this will check all the tools listed in the ToolUpdatesDlg. If false, it will uncheck all of them.</param>
 /// <param name="updateHelper">The update helper for the ToolUpdatesDlg.</param>
 /// <param name="testingDownloadOnly">If true, it will only test the DownloadTools function of the ToolUpdatesDlg.</param>
 private static ToolUpdatesDlg FormatToolUpdatesDlg(bool itemsSelected, IToolUpdateHelper updateHelper, bool testingDownloadOnly)
 {
     var toolUpdatesDlg = ShowDialog<ToolUpdatesDlg>(() => SkylineWindow.ShowToolUpdatesDlg(updateHelper));
     if (itemsSelected)
         RunUI(toolUpdatesDlg.SelectAll);
     else
         RunUI(toolUpdatesDlg.DeselectAll);
     toolUpdatesDlg.TestingDownloadOnly = testingDownloadOnly;
     return toolUpdatesDlg;
 }