private void TextBox_OnDrop(object sender, DragEventArgs e) { string[] data = (string[])e.Data.GetData(DataFormats.FileDrop, false); FileDetails f = FileOperations.OpenFileNoDialog(data[0]); UISetFile(f); }
private void UISetFile(FileDetails details) { TextBox.Text = details.file; MainWindow.changeHeader(details.fileName); //this.Parent.Title = details.fileName; windowToFilenameDictionary[0] = details.fileName; }
internal static FileDetails OpenFileNoDialog(string fileName) { FileDetails f = new FileDetails(); StreamReader reader = new StreamReader(fileName); f.file = reader.ReadToEnd(); reader.Close(); f.fileName = fileName; return(f); }
public TextControl() { InitializeComponent(); windowToFilenameDictionary[0] = ""; string[] args = System.Environment.GetCommandLineArgs(); if (args.Length > 1) { string fileName = args[1]; FileDetails f = FileOperations.OpenFileNoDialog(fileName); UISetFile(f); } }
internal static FileDetails OpenFile() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"; FileDetails f = new FileDetails(); if (ofd.ShowDialog() == true) { f = OpenFileNoDialog(ofd.FileName); } return(f); }
private void TextBox_OnKeyDown(object sender, KeyEventArgs e) { if ((Keyboard.Modifiers == ModifierKeys.Control) && (e.Key == Key.S)) { //App.Title =; MainWindow.changeHeader(FileOperations.SaveFile(TextBox.Text)); } if ((Keyboard.Modifiers == ModifierKeys.Control) && (e.Key == Key.N)) { NewFile(); } if ((Keyboard.Modifiers == ModifierKeys.Control) && (e.Key == Key.O)) { FileDetails details = FileOperations.OpenFile(); TextBox.Text = details.file; MainWindow.changeHeader(details.fileName); //App.Title = details.fileName; } }
// TODO: May want to seperate the UI model into another class? private void menuItemOpen_Click(object sender, RoutedEventArgs e) { FileDetails details = FileOperations.OpenFile(); UISetFile(details); }
internal static FileDetails OpenFileNoDialog(string fileName) { FileDetails f= new FileDetails(); StreamReader reader = new StreamReader(fileName); f.file = reader.ReadToEnd(); reader.Close(); f.fileName = fileName; return f; }
internal static FileDetails OpenFile() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"; FileDetails f = new FileDetails(); if (ofd.ShowDialog() == true) { f = OpenFileNoDialog(ofd.FileName); } return f; }