public int CompareTo(object obj) { NeedTasks other = (NeedTasks)obj; var byLev = LevelProperty.CompareTo(other.LevelProperty); if (byLev != 0) { return(-byLev); } var byLevTo = ToLevelProperty.CompareTo(other.ToLevelProperty); if (byLevTo != 0) { return(-byLevTo); } var byInd = StaticMetods.PersProperty.Tasks.IndexOf(TaskProperty).CompareTo(StaticMetods.PersProperty.Tasks.IndexOf(other.TaskProperty)); return(-byInd); }
/// <summary> /// The convert. /// </summary> /// <param name="value"> /// The value. /// </param> /// <param name="targetType"> /// The target type. /// </param> /// <param name="parameter"> /// The parameter. /// </param> /// <param name="culture"> /// The culture. /// </param> /// <returns> /// The <see cref="object"/>. /// </returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (parameter.ToString() == "навык") { NeedAbility needAbility = value as NeedAbility; double percentage; if (needAbility.IsValueProperty <= needAbility.ValueProperty) { percentage = (needAbility.IsValueProperty - needAbility.FirstValueProperty) * 100 / (needAbility.ValueProperty - needAbility.FirstValueProperty); } else { percentage = 100; } return(Math.Round(percentage, 0)); } if (parameter.ToString() == "задача") { NeedTasks needTasks = value as NeedTasks; double percentage; if (needTasks.IsValueProperty <= needTasks.ValueProperty) { percentage = (needTasks.IsValueProperty - needTasks.FirstValueProperty) * 100 / (needTasks.ValueProperty - needTasks.FirstValueProperty); } else { percentage = 100; } return(Math.Round(percentage, 0)); } if (parameter.ToString() == "характеристика") { NeedCharact needCharact = value as NeedCharact; double percentage; if (needCharact.IsValueProperty <= needCharact.ValueProperty) { percentage = (needCharact.IsValueProperty - needCharact.FirstValueProperty) * 100 / (needCharact.ValueProperty - needCharact.FirstValueProperty); } else { percentage = 100; } return(Math.Round(percentage, 0)); } if (parameter.ToString() == "квест") { Aim aim = value as Aim; double percentage; return(Math.Round(aim.AutoProgressValueProperty, 0)); } if (parameter.ToString() == "квестТр") { CompositeAims ca = value as CompositeAims; Aim aim = ca.AimProperty; double percentage; return(Math.Round(aim.AutoProgressValueProperty, 0)); } return(0); }