示例#1
0
        void OnCreateFileClicked(object sender, EventArgs a)
        {
            string fileName = "";
            string content  = "";

            NewFileDialog nfd = new NewFileDialog();

            int result = nfd.Run();

            if (result == (int)ResponseType.Ok)
            {
                fileName = nfd.FileName;
                content  = nfd.Content;
            }
            nfd.Destroy();
            if (String.IsNullOrEmpty(fileName))
            {
                return;
            }

            string newFile = System.IO.Path.Combine(parent.FullName, fileName);

            try {
                FileUtility.CreateFile(newFile, content);
            } catch {
                MessageDialogs md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            FillStore(false);
        }
示例#2
0
文件: NewAction.cs 项目: moscrif/ide
        protected override void OnActivated()
        {
            Console.WriteLine("newfile - activate");
            base.OnActivated();
            NewFileDialog nfd = new NewFileDialog();

            int result = nfd.Run();
            if (result == (int)ResponseType.Ok) {

                string fileName = nfd.FileName;
                string content = nfd.Content;
                MainClass.MainWindow.CreateFile(fileName,content);
            }
            nfd.Destroy();
            MainClass.MainWindow.SaveWorkspace();
        }
示例#3
0
        void OnAddFileClicked(object sender, EventArgs a)
        {
            TreeIter tiDirectory = new TreeIter();
            string pathDir = GetDirectory(ref tiDirectory);

            if(String.IsNullOrEmpty(pathDir)){
                return;
            }

            string fileName = "";
            string content ="";

            NewFileDialog nfd = new NewFileDialog();

            int result = nfd.Run();
            if (result == (int)ResponseType.Ok) {
                fileName = nfd.FileName;
                content = nfd.Content;
            }
            nfd.Destroy();
            if (String.IsNullOrEmpty(fileName) ) return;

            string newFile = System.IO.Path.Combine(pathDir, fileName);

            try {
                FileUtility.CreateFile(newFile,content);
            } catch {
                MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            RefreshDir(pathDir, tiDirectory);
            /*if(MainClass.Workspace != null && !String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                LoadLibs(MainClass.Workspace.RootDirectory);
            };*/
        }
示例#4
0
        void OnCreateFileClicked(object sender, EventArgs a)
        {
            string fileName = "";
            string content ="";

            NewFileDialog nfd = new NewFileDialog();

            int result = nfd.Run();
            if (result == (int)ResponseType.Ok) {
                fileName = nfd.FileName;
                content = nfd.Content;
            }
            nfd.Destroy();
            if (String.IsNullOrEmpty(fileName) ) return;

            string newFile = System.IO.Path.Combine(parent.FullName, fileName);

            try {
                FileUtility.CreateFile(newFile,content);

            } catch {
                MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            FillStore (false);
        }