Ejemplo n.º 1
0
        private void CheckForChanges()
        {
            bool acceptedSaved = false;

            foreach (TabPage page in tabsMediaPanel.TabPages)
            {
                Controls.MediaEditor editor = (Controls.MediaEditor)page.Tag;
                if (editor.Status == global::OMLDatabaseEditor.Controls.MediaEditor.TitleStatus.UnsavedChanges)
                {
                    // First run through if they accept the save this will only show once, if they deny then finish exit
                    if (acceptedSaved == false)
                    {
                        if (MessageBox.Show("Would you like to save your changes?"
                                            , "Unsaved Changes"
                                            , MessageBoxButtons.YesNo
                                            , MessageBoxIcon.Question
                                            , MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                        {
                            acceptedSaved = true;
                        }
                        else
                        {
                            return;
                        }
                    }
                    Title _currentTitle = _titleCollection.FindByID(editor.itemID);

                    editor.SaveToTitle(_currentTitle);
                    _titleCollection.Replace(_currentTitle);
                }
            }
        }
Ejemplo n.º 2
0
 private void btnAmazon_Click(object sender, EventArgs e)
 {
     if (this.tabsMediaPanel.SelectedTab != null)
     {
         Controls.MediaEditor _currentEditor = (Controls.MediaEditor) this.tabsMediaPanel.SelectedTab.Controls[0].Controls[0];
         Title _currentTitle = _titleCollection.FindByID(_currentEditor.itemID);
     }
 }
Ejemplo n.º 3
0
        private TabPage GetPageForTitle(int itemId)
        {
            Controls.MediaEditor editor = null;
            foreach (TabPage page in tabsMediaPanel.TabPages)
            {
                editor = (Controls.MediaEditor)page.Tag;
                if (editor.itemID == itemId)
                {
                    return(page);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
 private void SaveCurrentTab()
 {
     if (this.tabsMediaPanel.SelectedTab != null)
     {
         Controls.MediaEditor editor = (Controls.MediaEditor)tabsMediaPanel.SelectedTab.Controls[0].Controls[0];
         if (editor.Status == global::OMLDatabaseEditor.Controls.MediaEditor.TitleStatus.UnsavedChanges)
         {
             Title _currentTitle = _titleCollection.FindByID(editor.itemID);
             editor.SaveToTitle(_currentTitle);
             UpdateMovieName(_currentTitle);
             SaveTitleChangesToDB(_currentTitle);
         }
     }
 }
Ejemplo n.º 5
0
        private void SaveAll()
        {
            foreach (TabPage page in tabsMediaPanel.TabPages)
            {
                Controls.MediaEditor editor = (Controls.MediaEditor)page.Tag;
                if (editor.Status == global::OMLDatabaseEditor.Controls.MediaEditor.TitleStatus.UnsavedChanges)
                {
                    Title _currentTitle = _titleCollection.FindByID(editor.itemID);

                    editor.SaveToTitle(_currentTitle);
                    _titleCollection.Replace(_currentTitle);
                    UpdateMovieName(_currentTitle);
                }
            }
        }
Ejemplo n.º 6
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofDiag = new OpenFileDialog();

            ofDiag.InitialDirectory   = "c:\\";
            ofDiag.Filter             = "Xml files (*.xml)|*.xml|All files (*.*)|*.*";
            ofDiag.FilterIndex        = 1;
            ofDiag.RestoreDirectory   = true;
            ofDiag.AutoUpgradeEnabled = true;
            ofDiag.CheckFileExists    = true;
            ofDiag.CheckPathExists    = true;
            ofDiag.Multiselect        = false;
            ofDiag.Title = "Select file to import";
            DialogResult dlgRslt = ofDiag.ShowDialog();

            if (dlgRslt == DialogResult.OK)
            {
                Title t      = Title.CreateFromXML(ofDiag.FileName, true);
                bool  bAdded = false;
                if (_titleCollection.ContainsDisks(t.Disks))
                {
                    if (MessageBox.Show("This movie is already on the list!\n\n Do you want to overwrite it?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Title oldTitle = _titleCollection.FindByDisks(t.Disks);
                        tvSourceList.Nodes["OML Database"].Nodes["Movies"].Nodes.RemoveByKey(oldTitle.InternalItemID.ToString());
                        _titleCollection.Remove(oldTitle.InternalItemID);
                        _titleCollection.Add(t);
                        tvSourceList_AddItem(t.Name, t.InternalItemID.ToString(), "Movies");
                        bAdded = true;
                    }
                }
                else
                {
                    _titleCollection.Add(t);
                    tvSourceList_AddItem(t.Name, t.InternalItemID.ToString(), "Movies");

                    bAdded = true;
                }

                if (bAdded)
                {
                    EditNewTab(t.InternalItemID);
                    Controls.MediaEditor _currentEditor = (Controls.MediaEditor) this.tabsMediaPanel.SelectedTab.Controls[0].Controls[0];
                    _currentEditor.Status = global::OMLDatabaseEditor.Controls.MediaEditor.TitleStatus.UnsavedChanges;
                    MarkChangedItem(_currentEditor, true);
                }
            }
        }
Ejemplo n.º 7
0
 private void MarkChangedItem(Controls.MediaEditor editor, bool changed)
 {
     foreach (TabPage page in tabsMediaPanel.TabPages)
     {
         if (page.Tag == editor)
         {
             if (changed)
             {
                 page.Text = "*" + editor.TitleName;
             }
             else
             {
                 page.Text = editor.TitleName;
             }
             break;
         }
     }
 }
Ejemplo n.º 8
0
        void StartMetadataImport(int pluginId, bool coverArtOnly)
        {
            try
            {
                Controls.MediaEditor e = GetCurrentEditor();
                if (e != null)
                {
                    Cursor = Cursors.WaitCursor;
                    _metadataPlugins[pluginId].SearchForMovie(e.TitleName);
                    frmSearchResult searchResultForm = new frmSearchResult();
                    Cursor = Cursors.Default;
                    DialogResult result = searchResultForm.ShowResults(_metadataPlugins[pluginId].GetAvailableTitles());
                    if (result == DialogResult.OK)
                    {
                        Title t = _metadataPlugins[pluginId].GetTitle(searchResultForm.SelectedTitleIndex);
                        if (t != null)
                        {
                            if (coverArtOnly)
                            {
                                if (!String.IsNullOrEmpty(t.FrontCoverPath))
                                {
                                    SaveCurrentTab();
                                    e.CurrentTitle.CopyFrontCoverFromFile(t.FrontCoverPath, true);
                                    e.LoadTitle(e.CurrentTitle);
                                }
                            }
                            else
                            {
                                e.CurrentTitle.CopyMetadata(t, searchResultForm.OverwriteMetadata);

                                e.LoadTitle(e.CurrentTitle);
                            }
                        }
                    }
                }
            }
            catch
            {
                Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 9
0
        private void saveToXMLFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tabsMediaPanel.SelectedTab != null)
            {
                Controls.MediaEditor _currentEditor = (Controls.MediaEditor) this.tabsMediaPanel.SelectedTab.Controls[0].Controls[0];
                Title _currentTitle = _titleCollection.FindByID(_currentEditor.itemID);

                if (_currentTitle.Disks.Count > 0)
                {
                    Disk   firstDisc = _currentTitle.Disks[0];
                    string fileName  = firstDisc.Path + ".oml.xml";
                    _currentTitle.SerializeToXMLFile(fileName);
                }
                else
                {
                    // prompt where to save the movie information
                }

                //_currentEditor.SaveToTitle(_currentTitle);
                //SaveTitleChangesToDB(_currentTitle);
            }
        }
Ejemplo n.º 10
0
        private void tsbClose_Click(object sender, EventArgs e)
        {
            if (tabsMediaPanel.SelectedTab != null && tabsMediaPanel.SelectedTab.Controls != null && tabsMediaPanel.SelectedTab.Controls[0].Controls != null)
            {
                Controls.MediaEditor _currentEditor = (Controls.MediaEditor)tabsMediaPanel.SelectedTab.Controls[0].Controls[0];

                if (_currentEditor == null)
                {
                    return;
                }

                bool _bClose = true;

                if (_currentEditor.Status == global::OMLDatabaseEditor.Controls.MediaEditor.TitleStatus.UnsavedChanges)
                {
                    DialogResult result = MessageBox.Show("Do you want to save the changes to the current movie?", "", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (result == DialogResult.Cancel)
                    {
                        _bClose = false;
                    }
                    else if (result == DialogResult.Yes)
                    {
                        Title _currentTitle = _titleCollection.FindByID(_currentEditor.itemID);

                        _currentEditor.SaveToTitle(_currentTitle);
                        SaveTitleChangesToDB(_currentTitle);
                    }
                    else
                    {
                    }
                }

                if (_bClose)
                {
                    TabPage _currentTab = tabsMediaPanel.SelectedTab;
                    tabsMediaPanel.TabPages.Remove(_currentTab);
                }
            }
        }
Ejemplo n.º 11
0
        private void EditNewTab(int itemID)
        {
            Controls.MediaEditor Editor = new Controls.MediaEditor();

            Editor.AutoScroll = true;
            Editor.AutoSize   = true;
            Editor.BackColor  = System.Drawing.SystemColors.Control;
            Editor.Dock       = System.Windows.Forms.DockStyle.Fill;
            Editor.Location   = new System.Drawing.Point(0, 0);
            Editor.Name       = "ME" + itemID.ToString();

            Title currentTitle = new Title();

            currentTitle = _titleCollection.FindByID(itemID);

            System.Windows.Forms.Panel p = new Panel();

            p.AutoScroll = true;
            p.AllowDrop  = true;
            p.Size       = new System.Drawing.Size(680, 772);
            TabPage newpage = new TabPage(currentTitle.Name);

            newpage.AutoScroll = true;
            p.Controls.Add(Editor);

            newpage.Controls.Add(p);
            newpage.Tag = Editor;

            tabsMediaPanel.TabPages.Add(newpage);

            Editor.LoadTitle(currentTitle);
            Editor.TitleChanged     += new Controls.MediaEditor.TitleChangeEventHandler(this.TitleChanges);
            Editor.TitleNameChanged += new Controls.MediaEditor.TitleNameChangeEventHandler(this.TitleNameChanges);
            Editor.SavedTitle       += new Controls.MediaEditor.SavedEventHandler(this.SavedTitle);

            tabsMediaPanel.SelectTab(newpage);
        }
Ejemplo n.º 12
0
 private void SavedTitle(object sender, EventArgs e)
 {
     Controls.MediaEditor _currentEditor = (Controls.MediaEditor)sender;
     MarkChangedItem(_currentEditor, false);
 }
Ejemplo n.º 13
0
 private void TitleNameChanges(object sender, EventArgs e)
 {
     Controls.MediaEditor _currentEditor = (Controls.MediaEditor)sender;
     MarkChangedItem(_currentEditor, true);
 }
Ejemplo n.º 14
0
        private void EditNewTab(int itemID)
        {
            Controls.MediaEditor Editor = new Controls.MediaEditor();

            Editor.AutoScroll = true;
            Editor.AutoSize = true;
            Editor.BackColor = System.Drawing.SystemColors.Control;
            Editor.Dock = System.Windows.Forms.DockStyle.Fill;
            Editor.Location = new System.Drawing.Point(0, 0);
            Editor.Name = "ME" + itemID.ToString();

            Title currentTitle = new Title();
            currentTitle = _titleCollection.FindByID(itemID);

            System.Windows.Forms.Panel p = new Panel();

            p.AutoScroll = true;
            p.AllowDrop = true;
            p.Size = new System.Drawing.Size(680, 772);
            TabPage newpage = new TabPage(currentTitle.Name);
            newpage.AutoScroll = true;
            p.Controls.Add(Editor);

            newpage.Controls.Add(p);
            newpage.Tag = Editor;

            tabsMediaPanel.TabPages.Add(newpage);

            Editor.LoadTitle(currentTitle);
            Editor.TitleChanged += new Controls.MediaEditor.TitleChangeEventHandler(this.TitleChanges);
            Editor.TitleNameChanged += new Controls.MediaEditor.TitleNameChangeEventHandler(this.TitleNameChanges);
            Editor.SavedTitle += new Controls.MediaEditor.SavedEventHandler(this.SavedTitle);

            tabsMediaPanel.SelectTab(newpage);
        }