private int RaiseCompareModels(object left, object right, int columnIndex)
        {
            CompareModelsEventArgs args = new CompareModelsEventArgs(left, right, columnIndex);

            OnCompareModels(args);
            return(args.Result);
        }
 protected virtual void OnCompareModels(CompareModelsEventArgs args)
 {
     if (CompareModels != null)
     {
         CompareModels(this, args);
     }
 }
Esempio n. 3
0
        //---------------------------------------------------------------------------
        private void vtItemsCompareModels(object sender, CompareModelsEventArgs e)
        {
            string sTmp1, sTmp2;
            CItem  pItem1 = ((SItemLink)e.LeftModel).Item;
            CItem  pItem2 = ((SItemLink)e.RightModel).Item;

            switch (e.ColumnIndex)
            {
            case 0: e.Result = string.Compare(pItem1.Name, pItem2.Name);
                break;

            case 1: e.Result = Comparer <int> .Default.Compare((int)(pItem1.sNutzen * 100), (int)(pItem2.sNutzen * 100));

                break;

            case 2: e.Result = Comparer <int> .Default.Compare((int)(pItem1.sGesamt * 100), (int)(pItem2.sGesamt * 100));

                break;

            case 3: e.Result = Comparer <int> .Default.Compare(pItem1.Level, pItem2.Level);

                break;

            case 4: e.Result = Comparer <int> .Default.Compare(pItem1.GetBonusEffect(UserDefId[0]), pItem2.GetBonusEffect(UserDefId[0]));

                break;

            case 5: e.Result = Comparer <int> .Default.Compare(pItem1.GetBonusEffect(UserDefId[1]), pItem2.GetBonusEffect(UserDefId[1]));

                break;

            case 6: e.Result = Comparer <int> .Default.Compare(pItem1.GetBonusEffect(UserDefId[2]), pItem2.GetBonusEffect(UserDefId[2]));

                break;

            case 7: e.Result = string.Compare(Unit.xml_config.arItemSlots[pItem1.Position].strPosName, Unit.xml_config.arItemSlots[pItem2.Position].strPosName);
                break;

            case 8: if (pItem1.Class >= 0)
                {
                    sTmp1 = Unit.xml_config.arItemClasses[pItem1.Class].Name;
                }
                else
                {
                    sTmp1 = sSchmuck;
                }
                if (pItem2.Class >= 0)
                {
                    sTmp2 = Unit.xml_config.arItemClasses[pItem2.Class].Name;
                }
                else
                {
                    sTmp2 = sSchmuck;
                }
                e.Result = string.Compare(sTmp1, sTmp2);
                break;

            case 9: e.Result = Comparer <int> .Default.Compare(pItem1.MaxLevel, pItem2.MaxLevel);

                break;

            case 10: e.Result = string.Compare(Utils.Realm2Str(pItem1.Realm), Utils.Realm2Str(pItem2.Realm));
                break;

            case 11: e.Result = string.Compare(pItem1.Provider, pItem2.Provider);
                break;

            case 12: e.Result = string.Compare(pItem1.Extension, pItem2.Extension);
                break;

            case 13: e.Result = Comparer <DateTime> .Default.Compare(pItem1.LastUpdate, pItem2.LastUpdate);

                break;
            }
        }