private void saveButton(object sender, EventArgs e) { if (saver.FileName.Length == 0 || ModifierKeys == Keys.Shift) { saver.DefaultExt = "*.jpg"; saver.Filter = "image |*.jpg"; // Determine whether the user selected a file name from the saveFileDialog. if (saver.ShowDialog() == DialogResult.OK && saver.FileName.Length > 0) { string fileName = saver.FileName.Substring(saver.FileName.LastIndexOf('/') + 1); thisFile = new displayItem(fileName, DateTime.Now, "drawing", saver.FileName); tempData.store.Add(thisFile); // Save the contents of the RichTextBox into the file. if (File.Exists(saver.FileName)) { File.Delete(saver.FileName); } drawing.Save(saver.FileName); this.Text = saver.FileName; stared = false; } } else { if (File.Exists(saver.FileName)) { File.Delete(saver.FileName); } drawing.Save(saver.FileName); this.Text = saver.FileName; stared = false; } }
private void saveButton_Click(object sender, EventArgs e) { // Initialize the SaveFileDialog to specify the RTF extention for the file. if (saveFile1.FileName.Length == 0 || ModifierKeys == Keys.Shift) { // Determine whether the user selected a file name from the saveFileDialog. if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { // Save the contents of the RichTextBox into the file. textIn.SaveFile(saveFile1.FileName); string fileName = saveFile1.FileName.Substring(saveFile1.FileName.LastIndexOf('/') + 1); thisFile = new displayItem(fileName, DateTime.Now, "text", saveFile1.FileName); tempData.store.Add(thisFile); // title manange this.Text = saveFile1.FileName; stared = false; } } else { textIn.SaveFile(saveFile1.FileName); this.Text = saveFile1.FileName; stared = false; thisFile.time = DateTime.Now; // update edit time } //if(ModifierKeys) textIn.Focus(); }
public DrawForm(displayItem file) { // bug: load big picture InitializeComponent(); init(); thisFile = file; saver.FileName = file.filePath; }
public TextEdi(displayItem file) { InitializeComponent(); this.thisFile = file; init(); stared = false; this.Text = file.filePath; saveFile1.FileName = file.filePath; this.textIn.LoadFile(file.filePath); }
private void initializeList() { this.olvColumn1.ImageGetter = delegate(object src) { displayItem buf = (displayItem)src; if (buf.type == "text") { return("text"); } else { return("drawing"); } }; this.olvColumn1.GroupKeyGetter = (object src) => { displayItem buf = (displayItem)src; return(buf.time.GetDateTimeFormats('d')[0]); }; this.fileList.SetObjects(tempData.store); }