예제 #1
0
        public HashSet <int> Start(ApplicationData applicationData)
        {
            Application.Init();
            _applicationData = applicationData;
            _gridViewDetails = new GridViewDetails
            {
                // If OutputMode is Single or Multiple, then we make items selectable. If we make them selectable,
                // they have a 8 character addition of a checkbox (".....[ ]" or ".....( )")
                // that we have to factor in.
                ListViewOffset = _applicationData.OutputMode != OutputModeOption.None ? 8 : 4
            };

            Window win = AddTopLevelWindow();

            AddStatusBar();

            // GridView header logic
            List <string> gridHeaders = _applicationData.DataTable.DataColumns.Select((c) => c.Label).ToList();

            CalculateColumnWidths(gridHeaders);

            AddFilter(win);
            AddHeaders(win, gridHeaders);

            // GridView row logic
            LoadData();
            AddRows(win);

            _filterField.Text           = _applicationData.Filter ?? string.Empty;
            _filterField.CursorPosition = _filterField.Text.Length;
            // Run the GUI.
            Application.Run();
            Application.Shutdown();

            // Return results of selection if required.
            HashSet <int> selectedIndexes = new HashSet <int>();

            if (_cancelled)
            {
                return(selectedIndexes);
            }

            foreach (GridViewRow gvr in _itemSource.GridViewRowList)
            {
                if (gvr.IsMarked)
                {
                    selectedIndexes.Add(gvr.OriginalIndex);
                }
            }

            return(selectedIndexes);
        }
예제 #2
0
        public HashSet <int> Start(ApplicationData applicationData)
        {
            Application.Init();
            _applicationData = applicationData;
            _gridViewDetails = new GridViewDetails
            {
                // If we have PassThru, then we want to make them selectable. If we make them selectable,
                // they have a 8 character addition of a checkbox ("     [ ]") that we have to factor in.
                ListViewOffset = _applicationData.PassThru ? 8 : 4
            };

            AddMenu();
            Window win = AddTopLevelWindow();

            // GridView header logic
            List <string> gridHeaders = _applicationData.DataTable.DataColumns.Select((c) => c.Label).ToList();

            CalculateColumnWidths(gridHeaders);

            AddFilter(win);
            AddHeaders(win, gridHeaders);

            // GridView row logic
            LoadData();
            AddRows(win);

            // Run the GUI.
            Application.Run();

            // Return results of selection if required.
            HashSet <int> selectedIndexes = new HashSet <int>();

            if (_cancelled || !_applicationData.PassThru)
            {
                return(selectedIndexes);
            }

            foreach (GridViewRow gvr in _itemSource.GridViewRowList)
            {
                if (gvr.IsMarked)
                {
                    selectedIndexes.Add(gvr.OriginalIndex);
                }
            }

            return(selectedIndexes);
        }