예제 #1
0
        protected void AddResult(object data, string name, string text, string[] subTexts)
        {
            // Add the item.

            IResultData    resultData = Snapin.ResultViewConsole as IResultData;
            ResultDataItem rdi        = new ResultDataItem();

            rdi.Mask  = (uint)ResultDataItemMask.Str | (uint)ResultDataItemMask.Image | (uint)ResultDataItemMask.Param;
            rdi.Image = -1;
            rdi.Str   = (IntPtr)(-1);
            rdi.Col   = 0;
            int resultParam = m_results.Count;

            rdi.Param = GetItemParamFromResultParam(resultParam);
            resultData.InsertItem(ref rdi);

            // Add the result details.

            m_results.Add(new Result(rdi.ItemId, -1, -1, data, name, text, subTexts, resultParam));
        }
예제 #2
0
        }// GetIColumnResultView

        //-------------------------------------------------
        // onShow
        //
        // This function will be used only if a column view is
        // to be presented in the result pane.
        //-------------------------------------------------
        internal void onShow(IConsole2 Console, IntPtr arg, IntPtr param)
        {
            if ((int)arg == 0)
            {
                Leaving();
            }

            // Let's make sure we do have a list view item to display
            if ((int)arg > 0 && m_oResults != null && m_oResults is IColumnResultView)
            {
                IColumnResultView crv = (IColumnResultView)m_oResults;

                // If we're here then we have stuff to add to the result
                // view (beyond the standard view)

                // Query the Conole for a couple interfaces to use
                IHeaderCtrl HeaderCtrl = (IHeaderCtrl)Console;
                IResultData ResultData = (IResultData)Console;

                // Add/Remove Multi-Select ability
                if (m_fAllowMultiSelectResults)
                {
                    ResultData.ModifyViewStyle(0, MMC.SINGLESEL);
                }
                else
                {
                    ResultData.ModifyViewStyle(MMC.SINGLESEL, 0);
                }


                // Let's put in the column titles and find out how wide
                // each column should be
                int iNumCols = crv.getNumColumns();
                int iNumRows = crv.getNumRows();
                for (int i = 0; i < iNumCols; i++)
                {
                    int iMaxLength = crv.getColumnTitles(i).Length;
                    for (int j = 0; j < iNumRows; j++)
                    {
                        if (crv.getValues(j, i) != null)
                        {
                            int iTempLength = crv.getValues(j, i).Length;
                            if (iTempLength > iMaxLength)
                            {
                                iMaxLength = iTempLength;
                            }
                        }
                    }
                    int nWidth = GetColumnWidth(i, iMaxLength);
                    HeaderCtrl.InsertColumn(i, crv.getColumnTitles(i), LVCFMT.LEFT, nWidth);
                }
                RESULTDATAITEM rdi = new RESULTDATAITEM();
                for (int n = 0; n < iNumRows; n++)
                {
                    rdi.mask = RDI.STR |
                               RDI.PARAM;

                    rdi.nImage = crv.GetImageIndex(n);
                    // If we have a valid image, tell MMC to display it.
                    if (rdi.nImage != -1)
                    {
                        rdi.mask |= RDI.IMAGE;
                    }

                    rdi.str  = (IntPtr)(-1);
                    rdi.nCol = 0;

                    // We're doing the lParam a little differently. The low word contains the cookie
                    // for this node, while the high word contains the row number + 1 we're inserting
                    rdi.lParam = m_iCookie | ((n + 1) << 16);

                    ResultData.InsertItem(ref rdi);
                }
            }
        }// onShow