Пример #1
0
 public DocumentPage(IMainForm main_form, ActiveCodeFile file)
     : this(main_form, file.FileExtension)
 {
     InitializeComponent();
     UpdateFileName(file);
     ActiveFile = file;
     //this.ImageIndex = 0;
 }
        public void OpenFile()
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "All Files (*.*)|*.*";

            if (open.ShowDialog() == DialogResult.OK)
            {
                ActiveCodeFile file = new ActiveCodeFile(open.FileName);
                file.Unsaved = false;
                OpenFile(file);
            }
        }
Пример #3
0
 internal void UpdateFileName(ActiveCodeFile file)
 {
     //System.Console.WriteLine("DocumentPage.UpdateFileName to " + file.FileName);
     Text = file.FileName;
 }
Пример #4
0
 public void OpenFile(IMainForm main_form, ActiveCodeFile file)
 {
     DocumentPage tab = new DocumentPage(main_form, file);
     if (FontToUse != null)
         tab.Input.Font = FontToUse;
     tab.SetInitialText(File.ReadAllText(file.Location));
     tabControl.TabPages.Add(tab);
     tabControl.SelectedTab = tab;
 }
Пример #5
0
 public void OpenFile(IMainForm main_form, ActiveCodeFile file)
 {
     _docManager.OpenFile(main_form, file);
     SetButtonsStatus();
 }
 public void OpenFile(ActiveCodeFile file)
 {
     if (File.Exists(file.Location))
         pyjamaForm.OpenFile(pyjamaForm, file);
     else
         throw new FileNotFoundException("File not found", file.Location);
 }
 public void OpenFile(string filename)
 {
     ActiveCodeFile file = new ActiveCodeFile(filename);
     file.Unsaved = false;
     OpenFile(file);
 }
        private ActiveCodeFile CreateDefaultActiveFile(string language)
        {
            // FIXME: connect to loaded languages in Shell
            string usedFileExt = ApplicationOptions.DefaultExtension;
            string file = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) + usedFileExt;
            string path = Path.Combine(Path.GetTempPath(), file);
            using (StreamWriter sw = new StreamWriter(path))
                sw.Close();

            ActiveCodeFile code = new ActiveCodeFile();
            code.Location = path;
            code.Untitled = true;
            code.FileName = "Untitled";
            code.Unsaved = true;
            return code;
        }