예제 #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);
                }
            }
        }
예제 #2
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);
         }
     }
 }
예제 #3
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);
                }
            }
        }
예제 #4
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);
                }
            }
        }