예제 #1
0
        public void OpenDeck(FileInfo file)
        {
            ///we will use this in order to set the HumanName of the deck, which will
            ///give us the correct filename when we look at it in the tab view for the deck.
            file_to_open_ = file;
            Misc.ProgressBarForm pbf = new Misc.ProgressBarForm("Opening \"" + file.Name + "\"...");

            pbf.DoWork += new DoWorkEventHandler(this.RunWorker);
            pbf.Show();
            pbf.StartWork(file);
        }
예제 #2
0
        public void OpenDeck(FileInfo file)
        {
            ///we will use this in order to set the HumanName of the deck, which will
            ///give us the correct filename when we look at it in the tab view for the deck.
            file_to_open_ = file;

            if (file_to_open_.Name.EndsWith("xps"))
            {
                OpenXps(file_to_open_);
                return;
            }

            Misc.ProgressBarForm pbf = new Misc.ProgressBarForm("Opening \"" + file.Name + "\"...");
            pbf.DoWork += new DoWorkEventHandler(this.RunWorker);
            pbf.Show();
            pbf.StartWork(file);
        }
예제 #3
0
        private void insertImageSet()
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            fbd.ShowNewFolderButton = false;
            fbd.RootFolder = System.Environment.SpecialFolder.Desktop;
            if (fbd.ShowDialog() == DialogResult.OK) {
                string[] filenames = SelectImageFiles(Directory.GetFiles(fbd.SelectedPath));
                Array.Sort(filenames);                          // Order not guaranteed - so we need to sort, Bug 941

                Misc.ProgressBarForm pbf = new Misc.ProgressBarForm("Loading...");
                pbf.DoWork += new DoWorkEventHandler(this.insertImagesWorker);
                pbf.Show();
                pbf.StartWork(filenames);
            }
        }
예제 #4
0
 private void insertSlides()
 {
     //If we don't have a deck/traversal open, just open a deck...
     if (this.deck == null || this.traversal == null || this.dtma == null) {
         this.openFile();
         return;
     }
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Filter = "PPT Files (*.ppt)|*.ppt|CP3 Files (*.cp3)|*.cp3|All files (*.*)|*.*";
     if (ofd.ShowDialog() == DialogResult.OK) {
         FileInfo file = new FileInfo(ofd.FileName);
         Cursor.Current = Cursors.WaitCursor;
         DeckModel deckToInsert = this.deck;
         if (file.Extension == ".ppt") {
             Misc.ProgressBarForm pbf = new Misc.ProgressBarForm("Opening \"" + file.Name + "\"...");
             pbf.DoWork += new DoWorkEventHandler(this.InsertSlidesLoadAsyncWorker);
             pbf.Show();
             pbf.StartWork(file);
         } else if (file.Extension == ".cp3") {
             deckToInsert = Decks.PPTDeckIO.OpenCP3(new FileInfo(ofd.FileName));
             this.insertSlidesHelper(deckToInsert);
         } else {
             //TODO
             return;
         }
     }
 }
예제 #5
0
        public void OpenFileHelper(FileInfo filename, bool UIEnabled)
        {
            //Continue opening by figuring out the extension and routing the open to the correct method
            if (filename.Extension == ".ppt" || filename.Extension == ".pptx") {
                if (UIEnabled) {
                    Misc.ProgressBarForm pbf = new Misc.ProgressBarForm("Opening \"" + filename.Name + "\"...");
                    pbf.DoWork += new DoWorkEventHandler(this.openFileAsyncWorker);
                    pbf.Show();
                    pbf.StartWork(filename);

                    //Cache the PPT filename for reuse in the save dialogs
                    this.pptFileName = filename.Name;
                    //Set the dirty flag, since we want to ask if we want to lose the CP3
                    this.isDirty = true;
                } else {
                    this.openFileCompleteHelper(PPTDeckIO.OpenPPT(filename));
                }
            } else if (filename.Extension == ".cp3") {
                try {
                    this.openFileCompleteHelper(PPTDeckIO.OpenCP3(filename));
                } catch (System.Runtime.Serialization.SerializationException) {
                    MessageBox.Show("An error occurred while opening \"" + filename.Name +
                        "\".  File is corrupted or is incompatible with the current version.",
                        "DeckBuilder 3.0", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                        MessageBoxDefaultButton.Button1);
                } catch (Exception e) {
                    MessageBox.Show("An error occurred while opening \"" + filename.Name +
                        "\".  " + e.ToString(), "DeckBuilder 3.0", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                        MessageBoxDefaultButton.Button1);
                }
            } else {
                //Unrecognized file extension
                throw new Exception("Unknown File Type");
            }
            //Save the file name for future use
            if (filename.Extension != ".ppt") {
                this.saveFilename = filename.FullName;
            }
        }