public void FilterClicked(object param)
        {
            DeckType attrib;

            if (!Enum.TryParse <DeckType>(param.ToString(), out attrib))
            {
                throw new ArgumentException(string.Format("Unknow value for DeckType={0}", param));
            }

            //toggle filter value
            FilterButtonState[attrib] = !FilterButtonState[attrib];

            //fires to many events on colection, will filter once for reset, and then for every selected attrib
            FilteredTypes.Clear();

            //if all unslected - show all
            if (FilterButtonState.All(f => !f.Value))
            {
                Enum.GetValues(typeof(DeckType)).OfType <DeckType>().All(t => { FilteredTypes.Add(t); return(true); });
            }
            else
            {
                foreach (DeckType type in FilterButtonState.Where(f => f.Value).Select(f => f.Key))
                {
                    FilteredTypes.Add(type);
                }
            }

            messanger.Send(
                new DeckListFilterChanged(DeckListFilterChanged.Source.TypeFilter, FilteredTypes, showCompletedArenaRuns, showHiddenDecks, null, null),
                ControlMessangerContext.DeckList_DeckFilterControl);
        }
Exemplo n.º 2
0
 private void FilterProductsType()
 {
     if (string.IsNullOrWhiteSpace(SearchProductType))
     {
         FilteredTypes.ReplaceRange(Types);
     }
     else
     {
         FilteredTypes.ReplaceRange(Types.Where((c) => c.Name.Contains(SearchProductType, System.StringComparison.OrdinalIgnoreCase)));
     }
 }
 /// <summary>
 /// Contains the core logic of pascal case conversion. 
 /// </summary>        
 private void DecorateCore(FilteredTypes types)
 {
     // Perform this action for all extensions (ext) in the data contracts list.
     foreach (CodeTypeExtension typeExtension in types)
     {
         // Get the converter for this type.
         PascalCaseConverterBase converter = PascalCaseConverterFactory.GetPascalCaseConverter(typeExtension, code);
         // Execute the converter.
         string oldName;
         string newName = converter.Convert(out oldName);
         UpdateTypeReferences(oldName, newName);
     }
 }
        public void Reset()
        {
            foreach (DeckType a in Enum.GetValues(typeof(DeckType)))
            {
                //unselct all in UI
                FilterButtonState[a] = false;

                //reset filter collection
                FilteredTypes.Clear();
                Enum.GetValues(typeof(DeckType)).OfType <DeckType>().All(t => { FilteredTypes.Add(t); return(true); });
            }
            ShowCompletedArenaRuns = false;
            ShowHiddenDecks        = false;
            RaisePropertyChangedEvent("FilterButtonState");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new instance of GeneratedCode class.
        /// </summary>
        /// <param name="codeNamespace">The <see cref="codeNamespace"/> containing the code to be wrapped.</param>
        /// <param name="codeLanguage">The language the code was generated for.</param>
        /// <param name="configuration">The configuration associated with the generated code.</param>
        /// <remarks>
        /// This class can only be initialized by CodeFactory. 
        /// Therefore this constructor is marked as internal.
        /// </remarks>
        internal ExtendedCodeDomTree(CodeNamespace codeNamespace, CodeLanguage codeLanguage, Configuration configuration)
        {
            this.codeNamespace = codeNamespace;

            CodeLanguauge = codeLanguage;
            Configuration = configuration;

            ServiceContracts = new FilteredTypes(codeNamespace);
            ServiceTypes = new FilteredTypes(codeNamespace);
            ClientTypes = new FilteredTypes(codeNamespace);
            DataContracts = new FilteredTypes(codeNamespace);
            MessageContracts = new FilteredTypes(codeNamespace);
            UnfilteredTypes = new FilteredTypes(codeNamespace);
            TextFiles = new List<TextFile>();

            ParseAndFilterCodeNamespace();
        }
        private void RunConverter(FilteredTypes collection)
        {
            // Get the initial count in the collection.
            int icount = collection.Count;

            // Do this for each type found in the filtered type collection.
            for (int i = 0; i < icount; i++ )
            {
                CodeTypeExtension typeExtension = collection[i];
                // Send the fields to members converter
                ConvertMembers(typeExtension.Fields);
                // Send the properties to the members converter.
                ConvertMembers(typeExtension.Properties);
                // Send the methods to the members converter.
                ConvertMembers(typeExtension.Methods);
                // Send the constructors to the members converter.
                ConvertMembers(typeExtension.Constructors);
            }
        }
Exemplo n.º 7
0
        public bool CanHaveStatefulFields(Control control)
        {
            if (control is LiteralControl)             //quickly removed the LiteralControls
            {
                return(false);
            }
            if (control is UserControl || control is Page)
            {
                if (control is IStatefulFieldsControl)
                {
                    if (((IStatefulFieldsControl)control).IgnoreStatefulFields)
                    {
                        return(false);
                    }
                }
                return(Attribute.GetCustomAttribute(control.GetType(), typeof(IgnoreStatefulFields)) == null);
            }
            Type t = control.GetType();

            LogFactory.Log.Debug("inspecting " + t + control.ID + "(" + control.UniqueID + ")");
            if (AllowedTypes.Contains(t))
            {
                return(true);
            }
            if (FilteredTypes.Contains(t))
            {
                return(false);
            }
            foreach (Type ft in FilteredBaseTypes)
            {
                if (t.IsSubclassOf(ft))
                {
                    FilteredTypes.Add(t);
                    return(false);
                }
            }
            //this line took too much resources:
            //return Attribute.GetCustomAttribute(control.GetType(), typeof (HasStatefulField)) != null;
            return(true);
        }
 private void UpdateTypeReferencesInternal(FilteredTypes types, string oldName, string newName)
 {
     foreach (CodeTypeExtension ext in types)
     {
         CodeRefactoringAgent updater = new CodeRefactoringAgent();
         updater.Refactor(ext, oldName, newName);
     }
 }
    protected override void DrawEdit(ref Rect pos)
    {
        base.DrawEdit(ref pos);

        if (ShowSearchField)
        {
            //draw filter sting field
            pos.height   = SingleLineHeight;
            FilterString = EditorGUI.TextField(pos, "Filter Type", FilterString);
            pos.y       += SingleLineHeight;
        }

        //draw the pop-up field

        lock (name)
        {
            SelectedIndex = EditorGUI.Popup(pos, FieldTypeFieldString, SelectedIndex, FilteredTypes.Select(x => x.Name).ToArray());
        }
        pos.y += SingleLineHeight;
    }