示例#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();
 }
示例#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();
        }
示例#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();
 }
示例#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();
 }
示例#5
0
文件: TSS.cs 项目: mwaltman/TextSplit
        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();
            }
        }
示例#6
0
文件: TSS.cs 项目: mwaltman/TextSplit
        /*
         * 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;
            }
        }
示例#7
0
文件: TSS.cs 项目: mwaltman/TextSplit
        // 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();
            }
        }
示例#8
0
文件: TSS.cs 项目: mwaltman/TextSplit
        // 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();
            }
        }
示例#9
0
文件: TSS.cs 项目: mwaltman/TextSplit
        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();
            }
        }
示例#10
0
文件: TSS.cs 项目: mwaltman/TextSplit
        /*
         * 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;
            }
        }