Ejemplo n.º 1
0
        public void Setfile(FileInfo file)
        {
            openfile = file;
            try
            {
                using (StreamReader reader = new StreamReader(new FileStream(openfile.FullName, FileMode.Open)))
                {
                    string filetext = reader.ReadToEnd();
                    view.Buffer      = new TextBuffer(null);
                    view.Buffer.Text = filetext;

                    Label  filelabel  = new Label(openfile.Name);
                    Button filebutton = new Button("window-close", IconSize.Menu);
                    filebutton.Clicked += CloseEditor;
                    tabutton.Add(filelabel);
                    tabutton.Add(filebutton);
                    tabutton.ShowAll();
                }
                base.ShowAll();
            }
            catch (Exception) { }
        }
Ejemplo n.º 2
0
        public void SetDirectory(string path)
        {
            if (!System.IO.Path.EndsInDirectorySeparator(path))
            {
                path += System.IO.Path.DirectorySeparatorChar;
            }
            directory         = new DirectoryInfo(path);
            Current_Directory = new Label(directory.Name);
            box.Add(Current_Directory);
            FileInfo[] tempfiles = directory.GetFiles();

            foreach (FileInfo file in tempfiles)
            {
                Button filebutton = new Button(file.FullName);
                filebutton.Label      = file.Name;
                filebutton.ActionName = file.FullName;
                filebutton.Clicked   += clickhandler;
                filebutton.Sensitive  = true;
                box.Add(filebutton);
            }
            box.ShowAll();
            base.Add(box);
            base.ShowAll();
        }