Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            mediaTree = leftPanel1.Summary;
            mediaTree.SelectedItemChanged += new EventHandler(mediaTree_AfterSelect);

            mediaStore = new MediaStore();

            mediaItems = new List <MediaItem>();
            foreach (MediaItem item in mediaStore.GetAllMedia())
            {
                mediaItems.Add(item);
            }

            leftPanel1.Initialise(mediaItems);

            ctx = ContextRegistry.GetContext();
            foreach (DictionaryEntry entry in ctx.GetObjectsOfType(typeof(MediaTypeProvider)))
            {
                MediaTypeProvider provider = (MediaTypeProvider)entry.Value;
                providers[provider.Name] = provider;
                drpItemTypes.Items.Add(new ListItem(provider, provider.Name));
            }
            drpItemTypes.SelectedIndex = 0;
            UpdateDisplay();
        }
Exemplo n.º 2
0
        void button_Click(object sender, EventArgs e)
        {
            ToolStripButton   button   = sender as ToolStripButton;
            MediaTypeProvider provider = button.Tag as MediaTypeProvider;

            titleStrip.Items[0].Text = provider.Name;
            mediaItemTree1.Initialise(items, provider.Name);
        }
Exemplo n.º 3
0
        public void Initialise(IList <MediaItem> items)
        {
            this.items = items;
            ToolStripButton   button   = GetSelectedButton();
            MediaTypeProvider provider = button.Tag as MediaTypeProvider;

            titleStrip.Items[0].Text = provider.Name;
            mediaItemTree1.Initialise(items, provider.Name);
        }
Exemplo n.º 4
0
        private IList <MediaTypeProvider> GetProviders()
        {
            IList <MediaTypeProvider> providers = new List <MediaTypeProvider>();

            if (!DesignMode)
            {
                IApplicationContext ctx = ContextRegistry.GetContext();
                foreach (DictionaryEntry entry in ctx.GetObjectsOfType(typeof(MediaTypeProvider)))
                {
                    MediaTypeProvider provider = (MediaTypeProvider)entry.Value;
                    providers.Add(provider);
                }
            }
            return(providers);
        }
Exemplo n.º 5
0
        private void DoAdd()
        {
            curIndex = mediaItems.Count;

            ListItem          listItem = (ListItem)drpItemTypes.SelectedItem;
            MediaTypeProvider provider = (MediaTypeProvider)listItem.Key;
            MediaItem         item     = provider.CreateMediaItem();

            // MediaItem item = (MediaItem)ctx.GetObject(listItem.Key);

            //MediaItem item = new MediaItem();
            //item.GeneralInformation = new MediaGeneralInformation();
            mediaItems.Add(item);
            mediaTree.Add(item);
            UpdateDisplay();
        }
Exemplo n.º 6
0
        private Control GetEditor(string type)
        {
            if (type == null)
            {
                return(tcEditorPanels);
            }

            Control editor;

            MediaTypeProvider provider = providers[type];

            if (provider == null)
            {
                throw new Exception("Provider not found for item of type: " + type);
            }
            editor      = provider.Editor;
            editor.Dock = DockStyle.Fill;
            return(editor);
        }