Example #1
0
        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);
        }
Example #2
0
 private void UISetFile(FileDetails details)
 {
     TextBox.Text = details.file;
     MainWindow.changeHeader(details.fileName);
     //this.Parent.Title = details.fileName;
     windowToFilenameDictionary[0] = details.fileName;
 }
Example #3
0
 private void UISetFile(FileDetails details)
 {
     TextBox.Text = details.file;
     MainWindow.changeHeader(details.fileName);
     //this.Parent.Title = details.fileName;
     windowToFilenameDictionary[0] = details.fileName;
 }
Example #4
0
        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);
        }
Example #5
0
 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);
     }
 }
Example #6
0
        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);
        }
Example #7
0
        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;
            }
        }
Example #8
0
        // 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);
        }
Example #9
-1
        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;
        }
Example #10
-1
        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;
        }