Exemple #1
0
 public void SerializeObject(string filename, TextSplitText objectToSerialize)
 {
     Stream stream = File.Open(filename, FileMode.Create);
     BinaryFormatter bFormatter = new BinaryFormatter();
     bFormatter.Serialize(stream, objectToSerialize);
     stream.Close();
 }
Exemple #2
0
        public void SerializeObject(string filename, TextSplitText objectToSerialize)
        {
            Stream          stream     = File.Open(filename, FileMode.Create);
            BinaryFormatter bFormatter = new BinaryFormatter();

            bFormatter.Serialize(stream, objectToSerialize);
            stream.Close();
        }
Exemple #3
0
 public void Apply(TextSplitText tst, bool displaySlide)
 {
     tst.TextFont = Font;
     tst.Colors = new Color[] { ColorT, ColorB };
     if (displaySlide)
         Globals.CurrentWindow.DisplaySlide();
     Globals.CurrentWindow.ChangeFilenameUnsaved();
 }
Exemple #4
0
 public void Apply(TextSplitText tst, bool displaySlide)
 {
     tst.TextFont = Font;
     tst.Colors   = new Color[] { ColorT, ColorB };
     if (displaySlide)
     {
         Globals.CurrentWindow.DisplaySlide();
     }
     Globals.CurrentWindow.ChangeFilenameUnsaved();
 }
Exemple #5
0
        public void OpenFile(string title)
        {
            CheckSaveChange(); // Saves the old file if it has any changes

            openFileDialog.Filter = "TextSplit Text File|*.tst";
            openFileDialog.Title  = title;
            if (openFileDialog.ShowDialog() != DialogResult.Cancel && openFileDialog.FileName != "")
            {
                fileName = openFileDialog.FileName;
                TST      = serializer.DeSerializeObject(fileName);
                FileChangeActions();
                Focus();
            }
        }
Exemple #6
0
        /*
         * New, Save, Save As, Open
         */

        public void NewFile()
        {
            CheckSaveChange(); // Saves the old file if it has any changes

            TextSplitText TST_temp = new TextSplitText(TST);

            TST.Empty();
            SaveAsFile("New File");
            if (saveCancel)
            {
                TST = TST_temp;
            }
            else
            {
                Width  = 300;
                Height = 300;
            }
        }
Exemple #7
0
        // Opens a new window and loads the .tst file with the given fileName
        // If the file doesn't exist (e.g. fileName = ""), then it will open the example file
        public TextSplitShow(string fileName, bool addToFileNames)
        {
            InitializeComponent();

            FormClosing         += new FormClosingEventHandler(TSS_Closing);
            tTextBox.GotFocus   += new EventHandler(tTextBox_GotFocus);
            tTextBox.LostFocus  += new EventHandler(tTextBox_Unfocus);
            tTextBox.MouseEnter += new EventHandler(tTextBox_MouseEnter);
            SizeChanged         += new EventHandler(TSS_SizeChanged);
            Resize += new EventHandler(TSS_Resize);
            saveToolStripMenuItem.Click   += new EventHandler(Globals.TSM.saveToolStripMenuItem_Click);
            saveAsToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveAsToolStripMenuItem_Click);

            currentSlide          = 0;
            fileLoaded            = false;
            saveChanged           = false;
            this.fileName         = fileName;
            TST                   = new TextSplitText();
            Globals.CurrentWindow = this;
            Globals.WindowList.Add(this);
            if (addToFileNames)
            {
                Properties.Settings.Default.FileNames.Add(fileName);
            }

            serializer = new Serializer();
            try {
                TST = serializer.DeSerializeObject(fileName);
                FileChangeActions();
            } catch (Exception) {
                this.fileName = "Example";
                TST.Empty();

                ChangeFilenameSaved();
                Globals.UpdateSlideInfo();
                Globals.ChangeDisableHK();
                Globals.ChangeReadOnly();
            }
        }
Exemple #8
0
        // Opens a new window and loads the .tst file with the given fileName
        // If the file doesn't exist (e.g. fileName = ""), then it will open the example file
        public TextSplitShow(string fileName, bool addToFileNames)
        {
            InitializeComponent();

            FormClosing += new FormClosingEventHandler(TSS_Closing);
            tTextBox.GotFocus += new EventHandler(tTextBox_GotFocus);
            tTextBox.LostFocus += new EventHandler(tTextBox_Unfocus);
            tTextBox.MouseEnter += new EventHandler(tTextBox_MouseEnter);
            SizeChanged += new EventHandler(TSS_SizeChanged);
            Resize += new EventHandler(TSS_Resize);
            saveToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveToolStripMenuItem_Click);
            saveAsToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveAsToolStripMenuItem_Click);

            currentSlide = 0;
            fileLoaded = false;
            saveChanged = false;
            this.fileName = fileName;
            TST = new TextSplitText();
            Globals.CurrentWindow = this;
            Globals.WindowList.Add(this);
            if (addToFileNames)
                Properties.Settings.Default.FileNames.Add(fileName);

            serializer = new Serializer();
            try {
                TST = serializer.DeSerializeObject(fileName);
                FileChangeActions();
            } catch (Exception) {
                this.fileName = "Example";
                TST.Empty();

                ChangeFilenameSaved();
                Globals.UpdateSlideInfo();
                Globals.ChangeDisableHK();
                Globals.ChangeReadOnly();
            }
        }
Exemple #9
0
        public void OpenFile(string title)
        {
            CheckSaveChange(); // Saves the old file if it has any changes

            openFileDialog.Filter = "TextSplit Text File|*.tst";
            openFileDialog.Title = title;
            if (openFileDialog.ShowDialog() != DialogResult.Cancel && openFileDialog.FileName != "") {
                fileName = openFileDialog.FileName;
                TST = serializer.DeSerializeObject(fileName);
                FileChangeActions();
                Focus();
            }
        }
Exemple #10
0
        /*
         * New, Save, Save As, Open
         */
        public void NewFile()
        {
            CheckSaveChange(); // Saves the old file if it has any changes

            TextSplitText TST_temp = new TextSplitText(TST);
            TST.Empty();
            SaveAsFile("New File");
            if (saveCancel) {
                TST = TST_temp;
            } else {
                Width = 300;
                Height = 300;
            }
        }