コード例 #1
0
        public void CreatePresentationFromPpt()
        {
            if (!CheckForConfiguration())
                return;

            string authorName = identity.User.FullName;
            if (String.IsNullOrEmpty(authorName))
                authorName = identity.User.Name;

            Presentation presentation = PresentationController.NewPresentation(FindNextName(), authorName, 0);
            PresentationInfo pi = new PresentationInfo(presentation);

            DialogResult result;
            using (PresentationPropertiesForm dlg = new PresentationPropertiesForm(pi, true))
                result = dlg.ShowDialog(view);
            if (result == DialogResult.OK)
            {
                // выбор файла PPT
                string selectedFile = null;
                using (OpenFileDialog openFileDialog = new OpenFileDialog())
                {
                    openFileDialog.Multiselect = false;
                    openFileDialog.Filter = "Презентация PowerPoint (*.ppt)|*.ppt";
                    openFileDialog.RestoreDirectory = true;
                    result = openFileDialog.ShowDialog(view);
                    selectedFile = openFileDialog.FileName;
                }
                if (result == DialogResult.OK && !string.IsNullOrEmpty(selectedFile))
                {
                    try
                    {
                        // обработка файла
                        string[] files = CreatePptFilesFromFile(selectedFile);
                        try
                        {
                            // выбор активного дисплея
                            DisplayType selectedDisplay = null;
                            using (SelectActiveDisplayForm form = new SelectActiveDisplayForm(
                                PresentationController.Configuration.ModuleConfiguration.DisplayList.Where(
                                    dt => !dt.IsHardware)))
                            {
                                if (form.ShowDialog(view) == DialogResult.Cancel)
                                    return;
                                selectedDisplay = form.SelectedDisplay;
                            }
                            BackgroundImageDescriptor[] descriptors = CreateBackgroundImageDescriptorsFromFiles(files,
                                                                                                                pi);
                            if (!SaveBackGroundDescriptors(descriptors))
                            {
                                MessageBoxExt.Show("Не удалось создать подложки!", "Ошибка", MessageBoxButtons.OK,
                                                   MessageBoxIcon.Error);
                                return;
                            }
                            // создание сценария с кучей сценой
                            if (!CreatePresentationWithBackgrounds(pi, descriptors, selectedDisplay))
                                return;
                        }
                        finally
                        {
                            foreach (string file in files)
                            {
                                File.Delete(file);
                            }
                        }
                    }
                    catch
                    {
                        MessageBoxExt.Show("Выбран некорректный файл PowerPoint. Создание сценария невозможно", "Ошибка", MessageBoxButtons.OK,
                           MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    // создание сценария с одной сценой
                    if (!CreatePresentationWithOneSlide(pi))
                        return;
                }
            }
            else
            {
                presentationID = new Identity(presentationID.CurrentID - 1);
            }

            RestoreFilter(creatingPresentation);
        }
コード例 #2
0
        private void propertiesMenuButton_Click(object sender, EventArgs e)
        {
            //Свойства сценария
            using (PresentationPropertiesForm form = new PresentationPropertiesForm(m_PresentationInfo))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    m_Presentation.Name = m_PresentationInfo.Name;
                    m_Presentation.Comment = m_PresentationInfo.Comment;
                    m_Presentation.Author = m_PresentationInfo.Author;

                    RefreshTitle();
                    PresentationController.Instance.PresentationChanged = true;
                    savePresentationToolButton.Enabled = true;
                    saveMenuButton.Enabled = true;
                }
            }
        }
コード例 #3
0
        public void CreatePresentation()
        {
            if (!CheckForConfiguration())
                return;

            string authorName = identity.User.FullName;
            if (String.IsNullOrEmpty(authorName))
                authorName = identity.User.Name;

            string name = FindNextName();
            Presentation presentation = PresentationController.NewPresentation(name, authorName, 1);
            PresentationInfo pi = new PresentationInfo(presentation);

            DialogResult result;
            using (PresentationPropertiesForm dlg = new PresentationPropertiesForm(pi, true))
                result = dlg.ShowDialog();
            if (result == DialogResult.OK)
            {
                if (!CreatePresentationWithOneSlide(pi))
                    return;
            }
            else
            {
                presentationID = new Identity(presentationID.CurrentID - 1);
            }

            RestoreFilter(creatingPresentation);
        }