Click here to Skip to main content
15,895,831 members
Articles / Desktop Programming / WPF

How to create a VS 2012 like application - Wide IDE Framework (v0.1)

Rate me:
Please Sign up or sign in to vote.
4.64/5 (25 votes)
2 Apr 2013LGPL38 min read 66.1K   9.5K   113  
Participatory IDE framework built using WPF, PRISM and other open source projects
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using Wide.Interfaces;
using Wide.Interfaces.Utils;
using Wide.Interfaces.Utils;
using Xceed.Wpf.Toolkit.PropertyGrid;

namespace Wide.Settings
{
    public abstract class AbstractSettings : AbstractPrioritizedTree<AbstractSettings>, ICloneable
    {
        protected AbstractSettings() : base()
        {
            Reset();
        }

        [Browsable(false)]
        public string Title { get; protected set; }

        [Browsable(false)]
        public virtual ContentControl View
        {
            get 
            { 
                ContentControl c = new ContentControl();
                PropertyGrid propertyGrid = new PropertyGrid();
                propertyGrid.ShowSearchBox = false;
                propertyGrid.SelectedObject = this;
                c.Content = propertyGrid;
                return c; 
            }
        }

        public virtual void Reset()
        {
            // Iterate through each property and call ResetValue()
            foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(this))
                property.ResetValue(this);

            foreach (AbstractSettings settings in Children)
            {
                settings.Reset();
            }
        }

        //Settings needs to override, save and call base.Save()
        public virtual void Save()
        {
            foreach (AbstractSettings settings in Children)
            {
                settings.Save();
            }
        }

        public abstract void Load();

        public abstract object Clone();

        protected ObservableCollection<AbstractSettings> ChildClone()
        {
            ObservableCollection<AbstractSettings> newChildren =
                    this.Children.Clone<AbstractSettings>().ToObservableCollection();
            return newChildren;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer
United States United States
Hello! I'm a 26 year old, WPF/C# self-learned software developer, musician from India with a Master's degree in Computer science. I believe that every piece of software and information/knowledge is available for free for those who seek it.

My projects are available in my Webpage hosted on Github. I am eager to learn new things everyday, explore new technologies and solve problems.

Comments and Discussions