示例#1
0
        /// <summary>
        /// This method will give the list of convertable action
        /// </summary>
        /// <param name="lstSelectedActivities"></param>
        /// <returns></returns>
        public ObservableList <ConvertableActionDetails> GetConvertableActivityActions(List <Activity> lstSelectedActivities)
        {
            ObservableList <ConvertableActionDetails> lst = new ObservableList <ConvertableActionDetails>();

            try
            {
                foreach (Activity convertibleActivity in lstSelectedActivities)
                {
                    int count = 1;
                    foreach (Act act in convertibleActivity.Acts)
                    {
                        if ((act is IObsoleteAction) && (((IObsoleteAction)act).IsObsoleteForPlatform(act.Platform)) &&
                            (act.Active) && ((IObsoleteAction)act).TargetActionTypeName() != null)
                        {
                            ConvertableActionDetails newConvertibleActionType = new ConvertableActionDetails();
                            newConvertibleActionType.SourceActionTypeName = act.ActionDescription.ToString();
                            newConvertibleActionType.SourceActionType     = act.GetType();
                            newConvertibleActionType.TargetActionType     = ((IObsoleteAction)act).TargetAction();
                            newConvertibleActionType.TargetActionTypeName = ((IObsoleteAction)act).TargetActionTypeName();
                            newConvertibleActionType.ActionCount          = count;
                            newConvertibleActionType.Actions.Add(act);
                            newConvertibleActionType.ActivityList.Add(convertibleActivity.ActivityName);
                            lst.Add(newConvertibleActionType);
                            count++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error occurred while trying to Getting convertable actions from activities", ex);
            }
            return(lst);
        }
        /// <summary>
        /// This method will give the list of convertable action
        /// </summary>
        /// <param name="lstSelectedActivities"></param>
        /// <returns></returns>
        public ObservableList <ConvertableActionDetails> GetConvertableActivityActions(List <Activity> lstSelectedActivities)
        {
            ObservableList <ConvertableActionDetails> lst = new ObservableList <ConvertableActionDetails>();

            try
            {
                foreach (Activity convertibleActivity in lstSelectedActivities)
                {
                    ePlatformType activityPlatform = (from x in WorkSpace.Instance.Solution.ApplicationPlatforms where x.AppName == convertibleActivity.TargetApplication select x.Platform).FirstOrDefault();
                    if (convertibleActivity.Active)
                    {
                        foreach (Act act in convertibleActivity.Acts)
                        {
                            act.Platform = activityPlatform;
                            if ((act is IObsoleteAction) && (((IObsoleteAction)act).IsObsoleteForPlatform(act.Platform)) &&
                                (act.Active) && ((IObsoleteAction)act).TargetActionTypeName() != null)
                            {
                                ConvertableActionDetails existingConvertibleActionType = lst.Where(x => x.SourceActionType == act.GetType() && x.TargetActionTypeName == ((IObsoleteAction)act).TargetActionTypeName()).FirstOrDefault();
                                if (existingConvertibleActionType == null)
                                {
                                    ConvertableActionDetails newConvertibleActionType = new ConvertableActionDetails();
                                    newConvertibleActionType.Selected             = true;
                                    newConvertibleActionType.SourceActionTypeName = act.ActionDescription.ToString();
                                    newConvertibleActionType.SourceActionType     = act.GetType();
                                    newConvertibleActionType.TargetActionType     = ((IObsoleteAction)act).TargetAction();
                                    if (newConvertibleActionType.TargetActionType == null)
                                    {
                                        continue;
                                    }
                                    newConvertibleActionType.TargetActionTypeName = ((IObsoleteAction)act).TargetActionTypeName();
                                    newConvertibleActionType.ActionCount          = 1;
                                    newConvertibleActionType.Actions.Add(act);
                                    newConvertibleActionType.ActivityList.Add(convertibleActivity.ActivityName);
                                    lst.Add(newConvertibleActionType);
                                }
                                else
                                {
                                    if (!existingConvertibleActionType.Actions.Contains(act))
                                    {
                                        existingConvertibleActionType.ActionCount++;
                                        existingConvertibleActionType.Actions.Add(act);
                                        existingConvertibleActionType.ActivityList.Add(convertibleActivity.ActivityName);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error occurred while trying to Getting convertible actions from activities", ex);
            }
            return(lst);
        }